Linux I2C development
 help / color / mirror / Atom feed
From: Guennadi Liakhovetski <g.liakhovetski-Mmb7MZpHnFY@public.gmane.org>
To: Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>
Cc: Linux I2C <linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: wrong driver remove order
Date: Tue, 25 Nov 2008 10:32:12 +0100 (CET)	[thread overview]
Message-ID: <Pine.LNX.4.64.0811251031010.6290@axis700.grange> (raw)
In-Reply-To: <20081125100256.7742e367-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>

On Tue, 25 Nov 2008, Jean Delvare wrote:

> On Mon, 17 Nov 2008 22:04:17 +0100, Jean Delvare wrote:
> > Hi Guennadi,
> > 
> > On Thu, 30 Oct 2008 15:13:14 +0100 (CET), Guennadi Liakhovetski wrote:
> > > Hi,
> > > 
> > > I have two i2c modules, one of which uses the other one: a camera and a 
> > > GPIO-extender, and the camera uses a GPIO from that extender. I first load 
> > > the GPIO-extender driver (pca953x.c), then the camera (mt9m001.c), then as 
> > > I tried to remove the bus driver (i2c-mxc, not yet in the mainline), first 
> > > the GPIO-extender's .remove() method has been called, which, of course, 
> > > failed, because mt9m001 was still holding its GPIO... AFAIU, the remove 
> > > order should be reverse from probe, right?
> > 
> > It would indeed make sense for the removal order to be the reverse of
> > the bind order. Can you please try the following patch and report if it
> > solves your problem?
> 
> Any news from this? I'd like to push this change to Linus this week if
> it actually solves your problem.

Sorry, I didn't forget, I just was postponing this test, until I get more 
time... I've tested it now - it does solve the problem, thanks!

Tested-by: Guennadi Liakhovetski <g.liakhovetski-Mmb7MZpHnFY@public.gmane.org>

Thanks
Guennadi

> 
> > From: Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>
> > Subject: i2c: Remove i2c clients in reverse order
> > 
> > i2c clients should be removed in reverse order compared to the probe
> > (actually: bind) order. This matters when several clients depend on
> > each other.
> > 
> > Signed-off-by: Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>
> > Cc: Guennadi Liakhovetski <g.liakhovetski-Mmb7MZpHnFY@public.gmane.org>
> > ---
> >  drivers/i2c/i2c-core.c |    2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > --- linux-2.6.28-rc5.orig/drivers/i2c/i2c-core.c	2008-11-17 21:29:59.000000000 +0100
> > +++ linux-2.6.28-rc5/drivers/i2c/i2c-core.c	2008-11-17 21:44:06.000000000 +0100
> > @@ -631,7 +631,7 @@ int i2c_del_adapter(struct i2c_adapter *
> >  
> >  	/* detach any active clients. This must be done first, because
> >  	 * it can fail; in which case we give up. */
> > -	list_for_each_entry_safe(client, _n, &adap->clients, list) {
> > +	list_for_each_entry_safe_reverse(client, _n, &adap->clients, list) {
> >  		struct i2c_driver	*driver;
> >  
> >  		driver = client->driver;
> 
> -- 
> Jean Delvare
> 

---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer

      parent reply	other threads:[~2008-11-25  9:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <Pine.LNX.4.64.0810301509380.5463@axis700.grange>
     [not found] ` <Pine.LNX.4.64.0810301509380.5463-0199iw4Nj15frtckUFj5Ag@public.gmane.org>
2008-11-17 21:04   ` wrong driver remove order Jean Delvare
     [not found]     ` <20081117220417.0d83443c-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2008-11-25  9:02       ` Jean Delvare
     [not found]         ` <20081125100256.7742e367-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2008-11-25  9:32           ` Guennadi Liakhovetski [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.64.0811251031010.6290@axis700.grange \
    --to=g.liakhovetski-mmb7mzphnfy@public.gmane.org \
    --cc=khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org \
    --cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox