Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 3 Sep 2009 15:46:41 +0200
From:      Attilio Rao <attilio@freebsd.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org,  svn-src-head@freebsd.org
Subject:   Re: svn commit: r196779 - in head/sys: kern sys
Message-ID:  <3bbf2fe10909030646o2dc30166r303ee646572c741b@mail.gmail.com>
In-Reply-To: <200909031340.n83Defkv034013@svn.freebsd.org>
References:  <200909031340.n83Defkv034013@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
2009/9/3 Attilio Rao <attilio@freebsd.org>:
> Author: attilio
> Date: Thu Sep  3 13:40:41 2009
> New Revision: 196779
> URL: http://svn.freebsd.org/changeset/base/196779
>
> Log:
>  Add intermediate states for attaching and detaching that will be
>  reused by the enhached newbus locking once it is checked in.
>  This change can be easilly MFCed to STABLE_8 at the appropriate moment.

About this commit, there are a few of things which worths nothing:
- This has been committed separately from the new-bus locking because
it is planned to be MFCed before 8.0 goes out in order to offer the
correct ABI compatibility for merging, while 8.1-REL, the newbus
locking
- Probabilly what we really wanted here is just a transitioning state
instead than both DS_ATTACHING and DS_DETACHING. Some consumers would
eventually understand what of the 2 is that and one of these consumers
is device_is_attached(). That function is used improperly by many
detach handlers in a construct like:

int
foo_attach(device_t dev)
{
...
if (error != 0)
        foo_detach(dev);
...
}

int
foo_detach(device_dev)
{
...
if (device_is_attached(dev)) {
 /* do some handover */
}
...
}

That is an incorrect behaviour which needs to be discouraged and that
will be fixed during 9.0.
In the while this semantic (used by many drivers) makes the
single-transition state impraticable and so we will need to stick with
that device states also in 9.0.

Attilio


-- 
Peace can only be achieved by understanding - A. Einstein



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