Received: from eggs.gnu.org ([2001:4830:134:3::10]:37527) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XeEy6-00069N-Tu for qemu-devel@nongnu.org; Tue, 14 Oct 2014 23:09:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XeExy-0004r0-9x for qemu-devel@nongnu.org; Tue, 14 Oct 2014 23:09:42 -0400 Received: from cantor2.suse.de ([195.135.220.15]:49355 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XeExy-0004qe-2s for qemu-devel@nongnu.org; Tue, 14 Oct 2014 23:09:34 -0400 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Wed, 15 Oct 2014 05:09:05 +0200 Message-Id: <1413342561-4754-32-git-send-email-afaerber@suse.de> In-Reply-To: <1413342561-4754-1-git-send-email-afaerber@suse.de> References: <1413342561-4754-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PULL 31/47] scsi: Set SCSI BUS itself as default HotplugHandler List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Igor Mammedov , =?UTF-8?q?Andreas=20F=C3=A4rber?= , Paolo Bonzini From: Igor Mammedov That would allow to handle SCSI device unplug on HBAs without dedicated hot(un)plug handlers and avoid making such HBAs explicitly hotpluggable. Signed-off-by: Igor Mammedov Reviewed-by: Paolo Bonzini Signed-off-by: Andreas F=C3=A4rber --- hw/scsi/scsi-bus.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c index 0f3e039..c454331 100644 --- a/hw/scsi/scsi-bus.c +++ b/hw/scsi/scsi-bus.c @@ -23,9 +23,11 @@ static Property scsi_props[] =3D { static void scsi_bus_class_init(ObjectClass *klass, void *data) { BusClass *k =3D BUS_CLASS(klass); + HotplugHandlerClass *hc =3D HOTPLUG_HANDLER_CLASS(klass); =20 k->get_dev_path =3D scsibus_get_dev_path; k->get_fw_dev_path =3D scsibus_get_fw_dev_path; + hc->unplug =3D qdev_simple_device_unplug_cb; } =20 static const TypeInfo scsi_bus_info =3D { @@ -33,6 +35,10 @@ static const TypeInfo scsi_bus_info =3D { .parent =3D TYPE_BUS, .instance_size =3D sizeof(SCSIBus), .class_init =3D scsi_bus_class_init, + .interfaces =3D (InterfaceInfo[]) { + { TYPE_HOTPLUG_HANDLER }, + { } + } }; static int next_scsi_bus; =20 @@ -92,7 +98,7 @@ void scsi_bus_new(SCSIBus *bus, size_t bus_size, Device= State *host, qbus_create_inplace(bus, bus_size, TYPE_SCSI_BUS, host, bus_name); bus->busnr =3D next_scsi_bus++; bus->info =3D info; - bus->qbus.allow_hotplug =3D 1; + qbus_set_bus_hotplug_handler(BUS(bus), &error_abort); } =20 static void scsi_dma_restart_bh(void *opaque) --=20 1.8.4.5