diff options
author | Jingoo Han <jg1.han@samsung.com> | 2012-10-23 08:18:21 -0400 |
---|---|---|
committer | Bryan Wu <cooloney@gmail.com> | 2012-11-26 17:28:44 -0500 |
commit | 31c3dc7488f2564fc398d5a416726031f56d6343 (patch) | |
tree | e67014a35ca9960fb31bd6faf2f3703606eff30f /drivers/leds | |
parent | 507d967bc1d103695440e27f888244e014bcf7be (diff) |
leds: leds-ns2: use gpio_request_one
Using gpio_request_one can make the code simpler because it can
set the direction and initial value in one shot.
Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
Diffstat (limited to 'drivers/leds')
-rw-r--r-- | drivers/leds/leds-ns2.c | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/drivers/leds/leds-ns2.c b/drivers/leds/leds-ns2.c index d176ec83f5d9..ae8f93b3364e 100644 --- a/drivers/leds/leds-ns2.c +++ b/drivers/leds/leds-ns2.c | |||
@@ -191,25 +191,18 @@ create_ns2_led(struct platform_device *pdev, struct ns2_led_data *led_dat, | |||
191 | int ret; | 191 | int ret; |
192 | enum ns2_led_modes mode; | 192 | enum ns2_led_modes mode; |
193 | 193 | ||
194 | ret = gpio_request(template->cmd, template->name); | 194 | ret = gpio_request_one(template->cmd, |
195 | if (ret == 0) { | 195 | GPIOF_DIR_OUT | gpio_get_value(template->cmd), |
196 | ret = gpio_direction_output(template->cmd, | 196 | template->name); |
197 | gpio_get_value(template->cmd)); | ||
198 | if (ret) | ||
199 | gpio_free(template->cmd); | ||
200 | } | ||
201 | if (ret) { | 197 | if (ret) { |
202 | dev_err(&pdev->dev, "%s: failed to setup command GPIO\n", | 198 | dev_err(&pdev->dev, "%s: failed to setup command GPIO\n", |
203 | template->name); | 199 | template->name); |
200 | return ret; | ||
204 | } | 201 | } |
205 | 202 | ||
206 | ret = gpio_request(template->slow, template->name); | 203 | ret = gpio_request_one(template->slow, |
207 | if (ret == 0) { | 204 | GPIOF_DIR_OUT | gpio_get_value(template->slow), |
208 | ret = gpio_direction_output(template->slow, | 205 | template->name); |
209 | gpio_get_value(template->slow)); | ||
210 | if (ret) | ||
211 | gpio_free(template->slow); | ||
212 | } | ||
213 | if (ret) { | 206 | if (ret) { |
214 | dev_err(&pdev->dev, "%s: failed to setup slow GPIO\n", | 207 | dev_err(&pdev->dev, "%s: failed to setup slow GPIO\n", |
215 | template->name); | 208 | template->name); |