[i2c] [PATCH] i2c: Call client_unregister for new-style devices too
David Brownell
david-b at pacbell.net
Mon Jul 14 19:02:34 CEST 2008
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 at linux-fr.org>
> Cc: David Brownell <david-b at pacbell.net>
> ---
> 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
More information about the i2c
mailing list