Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 242587
b: refs/heads/master
c: 9e912f4
h: refs/heads/master
i:
  242585: 6416bb6
  242583: 14148ea
v: v3
  • Loading branch information
Grazvydas Ignotas authored and Lars-Peter Clausen committed Feb 22, 2011
1 parent 4bfc399 commit 00325f9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 17 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: 2ec523a8238a117b082ca6b0cef3b9ae812364f9
refs/heads/master: 9e912f452931b3da9d13d716a381ba0d5fb74ced
27 changes: 11 additions & 16 deletions trunk/drivers/power/bq27x00_battery.c
Original file line number Diff line number Diff line change
Expand Up @@ -565,31 +565,26 @@ static DEFINE_MUTEX(battery_mutex);
static int bq27x00_read_i2c(struct bq27x00_device_info *di, u8 reg, bool single)
{
struct i2c_client *client = to_i2c_client(di->dev);
struct i2c_msg msg;
struct i2c_msg msg[2];
unsigned char data[2];
int ret;

if (!client->adapter)
return -ENODEV;

msg.addr = client->addr;
msg.flags = 0;
msg.len = 1;
msg.buf = data;

data[0] = reg;
ret = i2c_transfer(client->adapter, &msg, 1);

if (ret < 0)
return ret;

msg[0].addr = client->addr;
msg[0].flags = 0;
msg[0].buf = &reg;
msg[0].len = sizeof(reg);
msg[1].addr = client->addr;
msg[1].flags = I2C_M_RD;
msg[1].buf = data;
if (single)
msg.len = 1;
msg[1].len = 1;
else
msg.len = 2;
msg[1].len = 2;

msg.flags = I2C_M_RD;
ret = i2c_transfer(client->adapter, &msg, 1);
ret = i2c_transfer(client->adapter, msg, ARRAY_SIZE(msg));
if (ret < 0)
return ret;

Expand Down

0 comments on commit 00325f9

Please sign in to comment.