diff options
Diffstat (limited to 'drivers/mfd')
-rw-r--r-- | drivers/mfd/twl4030-core.c | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/drivers/mfd/twl4030-core.c b/drivers/mfd/twl4030-core.c index e4a5d489b8e7..7c2ec0aa9d87 100644 --- a/drivers/mfd/twl4030-core.c +++ b/drivers/mfd/twl4030-core.c | |||
@@ -306,10 +306,17 @@ int twl4030_i2c_write(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes) | |||
306 | ret = i2c_transfer(twl->client->adapter, twl->xfer_msg, 1); | 306 | ret = i2c_transfer(twl->client->adapter, twl->xfer_msg, 1); |
307 | mutex_unlock(&twl->xfer_lock); | 307 | mutex_unlock(&twl->xfer_lock); |
308 | 308 | ||
309 | /* i2cTransfer returns num messages.translate it pls.. */ | 309 | /* i2c_transfer returns number of messages transferred */ |
310 | if (ret >= 0) | 310 | if (ret != 1) { |
311 | ret = 0; | 311 | pr_err("%s: i2c_write failed to transfer all messages\n", |
312 | return ret; | 312 | DRIVER_NAME); |
313 | if (ret < 0) | ||
314 | return ret; | ||
315 | else | ||
316 | return -EIO; | ||
317 | } else { | ||
318 | return 0; | ||
319 | } | ||
313 | } | 320 | } |
314 | EXPORT_SYMBOL(twl4030_i2c_write); | 321 | EXPORT_SYMBOL(twl4030_i2c_write); |
315 | 322 | ||
@@ -358,10 +365,17 @@ int twl4030_i2c_read(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes) | |||
358 | ret = i2c_transfer(twl->client->adapter, twl->xfer_msg, 2); | 365 | ret = i2c_transfer(twl->client->adapter, twl->xfer_msg, 2); |
359 | mutex_unlock(&twl->xfer_lock); | 366 | mutex_unlock(&twl->xfer_lock); |
360 | 367 | ||
361 | /* i2cTransfer returns num messages.translate it pls.. */ | 368 | /* i2c_transfer returns number of messages transferred */ |
362 | if (ret >= 0) | 369 | if (ret != 2) { |
363 | ret = 0; | 370 | pr_err("%s: i2c_read failed to transfer all messages\n", |
364 | return ret; | 371 | DRIVER_NAME); |
372 | if (ret < 0) | ||
373 | return ret; | ||
374 | else | ||
375 | return -EIO; | ||
376 | } else { | ||
377 | return 0; | ||
378 | } | ||
365 | } | 379 | } |
366 | EXPORT_SYMBOL(twl4030_i2c_read); | 380 | EXPORT_SYMBOL(twl4030_i2c_read); |
367 | 381 | ||