[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 28/30] usb: convert to hotplug handler API
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH 28/30] usb: convert to hotplug handler API |
Date: |
Wed, 24 Sep 2014 15:04:40 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.0 |
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 */
>> + qbus_set_hotplug_handler(BUS(bus), host, &error_abort);
>> QTAILQ_INIT(&bus->free);
>> QTAILQ_INIT(&bus->used);
>> QTAILQ_INSERT_TAIL(&busses, bus, next);
>
>> diff --git a/hw/usb/dev-smartcard-reader.c b/hw/usb/dev-smartcard-reader.c
>> index d37ed02..91f7d87 100644
>> --- a/hw/usb/dev-smartcard-reader.c
>> +++ b/hw/usb/dev-smartcard-reader.c
>> @@ -1313,7 +1313,7 @@ static void ccid_realize(USBDevice *dev, Error **errp)
>> qbus_create_inplace(&s->bus, sizeof(s->bus), TYPE_CCID_BUS, DEVICE(dev),
>> NULL);
>> s->intr = usb_ep_get(dev, USB_TOKEN_IN, CCID_INT_IN_EP);
>> - s->bus.qbus.allow_hotplug = 1;
>> + qbus_set_hotplug_handler(BUS(&s->bus), DEVICE(dev), &error_abort);
>
> That is the ccid (smartcard) bus, please make it a separate patch.
>
>> diff --git a/hw/usb/hcd-ehci-pci.c b/hw/usb/hcd-ehci-pci.c
>> index 490f2b6..b7990da 100644
>> --- a/hw/usb/hcd-ehci-pci.c
>> +++ b/hw/usb/hcd-ehci-pci.c
>> @@ -138,6 +138,7 @@ static void ehci_class_init(ObjectClass *klass, void
>> *data)
>> {
>> DeviceClass *dc = DEVICE_CLASS(klass);
>> PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
>> + HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(klass);
>>
>> k->init = usb_ehci_pci_initfn;
>> k->exit = usb_ehci_pci_exit;
>> @@ -145,6 +146,7 @@ static void ehci_class_init(ObjectClass *klass, void
>> *data)
>> k->config_write = usb_ehci_pci_write_config;
>> dc->vmsd = &vmstate_ehci_pci;
>> dc->props = ehci_pci_properties;
>> + hc->unplug = qdev_simple_device_unplug_cb;
>> }
>
> 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? That would make sense since TYPE_USB_BUS already
coordinates hotplug/unplug with the HCD via the USBPortOps.
Paolo
- Re: [Qemu-devel] [PATCH 26/30] usb-storage: make its storage SCSI bus hotpluggable explicitly, (continued)
[Qemu-devel] [PATCH 30/30] qdev: HotplugHandler: add support for unplugging BUS-less devices, Igor Mammedov, 2014/09/24
[Qemu-devel] [PATCH 16/30] virtio-serial: convert to hotplug-handler API, Igor Mammedov, 2014/09/24
[Qemu-devel] [PATCH 27/30] usb-storage: drop not needed "allow_hotplug = 0", Igor Mammedov, 2014/09/24
[Qemu-devel] [PATCH 28/30] usb: convert to hotplug handler API, Igor Mammedov, 2014/09/24
- Re: [Qemu-devel] [PATCH 28/30] usb: convert to hotplug handler API, Gerd Hoffmann, 2014/09/24
- Re: [Qemu-devel] [PATCH 28/30] usb: convert to hotplug handler API,
Paolo Bonzini <=
- Re: [Qemu-devel] [PATCH 28/30] usb: convert to hotplug handler API, Gerd Hoffmann, 2014/09/24
- Re: [Qemu-devel] [PATCH 28/30] usb: convert to hotplug handler API, Igor Mammedov, 2014/09/24
- Re: [Qemu-devel] [PATCH 28/30] usb: convert to hotplug handler API, Gerd Hoffmann, 2014/09/25
- Re: [Qemu-devel] [PATCH 28/30] usb: convert to hotplug handler API, Igor Mammedov, 2014/09/25
- Re: [Qemu-devel] [PATCH 28/30] usb: convert to hotplug handler API, Paolo Bonzini, 2014/09/25
- Re: [Qemu-devel] [PATCH 28/30] usb: convert to hotplug handler API, Igor Mammedov, 2014/09/25
Re: [Qemu-devel] [PATCH 28/30] usb: convert to hotplug handler API, Igor Mammedov, 2014/09/24
[Qemu-devel] [PATCH 29/30] qdev: drop legacy hotplug fields/methods, Igor Mammedov, 2014/09/24