From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40551) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XX6hx-0000dg-4n for qemu-devel@nongnu.org; Thu, 25 Sep 2014 06:55:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XX6ho-00064r-GL for qemu-devel@nongnu.org; Thu, 25 Sep 2014 06:55:33 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39468) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XX6ho-00063L-7w for qemu-devel@nongnu.org; Thu, 25 Sep 2014 06:55:24 -0400 Date: Thu, 25 Sep 2014 12:55:09 +0200 From: Igor Mammedov Message-ID: <20140925125509.5454c0d8@nial.usersys.redhat.com> In-Reply-To: <1411631458.7154.1.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> <5422C168.9030001@redhat.com> <1411565021.30748.9.camel@nilsson.home.kraxel.org> <20140924173958.5a150ec5@nial.usersys.redhat.com> <1411631458.7154.1.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, Paolo Bonzini , borntraeger@de.ibm.com, rth@twiddle.net 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 > > > > > 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 the usb bus itself not the usb > > > host adapters that would be even better. And it'll probably kill some > > > headache for the companion controller case. > > How making bus a HotplugHandler itself will help with companion controller? > > When uhci acts as ehci companion it registers the ports with ehci and > doesn't manage its own usb bus. ehci will call uhci port ops as needed > (depending on ehci configuration). > > When attaching the hotplug interface to the host controller you'll have > to explicitly handle the companion case somehow. > > When attaching the hotplug interface to the usb bus everything should > just work. Additional bonus is that you also don't have to touch the > host controller code at all then, it should be doable by changing > hw/usb/bus.c only. 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-handler should work too. > > cheers, > Gerd > >