lkml.org 
[lkml]   [2012]   [Dec]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 29/33] leds-lp5521: recovers previous driver patch for return value
Date

During the cleanup, Dan Carpenter's patch was removed.
This patch recovers his patch based on the latest lp5521 driver.

[PATCH] leds: leds-lp5521: return an error code on error in probe()
If "buf" wasn't equal to LP5521_REG_R_CURR_DEFAULT the probe fails but
we still return zero. I've changed it to print an error message and
return -EINVAL.

Cc: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
---
drivers/leds/leds-lp5521.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/leds/leds-lp5521.c b/drivers/leds/leds-lp5521.c
index 23d0bee..9de5aec 100644
--- a/drivers/leds/leds-lp5521.c
+++ b/drivers/leds/leds-lp5521.c
@@ -278,11 +278,18 @@ static int lp5521_post_init_device(struct lp55xx_chip *chip)
* LP5521_REG_ENABLE register will not have any effect - strange!
*/
ret = lp55xx_read(chip, LP5521_REG_R_CURRENT, &val);
- if (ret || val != LP5521_REG_R_CURR_DEFAULT) {
+ if (ret) {
dev_err(&chip->cl->dev, "error in resetting chip\n");
return ret;
}

+ if (val != LP5521_REG_R_CURR_DEFAULT) {
+ dev_err(&chip->cl->dev,
+ "unexpected data in register (expected 0x%x got 0x%x)\n",
+ LP5521_REG_R_CURR_DEFAULT, val);
+ return -EINVAL;
+ }
+
usleep_range(10000, 20000);

/* Set all PWMs to direct control mode */
--
1.7.9.5

Best Regards,
Milo




\
 
 \ /
  Last update: 2012-12-12 15:41    [W:0.029 / U:0.388 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site