Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 1 Dec 1999 20:07:10 +0000 (GMT)
From:      Doug Rabson <dfr@nlsystems.com>
To:        Nick Hibma <hibma@skylink.it>
Cc:        FreeBSD Newbus Mailing List <new-bus@freebsd.org>, Doug Rabson <dfr@freebsd.org>
Subject:   Re: device_get_softc(devclass_get_unit(devclass, unit)) != devclass_get_softc(devclass, unit)
Message-ID:  <Pine.BSF.4.10.9912012005300.325-100000@salmon.nlsystems.com>
In-Reply-To: <Pine.BSF.4.20.9911262000300.366-100000@henny.jrc.it>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 26 Nov 1999, Nick Hibma wrote:

> Executed _during_attach_, a
> 
>    sc = devclass_get_softc(devclass, unit);
> 
> returns NULL, but a 
> 
>    sc = device_get_softc(devclass_get_unit(devclass, unit));
> 
> returns the softc. The statements are equivalent but the result is
> inconsistent.
> 
> 
> I suggest removing the limitation
> 
>    if (!dev || dev->state < DS_ATTACHED)
>       return NULL;
> 
> from devclass_get_softc (diff below).
> 
> Reason: if you do initialisation (for example CAM, XPT_SCAN_BUS in my
> case), you will end up in the routines that need this function before
> attach is finished and state >= DS_ATTACHED.
> 
> Second, none of the other functions uses this limitation
> (devclass_get_devices(), devclass_get_unit()).
> 
> Let me know your thoughts.

You are right. There is no harm returning the softc in this situation and
even if there is no driver, softc should be NULL which would be the
correct thing to return in any case.

--
Doug Rabson				Mail:  dfr@nlsystems.com
Nonlinear Systems Ltd.			Phone: +44 181 442 9037




To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-new-bus" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.10.9912012005300.325-100000>