backlight: ot200_bl: use devm_gpio_request()
Subsystems (2)
PATCH 2/7 backlight: ot200_bl: use devm_gpio_request()
The devm_ functions allocate memory that is released when a driver detaches. This patch uses devm_gpio_request of these functions.
CC Christian Gmeiner <[email protected]>
Cc Richard Purdie <[email protected]>
Signed-off-by Jingoo Han <[email protected]>
--- drivers/video/backlight/ot200_bl.c | 9 +++------ 1 files changed, 3 insertions(+), 6 deletions(-)
drivers/video/backlight/ot200_bl.c +3 -6
@@ -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 ; }
@@ -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 );
@@ -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; }
@@ -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 ; }
Signature · 1 line
1.7.1
2012/6/13 Jingoo Han <[email protected]>:
Quoted 52 lines
The
devm_functions allocate memory that is released when a driver detaches. This patch usesdevm_gpio_requestof these functions.CC Christian Gmeiner <[email protected]>Cc Richard Purdie <[email protected]>Signed-off-by Jingoo Han <[email protected]>---
drivers/video/backlight/ot200_bl.c | 9 +++------1 files changed, 3 insertions(+), 6 deletions(-)drivers/video/backlight/ot200_bl.c +3
-3@@ -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; }@@ -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);@@ -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;
}drivers/video/backlight/ot200_bl.c +0
-2@@ -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; } --
Quoted 2 lines
1.7.1