Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Sep 2006 15:54:01 -0400
From:      John Baldwin <jhb@freebsd.org>
To:        src-committers@freebsd.org
Cc:        cvs-src@freebsd.org, cvs-all@freebsd.org
Subject:   Re: cvs commit: src/sys/kern bus_if.m subr_bus.c
Message-ID:  <200609111554.01848.jhb@freebsd.org>
In-Reply-To: <200609111941.k8BJfV8U089067@repoman.freebsd.org>
References:  <200609111941.k8BJfV8U089067@repoman.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200609111554.01848.jhb>