aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-11-17 13:45:39 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2008-11-17 13:45:39 -0500
commite77a20e8ef6784586cfd66f4346af88ddb11173f (patch)
treed06fdebc42495d670d84fdb30d0e721ceb371617
parent9753b12767a7d3d2f2d36850ce5aaae59afbd685 (diff)
parent898d8054ec0cb5ba0ec1b15c78042a23ed103c02 (diff)
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
-rw-r--r--drivers/mfd/da903x.c2
-rw-r--r--drivers/mfd/wm8350-i2c.c15
2 files changed, 14 insertions, 3 deletions
diff --git a/drivers/mfd/da903x.c b/drivers/mfd/da903x.c
index b57326ae464d..0b5bd85dfcec 100644
--- a/drivers/mfd/da903x.c
+++ b/drivers/mfd/da903x.c
@@ -267,7 +267,7 @@ static int da9030_mask_events(struct da903x_chip *chip, unsigned int events)
267{ 267{
268 uint8_t v[3]; 268 uint8_t v[3];
269 269
270 chip->events_mask &= ~events; 270 chip->events_mask |= events;
271 271
272 v[0] = (chip->events_mask & 0xff); 272 v[0] = (chip->events_mask & 0xff);
273 v[1] = (chip->events_mask >> 8) & 0xff; 273 v[1] = (chip->events_mask >> 8) & 0xff;
diff --git a/drivers/mfd/wm8350-i2c.c b/drivers/mfd/wm8350-i2c.c
index 8dfe21bb3bd1..3e0ce0e50ea2 100644
--- a/drivers/mfd/wm8350-i2c.c
+++ b/drivers/mfd/wm8350-i2c.c
@@ -30,7 +30,12 @@ static int wm8350_i2c_read_device(struct wm8350 *wm8350, char reg,
30 ret = i2c_master_send(wm8350->i2c_client, &reg, 1); 30 ret = i2c_master_send(wm8350->i2c_client, &reg, 1);
31 if (ret < 0) 31 if (ret < 0)
32 return ret; 32 return ret;
33 return i2c_master_recv(wm8350->i2c_client, dest, bytes); 33 ret = i2c_master_recv(wm8350->i2c_client, dest, bytes);
34 if (ret < 0)
35 return ret;
36 if (ret != bytes)
37 return -EIO;
38 return 0;
34} 39}
35 40
36static int wm8350_i2c_write_device(struct wm8350 *wm8350, char reg, 41static 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{ 43{
39 /* we add 1 byte for device register */ 44 /* we add 1 byte for device register */
40 u8 msg[(WM8350_MAX_REGISTER << 1) + 1]; 45 u8 msg[(WM8350_MAX_REGISTER << 1) + 1];
46 int ret;
41 47
42 if (bytes > ((WM8350_MAX_REGISTER << 1) + 1)) 48 if (bytes > ((WM8350_MAX_REGISTER << 1) + 1))
43 return -EINVAL; 49 return -EINVAL;
44 50
45 msg[0] = reg; 51 msg[0] = reg;
46 memcpy(&msg[1], src, bytes); 52 memcpy(&msg[1], src, bytes);
47 return i2c_master_send(wm8350->i2c_client, msg, bytes + 1); 53 ret = i2c_master_send(wm8350->i2c_client, msg, bytes + 1);
54 if (ret < 0)
55 return ret;
56 if (ret != bytes + 1)
57 return -EIO;
58 return 0;
48} 59}
49 60
50static int wm8350_i2c_probe(struct i2c_client *i2c, 61static int wm8350_i2c_probe(struct i2c_client *i2c,