diff mbox

[21/30] scsi: make scsi_bus_new() assign hotplug controller

Message ID 1411559299-19042-22-git-send-email-imammedo@redhat.com
State New
Headers show

Commit Message

Igor Mammedov Sept. 24, 2014, 11:48 a.m. UTC
it will allow incrementally convert every controller that
creates SCSI bus and supports hotplug to hotplug controller API

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/scsi/scsi-bus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Paolo Bonzini Sept. 24, 2014, 12:11 p.m. UTC | #1
Il 24/09/2014 13:48, Igor Mammedov ha scritto:
> it will allow incrementally convert every controller that
> creates SCSI bus and supports hotplug to hotplug controller API
> 
> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> ---
>  hw/scsi/scsi-bus.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c
> index 954c607..33495b6 100644
> --- a/hw/scsi/scsi-bus.c
> +++ b/hw/scsi/scsi-bus.c
> @@ -92,7 +92,7 @@ void scsi_bus_new(SCSIBus *bus, size_t bus_size, DeviceState *host,
>      qbus_create_inplace(bus, bus_size, TYPE_SCSI_BUS, host, bus_name);
>      bus->busnr = next_scsi_bus++;
>      bus->info = info;
> -    bus->qbus.allow_hotplug = 1;
> +    qbus_set_hotplug_handler(BUS(bus), host, &error_abort);
>  }
>  
>  static void scsi_dma_restart_bh(void *opaque)
> 

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Paolo Bonzini Sept. 24, 2014, 12:14 p.m. UTC | #2
Il 24/09/2014 13:48, Igor Mammedov ha scritto:
> it will allow incrementally convert every controller that
> creates SCSI bus and supports hotplug to hotplug controller API
> 
> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> ---
>  hw/scsi/scsi-bus.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c
> index 954c607..33495b6 100644
> --- a/hw/scsi/scsi-bus.c
> +++ b/hw/scsi/scsi-bus.c
> @@ -92,7 +92,7 @@ void scsi_bus_new(SCSIBus *bus, size_t bus_size, DeviceState *host,
>      qbus_create_inplace(bus, bus_size, TYPE_SCSI_BUS, host, bus_name);
>      bus->busnr = next_scsi_bus++;
>      bus->info = info;
> -    bus->qbus.allow_hotplug = 1;
> +    qbus_set_hotplug_handler(BUS(bus), host, &error_abort);
>  }
>  
>  static void scsi_dma_restart_bh(void *opaque)
> 

Hmm, what if the host is not a HotplugHandler?  Then you should just do
nothing for plug, and object_unparent for unplug.  Is that broken by
this patch?

Paolo
Igor Mammedov Sept. 24, 2014, 3 p.m. UTC | #3
On Wed, 24 Sep 2014 14:14:48 +0200
Paolo Bonzini <pbonzini@redhat.com> wrote:

> Il 24/09/2014 13:48, Igor Mammedov ha scritto:
> > it will allow incrementally convert every controller that
> > creates SCSI bus and supports hotplug to hotplug controller API
> > 
> > Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> > ---
> >  hw/scsi/scsi-bus.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c
> > index 954c607..33495b6 100644
> > --- a/hw/scsi/scsi-bus.c
> > +++ b/hw/scsi/scsi-bus.c
> > @@ -92,7 +92,7 @@ void scsi_bus_new(SCSIBus *bus, size_t bus_size, DeviceState *host,
> >      qbus_create_inplace(bus, bus_size, TYPE_SCSI_BUS, host, bus_name);
> >      bus->busnr = next_scsi_bus++;
> >      bus->info = info;
> > -    bus->qbus.allow_hotplug = 1;
> > +    qbus_set_hotplug_handler(BUS(bus), host, &error_abort);
> >  }
> >  
> >  static void scsi_dma_restart_bh(void *opaque)
> > 
> 
> Hmm, what if the host is not a HotplugHandler?  Then you should just do
> nothing for plug, and object_unparent for unplug.  Is that broken by
> this patch?
It will break with 24/30. I'll respin with all not yet converted
HBAs implementing  HotplugHandler interface with simple unplug callback.

> 
> Paolo
>
diff mbox

Patch

diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c
index 954c607..33495b6 100644
--- a/hw/scsi/scsi-bus.c
+++ b/hw/scsi/scsi-bus.c
@@ -92,7 +92,7 @@  void scsi_bus_new(SCSIBus *bus, size_t bus_size, DeviceState *host,
     qbus_create_inplace(bus, bus_size, TYPE_SCSI_BUS, host, bus_name);
     bus->busnr = next_scsi_bus++;
     bus->info = info;
-    bus->qbus.allow_hotplug = 1;
+    qbus_set_hotplug_handler(BUS(bus), host, &error_abort);
 }
 
 static void scsi_dma_restart_bh(void *opaque)