Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 83525
b: refs/heads/master
c: 037e291
h: refs/heads/master
i:
  83523: 5591dfd
v: v3
  • Loading branch information
Jean Delvare authored and Linus Torvalds committed Feb 6, 2008
1 parent 1d4c5dc commit 3d33568
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 18 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 09b6bdb3b6a95fe270107c2831e033f9cb233d2d
refs/heads/master: 037e291cc77a4beb0379a8c74e3d82e49a476b84
24 changes: 7 additions & 17 deletions trunk/drivers/rtc/rtc-pcf8583.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 3d33568

Please sign in to comment.