diff options
author | Axel Lin <axel.lin@ingics.com> | 2012-09-22 02:40:14 -0400 |
---|---|---|
committer | Bryan Wu <bryan.wu@canonical.com> | 2012-09-24 00:24:22 -0400 |
commit | e76a322af16ba7be9b303239352e140209bf3822 (patch) | |
tree | 1d811be54daa4c11b196fea6f9b8457318cd9e29 /drivers/leds | |
parent | 8b7cfbec052d3a0b8e8c7de24a6b5f00d340e193 (diff) |
leds: lm3642: Use regmap_update_bits() in lm3642_chip_init()
Use regmap_update_bits() to replace regmap_read() + regmap_write().
With this patch, we only show the error message when regmap_update_bits()
fails.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: G.Shark Jeong<gshark.jeong@gmail.com>
Signed-off-by: Bryan Wu <bryan.wu@canonical.com>
Diffstat (limited to 'drivers/leds')
-rw-r--r-- | drivers/leds/leds-lm3642.c | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/drivers/leds/leds-lm3642.c b/drivers/leds/leds-lm3642.c index 924853b7922c..3285006e9888 100644 --- a/drivers/leds/leds-lm3642.c +++ b/drivers/leds/leds-lm3642.c | |||
@@ -95,23 +95,14 @@ struct lm3642_chip_data { | |||
95 | /* chip initialize */ | 95 | /* chip initialize */ |
96 | static int __devinit lm3642_chip_init(struct lm3642_chip_data *chip) | 96 | static int __devinit lm3642_chip_init(struct lm3642_chip_data *chip) |
97 | { | 97 | { |
98 | unsigned int reg_val; | ||
99 | int ret; | 98 | int ret; |
100 | struct lm3642_platform_data *pdata = chip->pdata; | 99 | struct lm3642_platform_data *pdata = chip->pdata; |
101 | 100 | ||
102 | /* set enable register */ | 101 | /* set enable register */ |
103 | ret = regmap_read(chip->regmap, REG_ENABLE, ®_val); | 102 | ret = regmap_update_bits(chip->regmap, REG_ENABLE, EX_PIN_ENABLE_MASK, |
103 | pdata->tx_pin); | ||
104 | if (ret < 0) | 104 | if (ret < 0) |
105 | goto out; | 105 | dev_err(chip->dev, "Failed to update REG_ENABLE Register\n"); |
106 | |||
107 | reg_val &= (~EX_PIN_ENABLE_MASK); | ||
108 | reg_val |= pdata->tx_pin; | ||
109 | ret = regmap_write(chip->regmap, REG_ENABLE, reg_val); | ||
110 | if (ret < 0) | ||
111 | goto out; | ||
112 | |||
113 | out: | ||
114 | dev_err(chip->dev, "Failed to read REG_ENABLE Register\n"); | ||
115 | return ret; | 106 | return ret; |
116 | } | 107 | } |
117 | 108 | ||