Skip to content

Commit

Permalink
backlight: ot200_bl: use devm_gpio_request()
Browse files Browse the repository at this point in the history
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>
Acked-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Cc: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Jingoo Han authored and Linus Torvalds committed Jul 31, 2012
1 parent 5f9dd5c commit f673934
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions drivers/video/backlight/ot200_bl.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ static int ot200_backlight_probe(struct platform_device *pdev)
int retval = 0;

/* request gpio */
if (gpio_request(GPIO_DIMM, "ot200 backlight dimmer") < 0) {
if (devm_gpio_request(&pdev->dev, GPIO_DIMM,
"ot200 backlight dimmer") < 0) {
dev_err(&pdev->dev, "failed to request GPIO %d\n", GPIO_DIMM);
return -ENODEV;
}
Expand All @@ -93,8 +94,7 @@ static int ot200_backlight_probe(struct platform_device *pdev)
pwm_timer = cs5535_mfgpt_alloc_timer(7, MFGPT_DOMAIN_ANY);
if (!pwm_timer) {
dev_err(&pdev->dev, "MFGPT 7 not available\n");
retval = -ENODEV;
goto error_mfgpt_alloc;
return -ENODEV;
}

data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
Expand Down Expand Up @@ -131,8 +131,6 @@ static int ot200_backlight_probe(struct platform_device *pdev)

error_devm_kzalloc:
cs5535_mfgpt_free_timer(pwm_timer);
error_mfgpt_alloc:
gpio_free(GPIO_DIMM);
return retval;
}

Expand All @@ -149,7 +147,6 @@ static int ot200_backlight_remove(struct platform_device *pdev)
MAX_COMP2 - dim_table[100]);

cs5535_mfgpt_free_timer(pwm_timer);
gpio_free(GPIO_DIMM);

return 0;
}
Expand Down

0 comments on commit f673934

Please sign in to comment.