All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>
To: Guennadi Liakhovetski <g.liakhovetski-Mmb7MZpHnFY@public.gmane.org>
Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [Q] i2c_new_device vs i2c_del_driver
Date: Tue, 17 Mar 2009 19:17:24 +0100	[thread overview]
Message-ID: <20090317191724.7ace956f@hyperion.delvare> (raw)
In-Reply-To: <Pine.LNX.4.64.0903171849060.5318-0199iw4Nj15frtckUFj5Ag@public.gmane.org>

On Tue, 17 Mar 2009 18:50:50 +0100 (CET), Guennadi Liakhovetski wrote:
> On Tue, 17 Mar 2009, Jean Delvare wrote:
> 
> > Hi Guennadi,
> > 
> > On Tue, 17 Mar 2009 18:24:49 +0100 (CET), Guennadi Liakhovetski wrote:
> > > I have a question regarding dynimically created i2c devices. If I have a 
> > > card with an i2c device on it. Once I load a driver for that card, it uses 
> > > its knowledge of the hardware and registers a new i2c device using 
> > > i2c_new_device. Then at some point a driver for that i2c device is loaded, 
> > > it calls i2c_add_driver, then its probe() method is called with the 
> > > dynamically created device. So far so good. Now I unload the i2c driver, 
> > > it calls i2c_del_driver(), and then, IIUC, __detach_adapter will be called 
> > > for all devices attached to this driver,
> > 
> > Actually,  __detach_adapter will be called for all *adapters* on the
> > system. Then in turn __detach_adapter does a number of actions on
> > devices present on said adapters.
> > 
> > > including our device from above, 
> > 
> > No. Your driver is a new-style one (otherwise you couldn't use
> > i2c_new_device) which means that __detach_adapter returns relatively
> > quickly. The only part of __detach_adapter which is run is the one
> > which removes auto-instantiated devices. This isn't the case of your
> > device (you instantiated it explicitly) so __detach_adapter is a no-op
> > for you.
> 
> Aha, so, the driver->clients list will not contain my device, and it won't 
> get unregistered. Ic.

Correct. Maybe I should have found a better name, like
driver->detected_clients, to make it clearer. Want me to change it
know? It should be straightforward.

-- 
Jean Delvare

  parent reply	other threads:[~2009-03-17 18:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-17 17:24 [Q] i2c_new_device vs i2c_del_driver Guennadi Liakhovetski
     [not found] ` <Pine.LNX.4.64.0903171710350.5318-0199iw4Nj15frtckUFj5Ag@public.gmane.org>
2009-03-17 17:38   ` Jean Delvare
     [not found]     ` <20090317183809.55320908-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2009-03-17 17:50       ` Guennadi Liakhovetski
     [not found]         ` <Pine.LNX.4.64.0903171849060.5318-0199iw4Nj15frtckUFj5Ag@public.gmane.org>
2009-03-17 18:17           ` Jean Delvare [this message]
     [not found]             ` <20090317191724.7ace956f-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2009-03-17 18:29               ` Guennadi Liakhovetski
     [not found]                 ` <Pine.LNX.4.64.0903171923230.5318-0199iw4Nj15frtckUFj5Ag@public.gmane.org>
2009-03-20 17:48                   ` Jean Delvare

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=20090317191724.7ace956f@hyperion.delvare \
    --to=khali-puyad+kwke1g9huczpvpmw@public.gmane.org \
    --cc=g.liakhovetski-Mmb7MZpHnFY@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.