PERFORCE change 106148 for review

John Baldwin jhb at freebsd.org
Fri Sep 15 13:48:39 PDT 2006


On Friday 15 September 2006 14:39, Hans Petter Selasky wrote:
> Maybe a missing "if (*dmd->dmd_devclass == NULL)" here. It is not a big 
> problem. All the USB probe / attach  code is currently executed under Giant, 
> so there should not be any race condition. "devclass_find_internal()" 
> allocates memory with M_NOWAIT, and will not sleep and cause problems. 

Well, as long as new-bus eventually has locking to handle concurrent driver
adds (probably just a big sx lock around the whole thing) it will be fine.

> > typedef struct devclass  *devclass_t;
> >
> > Basically, passing a devclass_t into DRIVER_MODULE() just gives you a
> > pre-intialized pointer to your devclass.  The devclass's aren't bound to
> > that devclass_t though, they are bound to the name.  Thus if you have:
> >
> > static devclass_t foo_class, bar_class;
> >
> > static driver_t foo_driver {
> >  "foo", ...
> > };
> >
> > static driver_t bar_driver {
> >  "foo", ...
> > };
> >
> > DRIVER_MODULE(..., foo_driver, foo_devclass, ...);
> > DRIVER_MODULE(..., bar_driver, bar_devclass, ...);
> >
> 
> Yes, but I cannot set the "devclass" to "NULL" ? That will panic according 
to 
> the "driver_module_handler()" function ??

Yes.  I actually want to just remove it altogether because for almost all 
drivers it's worthless and just wastes space (granted, all of 1 pointer in 
the data seg of each driver).

-- 
John Baldwin


More information about the p4-projects mailing list