public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [RFC][PATCH 4/4] RTC: SMBus support for the M41T80,
@ 2008-05-07  8:20 David Brownell
       [not found] ` <200805070120.03821.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
  0 siblings, 1 reply; 25+ messages in thread
From: David Brownell @ 2008-05-07  8:20 UTC (permalink / raw)
  To: Maciej W. Rozycki
  Cc: i2c-GZX6beZjE8VD60Wz+7aTrA, rtc-linux-/JYPxA39Uh5TLH3MbocFFw

This patch is way too big for what it does.  Lots of whitespace
and similar noise (did those headers *need* rearranging?).


But most importantly, that driver already uses SMBus calls.
So you shouldn't *stop* it from using them by adding wrapper
code like this:

> +static int m41t80_write_byte_data(struct i2c_client *client, u8 reg, u8 val)
> +{ 
> +	if (i2c_check_functionality(client->adapter, I2C_FUNC_I2C))
> +		return m41t80_i2c_transfer(client, 1, reg, 1, &val);
> +	else
> +		return i2c_smbus_write_byte_data(client, reg, val);
> +}

That's because if an I2C controller can execute that protocol,
it can do so through the SMBus calls too.  And the current code
already verifies that will work ... those wrappers are pointless,
as well as untested.


The chip docs basically tell us that if the underlying SMBus
controller can issue i2c_smbus_read_i2c_block_data() and its
write-side sibling, it can *easily* talk to this chip.

So wouldn't it be a better idea to just replace the existing
calls to i2c_transfer() with those pseudo-SMBus block calls?

And then *separately* add workarounds for i2c-sibyte, and
similar controllers that don't offer block transfers?  Maybe
using your existing structure ... just not replacing those
existing perfectly-fine SMBus calls.

- Dave



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

^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2008-05-20  9:20 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-07  8:20 [RFC][PATCH 4/4] RTC: SMBus support for the M41T80, David Brownell
     [not found] ` <200805070120.03821.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2008-05-07 22:28   ` Maciej W. Rozycki
     [not found]     ` <Pine.LNX.4.55.0805072226180.25644-j8+e0ZhYU2SU0huXySazC6sMm+1xrEX8@public.gmane.org>
2008-05-07 23:25       ` David Brownell
     [not found]         ` <200805071625.20430.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2008-05-08  7:46           ` Jean Delvare
     [not found]             ` <20080508094620.5e6c973b-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2008-05-09  8:39               ` David Brownell
2008-05-09  0:43         ` Maciej W. Rozycki
2008-05-09  8:08           ` [i2c] " Jean Delvare
2008-05-09 20:55             ` Maciej W. Rozycki
2008-05-09 21:21               ` Jean Delvare
2008-05-10  2:21                 ` Maciej W. Rozycki
2008-05-10  6:53                   ` Jean Delvare
2008-05-10 16:36                     ` David Brownell
2008-05-20  9:20                       ` Jean Delvare
2008-05-09  9:18           ` David Brownell
2008-05-09 21:22             ` Maciej W. Rozycki
2008-05-10  7:08               ` Jean Delvare
2008-05-09 14:17           ` Atsushi Nemoto
2008-05-08  7:34       ` [RFC][PATCH 4/4] RTC: SMBus support for the M41T80 Jean Delvare
     [not found]         ` <20080508093456.340a42b0-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2008-05-09 19:18           ` Maciej W. Rozycki
     [not found]             ` <Pine.LNX.4.55.0805091917370.10552-j8+e0ZhYU2SU0huXySazC6sMm+1xrEX8@public.gmane.org>
2008-05-09 20:27               ` Jean Delvare
2008-05-10  1:35                 ` Maciej W. Rozycki
2008-05-10  8:35                   ` Jean Delvare
2008-05-11  1:59                     ` Maciej W. Rozycki
2008-05-11  7:40                       ` Jean Delvare
2008-05-12  2:45                       ` Atsushi Nemoto

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox