From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57899) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YpbJW-0002KB-Bp for qemu-devel@nongnu.org; Tue, 05 May 2015 07:47:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YpbJU-0003e3-GE for qemu-devel@nongnu.org; Tue, 05 May 2015 07:47:02 -0400 Date: Tue, 5 May 2015 21:42:09 +1000 From: David Gibson Message-ID: <20150505114209.GF14090@voom.redhat.com> References: <1430335224-6716-1-git-send-email-mdroth@linux.vnet.ibm.com> <1430335224-6716-12-git-send-email-mdroth@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="l+RjsdkfuJDA0G6K" Content-Disposition: inline In-Reply-To: <1430335224-6716-12-git-send-email-mdroth@linux.vnet.ibm.com> Subject: Re: [Qemu-devel] [RFC PATCH 11/15] qdev: add qbus_set_hotplug_handler_generic() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Michael Roth Cc: Eduardo Habkost , "Michael S. Tsirkin" , aik@ozlabs.ru, qemu-devel@nongnu.org, qemu-ppc@nongnu.org, bharata@linux.vnet.ibm.com, nfont@linux.vnet.ibm.com --l+RjsdkfuJDA0G6K Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Apr 29, 2015 at 02:20:20PM -0500, Michael Roth wrote: > Certain devices types, like memory/CPU, are now being handled using a > hotplug interface provided by a top-level MachineClass. Hotpluggable > host bridges are another such device where it makes sense to use a > machine-level hotplug handler. However, unlike those devices, > host-bridges have a parent bus (the main system bus), and devices with > a parent bus use a different mechanism for registering their hotplug > handlers: qbus_set_hotplug_handler(). This interface currently expects > a handler to be a subclass of DeviceClass, but this is not the case > for MachineClass, which derives directly from ObjectClass. >=20 > Internally, the interface only requires an ObjectClass, so expose that > support via a new qbus_set_hotplug_handler_generic(). >=20 > Cc: Michael S. Tsirkin > Cc: Eduardo Habkost > Signed-off-by: Michael Roth Seems odd to have to interfaces to me. Why not just change qbus_set_hotplug_handler() to take any ObjectClass? > --- > hw/core/qdev.c | 9 ++++----- > include/hw/qdev-core.h | 2 ++ > 2 files changed, 6 insertions(+), 5 deletions(-) >=20 > diff --git a/hw/core/qdev.c b/hw/core/qdev.c > index fda1d2f..8fd9320 100644 > --- a/hw/core/qdev.c > +++ b/hw/core/qdev.c > @@ -108,22 +108,21 @@ void qdev_set_parent_bus(DeviceState *dev, BusState= *bus) > bus_add_child(bus, dev); > } > =20 > -static void qbus_set_hotplug_handler_internal(BusState *bus, Object *han= dler, > - Error **errp) > +void qbus_set_hotplug_handler_generic(BusState *bus, Object *handler, > + Error **errp) > { > - > object_property_set_link(OBJECT(bus), OBJECT(handler), > QDEV_HOTPLUG_HANDLER_PROPERTY, errp); > } > =20 > void qbus_set_hotplug_handler(BusState *bus, DeviceState *handler, Error= **errp) > { > - qbus_set_hotplug_handler_internal(bus, OBJECT(handler), errp); > + qbus_set_hotplug_handler_generic(bus, OBJECT(handler), errp); > } > =20 > void qbus_set_bus_hotplug_handler(BusState *bus, Error **errp) > { > - qbus_set_hotplug_handler_internal(bus, OBJECT(bus), errp); > + qbus_set_hotplug_handler_generic(bus, OBJECT(bus), errp); > } > =20 > /* Create a new device. This only initializes the device state structure > diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h > index 17f805e..3b210bf 100644 > --- a/include/hw/qdev-core.h > +++ b/include/hw/qdev-core.h > @@ -377,6 +377,8 @@ GSList *qdev_build_hotpluggable_device_list(Object *p= eripheral); > =20 > void qbus_set_hotplug_handler(BusState *bus, DeviceState *handler, > Error **errp); > +void qbus_set_hotplug_handler_generic(BusState *bus, Object *handler, > + Error **errp); > =20 > void qbus_set_bus_hotplug_handler(BusState *bus, Error **errp); > =20 --=20 David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson --l+RjsdkfuJDA0G6K Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJVSKyRAAoJEGw4ysog2bOSdUgP/jMgbBqk1bcGpivHshYFsLak UbhepjmDF9TOXcUNxuo5nGGuau0fqY58bQObiyqs76f68PGcQPKk1rUgdXQVXgzG tgnpKav4r+F2zw5YopjbXkZQyLQI8k85w0icQvzHe98JjwEuMZ6RQCNmhiKsdSLF w/0/UuIDkWqtqDaJkKNphXP8uJstPWJUk7Jwj2S/k/vsWZsQetaAsR66h/ETm8nA JJYOzH/vl3cIYV/uHcvWKdSszWt7M63mshjZJjiqPOfNjnyKs365hSu33SVOSJi1 oQ+x+YNEQuW9Q/ofl78QfVXwm/13ltSHAXkqMHA3vkbnmzX9uja0OJm+0MFYRehA hKmjSPyG+IiA9H1BR+UE2n5TGE3ksoRJnPnDvTGqQqbSYntqr/t8pznrrMhsG8sP Kvq6wpJ6wN5JPjTl8DmuUEF3RYRFVTa1iC8vcGxYzH8OAKuUF3dfs80sEJDi2U/J GqNCRCvQNPm340D0wOirnr38qu6+Er0q0YEoC4H4WyRqvSJ5ijTyyzgtBHXydHhh Ol4OQZxr5D7DCg21u+CM0B1nmGqWTzp5d2PDnm1xnvGjiRrIlpRTX8MCGsch5WZB tHFjvIdVS9XTOBRiwLMdXzSuEWqo18t3thQbdzxhmRyj9BJ+sWk8R3hkiVP+KJ7X TfxfB48f6faJo+0Gtsjz =7kvu -----END PGP SIGNATURE----- --l+RjsdkfuJDA0G6K--