lkml.org 
[lkml]   [2010]   [Jan]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [rtc-linux] [PATCH] rtc: rtc-max6900: SMBus support.
On Thu, 14 Jan 2010 20:32:35 +0900
Paul Mundt <lethal@linux-sh.org> wrote:

> The current rtc-max6900 driver only supports getting and setting the time
> through bursting, which requires a controller capable of such. As
> bursting is merely an optimization, we can also opt for the non-burst
> fallback path that pokes at the date/time registers individually.

almost ok, review below.


> -static int max6900_i2c_read_regs(struct i2c_client *client, u8 *buf)
> +static unsigned int smbus_mode; /* disabled by default, prefer bursting */

that one should be per-device.

> +static int max6900_i2c_smbus_read(struct i2c_client *client, u8 *buf)
> +{
> + int rc = 0, i;

no need to init rc

> +static int max6900_i2c_smbus_write(struct i2c_client *client, u8 const *buf)
> +{
> + int rc = 0, i;
> +
> + for (i = 0; i < MAX6900_REG_LEN; i++)
> + rc |= i2c_smbus_write_byte_data(client,
> + MAX6900_REG_WRITE(i), buf[i]);

please check rc at each write.

you might want to check if you'll have troubles if you read/write
when the minutes are changing.

you might also want to investigate block SMbus messages.

--

Best regards,

Alessandro Zummo,
Tower Technologies - Torino, Italy

http://www.towertech.it



\
 
 \ /
  Last update: 2010-01-15 16:39    [W:0.038 / U:2.996 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site