aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/leds
diff options
context:
space:
mode:
authorSachin Kamat <sachin.kamat@linaro.org>2012-11-24 23:44:27 -0500
committerBryan Wu <cooloney@gmail.com>2012-11-27 17:49:24 -0500
commit95a8ff835674e1156c0640f83829773f8bfe655a (patch)
treea531694c0a331162d1fc43907f4f308e6d2bd8a4 /drivers/leds
parente3b1d44c3550e5badfa5b78ffec80e15d7d9b287 (diff)
leds: leds-lt3593: use devm_gpio_request_one
devm_gpio_request_one is device managed and makes error handling and cleanup simpler. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Acked-by: Daniel Mack <daniel@caiaq.de> Signed-off-by: Bryan Wu <cooloney@gmail.com>
Diffstat (limited to 'drivers/leds')
-rw-r--r--drivers/leds/leds-lt3593.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/drivers/leds/leds-lt3593.c b/drivers/leds/leds-lt3593.c
index 17b710c63995..5ee6b8b7e4d3 100644
--- a/drivers/leds/leds-lt3593.c
+++ b/drivers/leds/leds-lt3593.c
@@ -106,8 +106,8 @@ static int __devinit create_lt3593_led(const struct gpio_led *template,
106 if (!template->retain_state_suspended) 106 if (!template->retain_state_suspended)
107 led_dat->cdev.flags |= LED_CORE_SUSPENDRESUME; 107 led_dat->cdev.flags |= LED_CORE_SUSPENDRESUME;
108 108
109 ret = gpio_request_one(template->gpio, GPIOF_DIR_OUT | state, 109 ret = devm_gpio_request_one(parent, template->gpio,
110 template->name); 110 GPIOF_DIR_OUT | state, template->name);
111 if (ret < 0) 111 if (ret < 0)
112 return ret; 112 return ret;
113 113
@@ -115,16 +115,12 @@ static int __devinit create_lt3593_led(const struct gpio_led *template,
115 115
116 ret = led_classdev_register(parent, &led_dat->cdev); 116 ret = led_classdev_register(parent, &led_dat->cdev);
117 if (ret < 0) 117 if (ret < 0)
118 goto err; 118 return ret;
119 119
120 printk(KERN_INFO "%s: registered LT3593 LED '%s' at GPIO %d\n", 120 printk(KERN_INFO "%s: registered LT3593 LED '%s' at GPIO %d\n",
121 KBUILD_MODNAME, template->name, template->gpio); 121 KBUILD_MODNAME, template->name, template->gpio);
122 122
123 return 0; 123 return 0;
124
125err:
126 gpio_free(led_dat->gpio);
127 return ret;
128} 124}
129 125
130static void delete_lt3593_led(struct lt3593_led_data *led) 126static void delete_lt3593_led(struct lt3593_led_data *led)
@@ -134,7 +130,6 @@ static void delete_lt3593_led(struct lt3593_led_data *led)
134 130
135 led_classdev_unregister(&led->cdev); 131 led_classdev_unregister(&led->cdev);
136 cancel_work_sync(&led->work); 132 cancel_work_sync(&led->work);
137 gpio_free(led->gpio);
138} 133}
139 134
140static int __devinit lt3593_led_probe(struct platform_device *pdev) 135static int __devinit lt3593_led_probe(struct platform_device *pdev)