diff options
author | Jingoo Han <jg1.han@samsung.com> | 2012-07-30 17:40:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-07-30 20:25:15 -0400 |
commit | 5f9dd5c9fd4efacc9f8c36c0b3c17a4308bbe4d9 (patch) | |
tree | 1032167c60a4cc9c9465944db3e252ba7c29a13e /drivers/video | |
parent | b4a74615a4729ca4e6903bd3027339c4e6e7ae03 (diff) |
backlight: atmel-pwm-bl: use devm_gpio_request()
The devm_ functions allocate memory that is released when a driver
detaches. This patch uses devm_gpio_request() for these functions.
Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Cc: Hans-Christian Egtvedt <egtvedt@samfundet.no>
Cc: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/video')
-rw-r--r-- | drivers/video/backlight/atmel-pwm-bl.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/drivers/video/backlight/atmel-pwm-bl.c b/drivers/video/backlight/atmel-pwm-bl.c index cd64073d3f53..df1cbb7ef6ca 100644 --- a/drivers/video/backlight/atmel-pwm-bl.c +++ b/drivers/video/backlight/atmel-pwm-bl.c | |||
@@ -155,7 +155,8 @@ static int atmel_pwm_bl_probe(struct platform_device *pdev) | |||
155 | goto err_free_mem; | 155 | goto err_free_mem; |
156 | 156 | ||
157 | if (pwmbl->gpio_on != -1) { | 157 | if (pwmbl->gpio_on != -1) { |
158 | retval = gpio_request(pwmbl->gpio_on, "gpio_atmel_pwm_bl"); | 158 | retval = devm_gpio_request(&pdev->dev, pwmbl->gpio_on, |
159 | "gpio_atmel_pwm_bl"); | ||
159 | if (retval) { | 160 | if (retval) { |
160 | pwmbl->gpio_on = -1; | 161 | pwmbl->gpio_on = -1; |
161 | goto err_free_pwm; | 162 | goto err_free_pwm; |
@@ -165,7 +166,7 @@ static int atmel_pwm_bl_probe(struct platform_device *pdev) | |||
165 | retval = gpio_direction_output(pwmbl->gpio_on, | 166 | retval = gpio_direction_output(pwmbl->gpio_on, |
166 | 0 ^ pdata->on_active_low); | 167 | 0 ^ pdata->on_active_low); |
167 | if (retval) | 168 | if (retval) |
168 | goto err_free_gpio; | 169 | goto err_free_pwm; |
169 | } | 170 | } |
170 | 171 | ||
171 | memset(&props, 0, sizeof(struct backlight_properties)); | 172 | memset(&props, 0, sizeof(struct backlight_properties)); |
@@ -175,7 +176,7 @@ static int atmel_pwm_bl_probe(struct platform_device *pdev) | |||
175 | &atmel_pwm_bl_ops, &props); | 176 | &atmel_pwm_bl_ops, &props); |
176 | if (IS_ERR(bldev)) { | 177 | if (IS_ERR(bldev)) { |
177 | retval = PTR_ERR(bldev); | 178 | retval = PTR_ERR(bldev); |
178 | goto err_free_gpio; | 179 | goto err_free_pwm; |
179 | } | 180 | } |
180 | 181 | ||
181 | pwmbl->bldev = bldev; | 182 | pwmbl->bldev = bldev; |
@@ -197,9 +198,6 @@ static int atmel_pwm_bl_probe(struct platform_device *pdev) | |||
197 | err_free_bl_dev: | 198 | err_free_bl_dev: |
198 | platform_set_drvdata(pdev, NULL); | 199 | platform_set_drvdata(pdev, NULL); |
199 | backlight_device_unregister(bldev); | 200 | backlight_device_unregister(bldev); |
200 | err_free_gpio: | ||
201 | if (pwmbl->gpio_on != -1) | ||
202 | gpio_free(pwmbl->gpio_on); | ||
203 | err_free_pwm: | 201 | err_free_pwm: |
204 | pwm_channel_free(&pwmbl->pwmc); | 202 | pwm_channel_free(&pwmbl->pwmc); |
205 | err_free_mem: | 203 | err_free_mem: |
@@ -210,10 +208,8 @@ static int __exit atmel_pwm_bl_remove(struct platform_device *pdev) | |||
210 | { | 208 | { |
211 | struct atmel_pwm_bl *pwmbl = platform_get_drvdata(pdev); | 209 | struct atmel_pwm_bl *pwmbl = platform_get_drvdata(pdev); |
212 | 210 | ||
213 | if (pwmbl->gpio_on != -1) { | 211 | if (pwmbl->gpio_on != -1) |
214 | gpio_set_value(pwmbl->gpio_on, 0); | 212 | gpio_set_value(pwmbl->gpio_on, 0); |
215 | gpio_free(pwmbl->gpio_on); | ||
216 | } | ||
217 | pwm_channel_disable(&pwmbl->pwmc); | 213 | pwm_channel_disable(&pwmbl->pwmc); |
218 | pwm_channel_free(&pwmbl->pwmc); | 214 | pwm_channel_free(&pwmbl->pwmc); |
219 | backlight_device_unregister(pwmbl->bldev); | 215 | backlight_device_unregister(pwmbl->bldev); |