diff options
Diffstat (limited to 'drivers/video/backlight/ot200_bl.c')
-rw-r--r-- | drivers/video/backlight/ot200_bl.c | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/drivers/video/backlight/ot200_bl.c b/drivers/video/backlight/ot200_bl.c index f519d55a294c..469cf0f109d2 100644 --- a/drivers/video/backlight/ot200_bl.c +++ b/drivers/video/backlight/ot200_bl.c @@ -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,14 +94,13 @@ 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 = kzalloc(sizeof(*data), GFP_KERNEL); + data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); if (!data) { retval = -ENOMEM; - goto error_kzalloc; + goto error_devm_kzalloc; } /* setup gpio */ @@ -122,26 +122,21 @@ static int ot200_backlight_probe(struct platform_device *pdev) if (IS_ERR(bl)) { dev_err(&pdev->dev, "failed to register backlight\n"); retval = PTR_ERR(bl); - goto error_backlight_device_register; + goto error_devm_kzalloc; } platform_set_drvdata(pdev, bl); return 0; -error_backlight_device_register: - kfree(data); -error_kzalloc: +error_devm_kzalloc: cs5535_mfgpt_free_timer(pwm_timer); -error_mfgpt_alloc: - gpio_free(GPIO_DIMM); return retval; } static int ot200_backlight_remove(struct platform_device *pdev) { struct backlight_device *bl = platform_get_drvdata(pdev); - struct ot200_backlight_data *data = bl_get_data(bl); backlight_device_unregister(bl); @@ -152,9 +147,7 @@ static int ot200_backlight_remove(struct platform_device *pdev) MAX_COMP2 - dim_table[100]); cs5535_mfgpt_free_timer(pwm_timer); - gpio_free(GPIO_DIMM); - kfree(data); return 0; } |