From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33738) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XYYgg-0003zm-19 for qemu-devel@nongnu.org; Mon, 29 Sep 2014 07:00:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XYYgW-0004jc-WF for qemu-devel@nongnu.org; Mon, 29 Sep 2014 07:00:13 -0400 Received: from mail-we0-x235.google.com ([2a00:1450:400c:c03::235]:35723) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XYYgW-0004Yg-PM for qemu-devel@nongnu.org; Mon, 29 Sep 2014 07:00:04 -0400 Received: by mail-we0-f181.google.com with SMTP id u57so1233711wes.12 for ; Mon, 29 Sep 2014 03:59:58 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <54293BA9.7090600@redhat.com> Date: Mon, 29 Sep 2014 12:59:53 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1411723721-20484-1-git-send-email-imammedo@redhat.com> <1411723721-20484-18-git-send-email-imammedo@redhat.com> In-Reply-To: <1411723721-20484-18-git-send-email-imammedo@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 17/36] qdev: add wrapper to set BUS as HotplugHandler List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Igor Mammedov , qemu-devel@nongnu.org Cc: dmitry@daynix.com, borntraeger@de.ibm.com, mst@redhat.com, agraf@suse.de, amit.shah@redhat.com, kraxel@redhat.com, cornelia.huck@de.ibm.com, rth@twiddle.net Il 26/09/2014 11:28, Igor Mammedov ha scritto: > to be used for conversion of SCSI and USB devices, > and would allow to make every HBA/USB host switch > to HotplugHandler API without touching each controller > explicitly. > > Signed-off-by: Igor Mammedov > --- > hw/core/qdev.c | 19 +++++++++++++++++++ > include/hw/qdev-core.h | 11 ++++------- > 2 files changed, 23 insertions(+), 7 deletions(-) > > diff --git a/hw/core/qdev.c b/hw/core/qdev.c > index 1d1b113..0de99b2 100644 > --- a/hw/core/qdev.c > +++ b/hw/core/qdev.c > @@ -112,6 +112,25 @@ void qdev_set_parent_bus(DeviceState *dev, BusState *bus) > bus_add_child(bus, dev); > } > > +static void qbus_set_hotplug_handler_internal(BusState *bus, Object *handler, > + Error **errp) > +{ > + > + object_property_set_link(OBJECT(bus), OBJECT(handler), > + QDEV_HOTPLUG_HANDLER_PROPERTY, errp); > + bus->allow_hotplug = 1; > +} > + > +void qbus_set_hotplug_handler(BusState *bus, DeviceState *handler, Error **errp) > +{ > + qbus_set_hotplug_handler_internal(bus, OBJECT(handler), errp); > +} > + > +void qbus_set_bus_hotplug_handler(BusState *bus, Error **errp) > +{ > + qbus_set_hotplug_handler_internal(bus, OBJECT(bus), errp); > +} > + > /* Create a new device. This only initializes the device state structure > and allows properties to be set. qdev_init should be called to > initialize the actual device emulation. */ > diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h > index ba812c5..48e9579 100644 > --- a/include/hw/qdev-core.h > +++ b/include/hw/qdev-core.h > @@ -363,13 +363,10 @@ extern int qdev_hotplug; > > char *qdev_get_dev_path(DeviceState *dev); > > -static inline void qbus_set_hotplug_handler(BusState *bus, DeviceState *handler, > - Error **errp) > -{ > - object_property_set_link(OBJECT(bus), OBJECT(handler), > - QDEV_HOTPLUG_HANDLER_PROPERTY, errp); > - bus->allow_hotplug = 1; > -} > +void qbus_set_hotplug_handler(BusState *bus, DeviceState *handler, > + Error **errp); > + > +void qbus_set_bus_hotplug_handler(BusState *bus, Error **errp); > > static inline bool qbus_is_hotpluggable(BusState *bus) > { > Reviewed-by: Paolo Bonzini