Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 318299
b: refs/heads/master
c: 9638ab7
h: refs/heads/master
i:
  318297: 619d74d
  318295: e2b3c37
v: v3
  • Loading branch information
Daniel Kurtz authored and Henrik Rydberg committed Jun 29, 2012
1 parent 11b575d commit 725baac
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 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: 771733e348e3df5b6283ab3b97d28577452bf09f
refs/heads/master: 9638ab7c9c3b352d54f4f7e80027bd6e1c0584e8
23 changes: 18 additions & 5 deletions trunk/drivers/input/touchscreen/atmel_mxt_ts.c
Original file line number Diff line number Diff line change
Expand Up @@ -431,17 +431,24 @@ static int mxt_read_reg(struct i2c_client *client, u16 reg, u8 *val)
return __mxt_read_reg(client, reg, 1, val);
}

static int mxt_write_reg(struct i2c_client *client, u16 reg, u8 val)
static int __mxt_write_reg(struct i2c_client *client, u16 reg, u16 len,
const void *val)
{
u8 buf[3];
u8 *buf;
size_t count;
int ret;

count = len + 2;
buf = kmalloc(count, GFP_KERNEL);
if (!buf)
return -ENOMEM;

buf[0] = reg & 0xff;
buf[1] = (reg >> 8) & 0xff;
buf[2] = val;
memcpy(&buf[2], val, len);

ret = i2c_master_send(client, buf, 3);
if (ret == 3) {
ret = i2c_master_send(client, buf, count);
if (ret == count) {
ret = 0;
} else {
if (ret >= 0)
Expand All @@ -450,9 +457,15 @@ static int mxt_write_reg(struct i2c_client *client, u16 reg, u8 val)
__func__, ret);
}

kfree(buf);
return ret;
}

static int mxt_write_reg(struct i2c_client *client, u16 reg, u8 val)
{
return __mxt_write_reg(client, reg, 1, &val);
}

static int mxt_read_object_table(struct i2c_client *client,
u16 reg, u8 *object_buf)
{
Expand Down

0 comments on commit 725baac

Please sign in to comment.