qemu-devel
[Top][All Lists]
Advanced

[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: Igor Mammedov
Subject: Re: [Qemu-devel] [PATCH 28/30] usb: convert to hotplug handler API
Date: Wed, 24 Sep 2014 17:40:43 +0200

On Wed, 24 Sep 2014 15:00:41 +0200
Gerd Hoffmann <address@hidden> 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; /* 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);
ok

> 
> 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?
sure

> 
> cheers,
>   Gerd
> 
> 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]