aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2008-02-06 04:38:41 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-06 13:41:13 -0500
commit037e291cc77a4beb0379a8c74e3d82e49a476b84 (patch)
treeda5ab620aab7dc37e2b27e28e333a8275bc7e9a1 /drivers
parent09b6bdb3b6a95fe270107c2831e033f9cb233d2d (diff)
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 <khali@linux-fr.org> Signed-off-by: Alessandro Zummo <a.zummo@towertech.it> Cc: David Brownell <david-b@pacbell.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/rtc/rtc-pcf8583.c24
1 files changed, 7 insertions, 17 deletions
diff --git a/drivers/rtc/rtc-pcf8583.c b/drivers/rtc/rtc-pcf8583.c
index c973ba94c422..8b3997007506 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)
163 163
164static int pcf8583_write_mem(struct i2c_client *client, struct rtc_mem *mem) 164static int pcf8583_write_mem(struct i2c_client *client, struct rtc_mem *mem)
165{ 165{
166 unsigned char addr[1]; 166 unsigned char buf[9];
167 struct i2c_msg msgs[2] = { 167 int ret;
168 {
169 .addr = client->addr,
170 .flags = 0,
171 .len = 1,
172 .buf = addr,
173 }, {
174 .addr = client->addr,
175 .flags = I2C_M_NOSTART,
176 .len = mem->nr,
177 .buf = mem->data,
178 }
179 };
180 168
181 if (mem->loc < 8) 169 if (mem->loc < 8 || mem->nr > 8)
182 return -EINVAL; 170 return -EINVAL;
183 171
184 addr[0] = mem->loc; 172 buf[0] = mem->loc;
173 memcpy(buf + 1, mem->data, mem->nr);
185 174
186 return i2c_transfer(client->adapter, msgs, 2) == 2 ? 0 : -EIO; 175 ret = i2c_master_send(client, buf, mem->nr + 1);
176 return ret == mem->nr + 1 ? 0 : -EIO;
187} 177}
188 178
189static int pcf8583_rtc_read_time(struct device *dev, struct rtc_time *tm) 179static int pcf8583_rtc_read_time(struct device *dev, struct rtc_time *tm)