summaryrefslogtreecommitdiff
path: root/drivers/leds/leds-lt3593.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-12-16 00:52:42 +0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-12-16 00:52:42 +0400
commite81d372ff9f694e13fa46e8b5aaed505c7fd2a1f (patch)
tree058d5004b6ca7602aaec6ef2d992be9c71a8e81c /drivers/leds/leds-lt3593.c
parent75e300c8ba5864367634d946c729d8fd05c1cbc2 (diff)
parent2f05e1d4458f9cb68d4d36fb47e6830fec03c80e (diff)
downloadlinux-e81d372ff9f694e13fa46e8b5aaed505c7fd2a1f.tar.xz
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-lt3593.c')
-rw-r--r--drivers/leds/leds-lt3593.c20
1 files changed, 6 insertions, 14 deletions
diff --git a/drivers/leds/leds-lt3593.c b/drivers/leds/leds-lt3593.c
index 34b3ba4376fc..c9b9e1fec587 100644
--- a/drivers/leds/leds-lt3593.c
+++ b/drivers/leds/leds-lt3593.c
@@ -89,15 +89,11 @@ static int create_lt3593_led(const struct gpio_led *template,
/* skip leds on GPIOs that aren't available */
if (!gpio_is_valid(template->gpio)) {
- printk(KERN_INFO "%s: skipping unavailable LT3593 LED at gpio %d (%s)\n",
+ dev_info(parent, "%s: skipping unavailable LT3593 LED at gpio %d (%s)\n",
KBUILD_MODNAME, template->gpio, template->name);
return 0;
}
- ret = gpio_request(template->gpio, template->name);
- if (ret < 0)
- return ret;
-
led_dat->cdev.name = template->name;
led_dat->cdev.default_trigger = template->default_trigger;
led_dat->gpio = template->gpio;
@@ -110,24 +106,21 @@ static int create_lt3593_led(const struct gpio_led *template,
if (!template->retain_state_suspended)
led_dat->cdev.flags |= LED_CORE_SUSPENDRESUME;
- ret = gpio_direction_output(led_dat->gpio, state);
+ ret = devm_gpio_request_one(parent, template->gpio,
+ GPIOF_DIR_OUT | state, template->name);
if (ret < 0)
- goto err;
+ return ret;
INIT_WORK(&led_dat->work, lt3593_led_work);
ret = led_classdev_register(parent, &led_dat->cdev);
if (ret < 0)
- goto err;
+ return ret;
- printk(KERN_INFO "%s: registered LT3593 LED '%s' at GPIO %d\n",
+ dev_info(parent, "%s: registered LT3593 LED '%s' at GPIO %d\n",
KBUILD_MODNAME, template->name, template->gpio);
return 0;
-
-err:
- gpio_free(led_dat->gpio);
- return ret;
}
static void delete_lt3593_led(struct lt3593_led_data *led)
@@ -137,7 +130,6 @@ static void delete_lt3593_led(struct lt3593_led_data *led)
led_classdev_unregister(&led->cdev);
cancel_work_sync(&led->work);
- gpio_free(led->gpio);
}
static int lt3593_led_probe(struct platform_device *pdev)