On Mon, 09 Dec 2013 14:47:00 +0100 Paolo Bonzini <pbonz...@redhat.com> wrote:
> Il 09/12/2013 14:41, Igor Mammedov ha scritto: > >> > Please move the parts under the "if" to hotplug.c (something like > >> > hotplug_handler_plug and hotplug_handler_unplug). Also, should this be > > sure. > > > >> > moved up to generic code (e.g. bus_add_child/bus_remove_child)? > > Current usage hints that it's more realize() related part. If handler > > fails device might want to do same device specific failure handling > > before returning from realize() with failure. > > It will work in bus_add_child/bus_remove_child as well but it would > > basically put handlers to nofail category. > > Makes sense. realize() for the "plug" handler, and qdev_unplug for the > unplug handler, I guess. Just to be sure, I've meant not DEVICE.realize() but each device specific one. qdev_unplug() might work for now, but I haven't checked all devices that might use interface and if it would break anything. Ideally it should be in device's unrealize() complementing realize() part. I'd wait till all buses converted to new interface before attempting to generalize current plug/unplug call pathes though. > > Paolo >