cvs commit: src/sys/kern bus_if.m subr_bus.c

John Baldwin jhb at freebsd.org
Mon Sep 11 13:23:10 PDT 2006


On Monday 11 September 2006 15:41, John Baldwin wrote:
> jhb         2006-09-11 19:41:31 UTC
> 
>   FreeBSD src repository
> 
>   Modified files:
>     sys/kern             bus_if.m subr_bus.c 
>   Log:
>   Add a default method for BUS_ADD_CHILD() that just calls
>   device_add_child_ordered().  Previously, a device driver that wanted to
>   add a new child device in its identify routine had to know if the parent
>   driver had a custom bus_add_child method and use BUS_ADD_CHILD() in that
>   case, otherwise use device_add_child().  Getting it wrong in either
>   direction would result in panics or failure to add the child device.  Now,
>   BUS_ADD_CHILD() always works isolating child drivers from having to know
>   intimate details about the parent driver.
>   
>   Discussed with: imp
>   MFC after:      1 week

This means that drivers should really use BUS_ADD_CHILD() rather than 
device_add_child() btw now (more or less).  We normally use wrappers around 
KOBJ invocations in new-bus to cut down on the shouting (BUS_SETUP_INTR() vs 
bus_setup_intr(), e.g.), but in this case there's no child device to call 
device_get_parent() on to get the first arg, so I'm not sure we can make it 
pretty.  I wouldn't like to repurpose device_add_child(), though perhaps we 
could have a bus_add_child() that didn't accept the order for the common 
case?

-- 
John Baldwin


More information about the cvs-all mailing list