Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 318298
b: refs/heads/master
c: 771733e
h: refs/heads/master
v: v3
  • Loading branch information
Daniel Kurtz authored and Henrik Rydberg committed Jun 29, 2012
1 parent 619d74d commit 11b575d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 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: 794eb67e76118108af5280ace2be8ae4983a6a81
refs/heads/master: 771733e348e3df5b6283ab3b97d28577452bf09f
28 changes: 20 additions & 8 deletions trunk/drivers/input/touchscreen/atmel_mxt_ts.c
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,7 @@ static int __mxt_read_reg(struct i2c_client *client,
{
struct i2c_msg xfer[2];
u8 buf[2];
int ret;

buf[0] = reg & 0xff;
buf[1] = (reg >> 8) & 0xff;
Expand All @@ -412,12 +413,17 @@ static int __mxt_read_reg(struct i2c_client *client,
xfer[1].len = len;
xfer[1].buf = val;

if (i2c_transfer(client->adapter, xfer, 2) != 2) {
dev_err(&client->dev, "%s: i2c transfer failed\n", __func__);
return -EIO;
ret = i2c_transfer(client->adapter, xfer, 2);
if (ret == 2) {
ret = 0;
} else {
if (ret >= 0)
ret = -EIO;
dev_err(&client->dev, "%s: i2c transfer failed (%d)\n",
__func__, ret);
}

return 0;
return ret;
}

static int mxt_read_reg(struct i2c_client *client, u16 reg, u8 *val)
Expand All @@ -428,17 +434,23 @@ static int mxt_read_reg(struct i2c_client *client, u16 reg, u8 *val)
static int mxt_write_reg(struct i2c_client *client, u16 reg, u8 val)
{
u8 buf[3];
int ret;

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

if (i2c_master_send(client, buf, 3) != 3) {
dev_err(&client->dev, "%s: i2c send failed\n", __func__);
return -EIO;
ret = i2c_master_send(client, buf, 3);
if (ret == 3) {
ret = 0;
} else {
if (ret >= 0)
ret = -EIO;
dev_err(&client->dev, "%s: i2c send failed (%d)\n",
__func__, ret);
}

return 0;
return ret;
}

static int mxt_read_object_table(struct i2c_client *client,
Expand Down

0 comments on commit 11b575d

Please sign in to comment.