summaryrefslogtreecommitdiffstats
path: root/drivers/leds/leds-ns2.c
diff options
context:
space:
mode:
authorJingoo Han <jg1.han@samsung.com>2012-10-23 14:18:21 +0200
committerBryan Wu <cooloney@gmail.com>2012-11-26 23:28:44 +0100
commit31c3dc7488f2564fc398d5a416726031f56d6343 (patch)
treee67014a35ca9960fb31bd6faf2f3703606eff30f /drivers/leds/leds-ns2.c
parentleds: leds-lt3593: use gpio_request_one (diff)
downloadlinux-31c3dc7488f2564fc398d5a416726031f56d6343.tar.xz
linux-31c3dc7488f2564fc398d5a416726031f56d6343.zip
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/leds-ns2.c')
-rw-r--r--drivers/leds/leds-ns2.c21
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,
int ret;
enum ns2_led_modes mode;
- ret = gpio_request(template->cmd, template->name);
- if (ret == 0) {
- ret = gpio_direction_output(template->cmd,
- gpio_get_value(template->cmd));
- if (ret)
- gpio_free(template->cmd);
- }
+ ret = gpio_request_one(template->cmd,
+ GPIOF_DIR_OUT | gpio_get_value(template->cmd),
+ template->name);
if (ret) {
dev_err(&pdev->dev, "%s: failed to setup command GPIO\n",
template->name);
+ return ret;
}
- ret = gpio_request(template->slow, template->name);
- if (ret == 0) {
- ret = gpio_direction_output(template->slow,
- gpio_get_value(template->slow));
- if (ret)
- gpio_free(template->slow);
- }
+ ret = gpio_request_one(template->slow,
+ GPIOF_DIR_OUT | gpio_get_value(template->slow),
+ template->name);
if (ret) {
dev_err(&pdev->dev, "%s: failed to setup slow GPIO\n",
template->name);