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
_______________________________________________
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"

Reply via email to