From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46589) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XWogi-00031R-Hp for qemu-devel@nongnu.org; Wed, 24 Sep 2014 11:41:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XWogc-0002QJ-58 for qemu-devel@nongnu.org; Wed, 24 Sep 2014 11:41:04 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49838) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XWogb-0002Oh-PV for qemu-devel@nongnu.org; Wed, 24 Sep 2014 11:40:58 -0400 Date: Wed, 24 Sep 2014 17:40:43 +0200 From: Igor Mammedov Message-ID: <20140924174043.2023d581@nial.usersys.redhat.com> In-Reply-To: <1411563641.30748.7.camel@nilsson.home.kraxel.org> References: <1411559299-19042-1-git-send-email-imammedo@redhat.com> <1411559299-19042-29-git-send-email-imammedo@redhat.com> <1411563641.30748.7.camel@nilsson.home.kraxel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 28/30] usb: convert to hotplug handler API List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gerd Hoffmann Cc: dmitry@daynix.com, mst@redhat.com, agraf@suse.de, qemu-devel@nongnu.org, cornelia.huck@de.ibm.com, amit.shah@redhat.com, pbonzini@redhat.com, borntraeger@de.ibm.com, rth@twiddle.net 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; /* 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 > >