public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
From: David Brownell <david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
To: Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>
Cc: Linux I2C <i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org>
Subject: Re: [PATCH] i2c: Call client_unregister for new-style devices too
Date: Mon, 14 Jul 2008 10:02:34 -0700	[thread overview]
Message-ID: <200807141002.34600.david-b@pacbell.net> (raw)
In-Reply-To: <20080714115613.3d5f608d-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>

On Monday 14 July 2008, Jean Delvare wrote:
> We call adapter->client_register for both legacy and new-style i2c
> devices, however we only call adapter->client_unregister for legacy
> drivers. This doesn't make much sense. Usually, drivers will undo
> in client_unregister what they did in client_register, so we should
> call neither or both for every given i2c device.
> 
> In order to ease the transition from legacy to new-style devices, it
> seems preferable to actually call both.
> 
> Signed-off-by: Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>
> Cc: David Brownell <david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
> ---
> David, is this OK with you?

The symmetry point is good; client_unregister() is only
called (for now) in i2c_detach_client() -- a legacy-only
procedure, which I guess is mandatory for legacy drivers
to call at various points.

Did you consider moving the call into i2c_device_remove()
instead?  That'd simplify things by minimizing call sites,
and would ensure that no code path could skip the call.
(The list_del calls could move there too...)

It seems that all users of these adapater callbacks are
in the drivers/media/video subtree, which has an atypical
model for adapters.  A more general notion for this kind
of notification might be useful to non-video adapters,
like a notifier scheme that's usable by third parties.

- Dave

_______________________________________________
i2c mailing list
i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
http://lists.lm-sensors.org/mailman/listinfo/i2c

  parent reply	other threads:[~2008-07-14 17:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-14  9:56 [PATCH] i2c: Call client_unregister for new-style devices too Jean Delvare
     [not found] ` <20080714115613.3d5f608d-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2008-07-14 17:02   ` David Brownell [this message]
     [not found]     ` <200807141002.34600.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2008-07-14 19:15       ` 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=200807141002.34600.david-b@pacbell.net \
    --to=david-b-ybekhbn/0ldr7s880joybq@public.gmane.org \
    --cc=i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org \
    --cc=khali-PUYAD+kWke1g9hUCZPvPmw@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