Re: [Qemu-devel] [PATCH 28/30] usb: convert to hotplug handler API

2014-09-25 Thread Igor Mammedov
On Thu, 25 Sep 2014 14:47:31 +0200 Paolo Bonzini wrote: > Il 25/09/2014 12:55, Igor Mammedov ha scritto: > > hotplug-handler.[plug|unplug] callbacks are class wide, so if > > USB bus might ever need to have different callbacks depending on > > host it might not work. > > > > But since so far it

Re: [Qemu-devel] [PATCH 28/30] usb: convert to hotplug handler API

2014-09-25 Thread Paolo Bonzini
Il 25/09/2014 12:55, Igor Mammedov ha scritto: > hotplug-handler.[plug|unplug] callbacks are class wide, so if > USB bus might ever need to have different callbacks depending on > host it might not work. > > But since so far it uses the only qdev_simple_device_unplug_cb(), > having BUS as hotplug-

Re: [Qemu-devel] [PATCH 28/30] usb: convert to hotplug handler API

2014-09-25 Thread Igor Mammedov
On Thu, 25 Sep 2014 09:50:58 +0200 Gerd Hoffmann wrote: > On Mi, 2014-09-24 at 17:39 +0200, Igor Mammedov wrote: > > On Wed, 24 Sep 2014 15:23:41 +0200 > > Gerd Hoffmann wrote: > > > > > Hi, > > > > > > > > Can't we do this in usb_bus_new instead of duplicating in every host > > > > > adapte

Re: [Qemu-devel] [PATCH 28/30] usb: convert to hotplug handler API

2014-09-25 Thread Gerd Hoffmann
On Mi, 2014-09-24 at 17:39 +0200, Igor Mammedov wrote: > On Wed, 24 Sep 2014 15:23:41 +0200 > Gerd Hoffmann wrote: > > > Hi, > > > > > > Can't we do this in usb_bus_new instead of duplicating in every host > > > > adapter? > > > > > > So you would make TYPE_USB_BUS the hotplug handler itself,

Re: [Qemu-devel] [PATCH 28/30] usb: convert to hotplug handler API

2014-09-24 Thread Igor Mammedov
On Wed, 24 Sep 2014 15:23:41 +0200 Gerd Hoffmann wrote: > Hi, > > > > Can't we do this in usb_bus_new instead of duplicating in every host > > > adapter? > > > > So you would make TYPE_USB_BUS the hotplug handler itself, instead of > > the controller? > > I was more thinking of just setting

Re: [Qemu-devel] [PATCH 28/30] usb: convert to hotplug handler API

2014-09-24 Thread Igor Mammedov
On Wed, 24 Sep 2014 15:00:41 +0200 Gerd Hoffmann wrote: > > @@ -81,7 +81,7 @@ void usb_bus_new(USBBus *bus, size_t bus_size, > > qbus_create_inplace(bus, bus_size, TYPE_USB_BUS, host, NULL); > > bus->ops = ops; > > bus->busnr = next_usb_bus++; > > -bus->qbus.allow_hotplug = 1;

Re: [Qemu-devel] [PATCH 28/30] usb: convert to hotplug handler API

2014-09-24 Thread Gerd Hoffmann
Hi, > > Can't we do this in usb_bus_new instead of duplicating in every host > > adapter? > > So you would make TYPE_USB_BUS the hotplug handler itself, instead of > the controller? I was more thinking of just setting the callback in common code, but if we can attach the hotplug interface to t

Re: [Qemu-devel] [PATCH 28/30] usb: convert to hotplug handler API

2014-09-24 Thread Paolo Bonzini
Il 24/09/2014 15:00, Gerd Hoffmann ha scritto: >> @@ -81,7 +81,7 @@ void usb_bus_new(USBBus *bus, size_t bus_size, >> qbus_create_inplace(bus, bus_size, TYPE_USB_BUS, host, NULL); >> bus->ops = ops; >> bus->busnr = next_usb_bus++; >> -bus->qbus.allow_hotplug = 1; /* Yes, we can *

Re: [Qemu-devel] [PATCH 28/30] usb: convert to hotplug handler API

2014-09-24 Thread Gerd Hoffmann
> @@ -81,7 +81,7 @@ void usb_bus_new(USBBus *bus, size_t bus_size, > qbus_create_inplace(bus, bus_size, TYPE_USB_BUS, host, NULL); > bus->ops = ops; > bus->busnr = next_usb_bus++; > -bus->qbus.allow_hotplug = 1; /* Yes, we can */ > +qbus_set_hotplug_handler(BUS(bus), host, &e

[Qemu-devel] [PATCH 28/30] usb: convert to hotplug handler API

2014-09-24 Thread Igor Mammedov
Signed-off-by: Igor Mammedov --- hw/usb/bus.c | 3 +-- hw/usb/dev-smartcard-reader.c | 8 +++- hw/usb/hcd-ehci-pci.c | 6 ++ hw/usb/hcd-ehci-sysbus.c | 6 ++ hw/usb/hcd-ohci.c | 12 hw/usb/hcd-uhci.c | 6 ++ h