Date: Wed, 6 Apr 2011 08:48:39 -0400 From: John Baldwin <jhb@freebsd.org> To: freebsd-current@freebsd.org Cc: Andriy Gapon <avg@freebsd.org>, Hans Petter Selasky <hselasky@freebsd.org>, freebsd-usb@freebsd.org Subject: Re: use_generic and usb probing Message-ID: <201104060848.40278.jhb@freebsd.org> In-Reply-To: <201104060933.47350.hselasky@freebsd.org> References: <201104051321.56319.hselasky@freebsd.org> <4D9B473F.8020607@FreeBSD.org> <201104060933.47350.hselasky@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wednesday, April 06, 2011 3:33:47 am Hans Petter Selasky wrote: > On Tuesday 05 April 2011 18:45:51 Andriy Gapon wrote: > > on 05/04/2011 15:55 Hans Petter Selasky said the following: > > > On Tuesday 05 April 2011 14:50:43 Andriy Gapon wrote: > > >> I believe that newbus already supports ordering of children on a bus. > > >> > > >> BTW, does USB have to pass anything from probe to attach? > > > > > > Mostly only the driver info field. To avoid duplicate lookups. > > > > > >> Duplicate lookup is of course not very nice, but duplicate probing pass > > >> is not nice either. > > > > > > This can all be avoided if the bus-drivers are sorted correctly before > > > probing! > > Hi, > > > > > Well, I think that that's what probe priorities actually for. > > I also think that typically ivars should be set by a bus driver. So maybe > > it's not such a good idea to pass data from probe to attach via ivars in > > child drivers. But I could be mistaken about that. > > > > The same device_t is used to do all the probes! > > > Practically speaking, you most likely don't have to worry about that for > > drivers that return BUS_PROBE_SPECIFIC (=0) from their probe methods. And > > there is only a few "generic" drivers that can be handled on a case by > > case basis. > > There are more drivers that needs patching! Please scan all of the kernel > files for usbdi.h and the use_generic flag. > > After looking at subr_usb.c I see your solution is fine as long as the PROBE() > method that it attaches is the last one called before ATTACH(). If this is > documented in how newbus should function, then please go ahead updating your > patch to cover all USB drivers using use_generic. Yes. The device_probe() routine is called for the "best" matching driver (based on the return values from device_probe()) before device_attach() is called. Check device_probe_child() for the gory details including: if (pri < 0) { /* * A bit bogus. Call the probe method again to make * sure that we have the right description. */ DEVICE_PROBE(child); #if 0 child->flags |= DF_REBID; #endif } else child->flags &= ~DF_REBID; child->state = DS_ALIVE; -- John Baldwin
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201104060848.40278.jhb>