Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=037e291cc77a4beb0379a8c74e3d82e49a476b84 Commit: 037e291cc77a4beb0379a8c74e3d82e49a476b84 Parent: 09b6bdb3b6a95fe270107c2831e033f9cb233d2d Author: Jean Delvare <[EMAIL PROTECTED]> AuthorDate: Wed Feb 6 01:38:41 2008 -0800 Committer: Linus Torvalds <[EMAIL PROTECTED]> CommitDate: Wed Feb 6 10:41:13 2008 -0800
rtc-pcf8583: Don't abuse I2C_M_NOSTART The rtc-pcf8583 driver is using the I2C_M_NOSTART flag but shouldn't. This flag is only meant for broken chips and the PCF8583 RTC chip is not one of these. Signed-off-by: Jean Delvare <[EMAIL PROTECTED]> Signed-off-by: Alessandro Zummo <[EMAIL PROTECTED]> Cc: David Brownell <[EMAIL PROTECTED]> Signed-off-by: Andrew Morton <[EMAIL PROTECTED]> Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]> --- drivers/rtc/rtc-pcf8583.c | 24 +++++++----------------- 1 files changed, 7 insertions(+), 17 deletions(-) diff --git a/drivers/rtc/rtc-pcf8583.c b/drivers/rtc/rtc-pcf8583.c index c973ba9..8b39970 100644 --- a/drivers/rtc/rtc-pcf8583.c +++ b/drivers/rtc/rtc-pcf8583.c @@ -163,27 +163,17 @@ static int pcf8583_read_mem(struct i2c_client *client, struct rtc_mem *mem) static int pcf8583_write_mem(struct i2c_client *client, struct rtc_mem *mem) { - unsigned char addr[1]; - struct i2c_msg msgs[2] = { - { - .addr = client->addr, - .flags = 0, - .len = 1, - .buf = addr, - }, { - .addr = client->addr, - .flags = I2C_M_NOSTART, - .len = mem->nr, - .buf = mem->data, - } - }; + unsigned char buf[9]; + int ret; - if (mem->loc < 8) + if (mem->loc < 8 || mem->nr > 8) return -EINVAL; - addr[0] = mem->loc; + buf[0] = mem->loc; + memcpy(buf + 1, mem->data, mem->nr); - return i2c_transfer(client->adapter, msgs, 2) == 2 ? 0 : -EIO; + ret = i2c_master_send(client, buf, mem->nr + 1); + return ret == mem->nr + 1 ? 0 : -EIO; } static int pcf8583_rtc_read_time(struct device *dev, struct rtc_time *tm) - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html