diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-12-15 12:52:42 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-12-15 12:52:42 -0800 |
commit | e81d372ff9f694e13fa46e8b5aaed505c7fd2a1f (patch) | |
tree | 058d5004b6ca7602aaec6ef2d992be9c71a8e81c /drivers/leds/leds-ns2.c | |
parent | 75e300c8ba5864367634d946c729d8fd05c1cbc2 (diff) | |
parent | 2f05e1d4458f9cb68d4d36fb47e6830fec03c80e (diff) | |
download | linux-e81d372ff9f694e13fa46e8b5aaed505c7fd2a1f.tar.bz2 |
Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/cooloney/linux-leds
Pull LED subsystem update from Bryan Wu.
* 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/cooloney/linux-leds: (47 commits)
leds: leds-lp5521: return an error code on error in probe()
leds: leds-clevo-mail: Use pr_* instead of printks
leds: leds-rb532: Fix checkpatch errors
leds: led-triggers: Fix checkpatch warnings
leds: ledtrig-backlight: Fix checkpatch error
leds: leds-wrap: Use <linux/io.h> instead of <asm/io.h>
leds: leds-wm8350: Use dev_err instead of printk
leds: leds-pwm: Fix checkpatch warning
leds: leds-pca955x: Use dev_info instead of printk
leds: leds-net48xx: Use linux/io.h instead of asm/io.h
leds: leds-lt3593: Fix checkpatch warnings
leds: leds-gpio: Use dev_info instead of printk
leds: leds-da903x: Fix checkpatch error and warnings
leds: leds-bd2802: Fix checkpatch warnings
leds: leds-adp5520: Fix checkpatch warnings
leds: led-class: Fix checkpatch warning
leds: leds-ns2: use devm_gpio_request_one
leds: leds-lt3593: use devm_gpio_request_one
leds: leds-gpio: use devm_gpio_request_one
leds: lp3944: Fix return value
...
Diffstat (limited to 'drivers/leds/leds-ns2.c')
-rw-r--r-- | drivers/leds/leds-ns2.c | 36 |
1 files changed, 11 insertions, 25 deletions
diff --git a/drivers/leds/leds-ns2.c b/drivers/leds/leds-ns2.c index 7b75affb308a..d978171c25b4 100644 --- a/drivers/leds/leds-ns2.c +++ b/drivers/leds/leds-ns2.c @@ -150,7 +150,7 @@ static ssize_t ns2_led_sata_store(struct device *dev, unsigned long enable; enum ns2_led_modes mode; - ret = strict_strtoul(buff, 10, &enable); + ret = kstrtoul(buff, 10, &enable); if (ret < 0) return ret; @@ -192,29 +192,22 @@ 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 = devm_gpio_request_one(&pdev->dev, 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 = devm_gpio_request_one(&pdev->dev, 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); - goto err_free_cmd; + return ret; } rwlock_init(&led_dat->rw_lock); @@ -229,7 +222,7 @@ create_ns2_led(struct platform_device *pdev, struct ns2_led_data *led_dat, ret = ns2_led_get_mode(led_dat, &mode); if (ret < 0) - goto err_free_slow; + return ret; /* Set LED initial state. */ led_dat->sata = (mode == NS_V2_LED_SATA) ? 1 : 0; @@ -238,7 +231,7 @@ create_ns2_led(struct platform_device *pdev, struct ns2_led_data *led_dat, ret = led_classdev_register(&pdev->dev, &led_dat->cdev); if (ret < 0) - goto err_free_slow; + return ret; ret = device_create_file(led_dat->cdev.dev, &dev_attr_sata); if (ret < 0) @@ -248,11 +241,6 @@ create_ns2_led(struct platform_device *pdev, struct ns2_led_data *led_dat, err_free_cdev: led_classdev_unregister(&led_dat->cdev); -err_free_slow: - gpio_free(led_dat->slow); -err_free_cmd: - gpio_free(led_dat->cmd); - return ret; } @@ -260,8 +248,6 @@ static void delete_ns2_led(struct ns2_led_data *led_dat) { device_remove_file(led_dat->cdev.dev, &dev_attr_sata); led_classdev_unregister(&led_dat->cdev); - gpio_free(led_dat->cmd); - gpio_free(led_dat->slow); } #ifdef CONFIG_OF_GPIO |