Re: [rtc-linux] [PATCH] rtc: rtc-max6900: SMBus support.

From: Alessandro Zummo
Date: Fri Jan 15 2010 - 10:37:26 EST


On Thu, 14 Jan 2010 20:32:35 +0900
Paul Mundt <lethal@xxxxxxxxxxxx> 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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/