Commit e77a20e8 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'for-linus' of git://git.o-hand.com/linux-mfd

* 'for-linus' of git://git.o-hand.com/linux-mfd:
  mfd: Correct WM8350 I2C return code usage
  mfd: fix event masking for da9030
parents 9753b127 898d8054
...@@ -267,7 +267,7 @@ static int da9030_mask_events(struct da903x_chip *chip, unsigned int events) ...@@ -267,7 +267,7 @@ static int da9030_mask_events(struct da903x_chip *chip, unsigned int events)
{ {
uint8_t v[3]; uint8_t v[3];
chip->events_mask &= ~events; chip->events_mask |= events;
v[0] = (chip->events_mask & 0xff); v[0] = (chip->events_mask & 0xff);
v[1] = (chip->events_mask >> 8) & 0xff; v[1] = (chip->events_mask >> 8) & 0xff;
......
...@@ -30,7 +30,12 @@ static int wm8350_i2c_read_device(struct wm8350 *wm8350, char reg, ...@@ -30,7 +30,12 @@ static int wm8350_i2c_read_device(struct wm8350 *wm8350, char reg,
ret = i2c_master_send(wm8350->i2c_client, &reg, 1); ret = i2c_master_send(wm8350->i2c_client, &reg, 1);
if (ret < 0) if (ret < 0)
return ret; return ret;
return i2c_master_recv(wm8350->i2c_client, dest, bytes); ret = i2c_master_recv(wm8350->i2c_client, dest, bytes);
if (ret < 0)
return ret;
if (ret != bytes)
return -EIO;
return 0;
} }
static int wm8350_i2c_write_device(struct wm8350 *wm8350, char reg, static int wm8350_i2c_write_device(struct wm8350 *wm8350, char reg,
...@@ -38,13 +43,19 @@ static int wm8350_i2c_write_device(struct wm8350 *wm8350, char reg, ...@@ -38,13 +43,19 @@ static int wm8350_i2c_write_device(struct wm8350 *wm8350, char reg,
{ {
/* we add 1 byte for device register */ /* we add 1 byte for device register */
u8 msg[(WM8350_MAX_REGISTER << 1) + 1]; u8 msg[(WM8350_MAX_REGISTER << 1) + 1];
int ret;
if (bytes > ((WM8350_MAX_REGISTER << 1) + 1)) if (bytes > ((WM8350_MAX_REGISTER << 1) + 1))
return -EINVAL; return -EINVAL;
msg[0] = reg; msg[0] = reg;
memcpy(&msg[1], src, bytes); memcpy(&msg[1], src, bytes);
return i2c_master_send(wm8350->i2c_client, msg, bytes + 1); ret = i2c_master_send(wm8350->i2c_client, msg, bytes + 1);
if (ret < 0)
return ret;
if (ret != bytes + 1)
return -EIO;
return 0;
} }
static int wm8350_i2c_probe(struct i2c_client *i2c, static int wm8350_i2c_probe(struct i2c_client *i2c,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment