backlight: generic_bl: use devm_backlight_device_register()
authorJingoo Han <jg1.han@samsung.com>
Tue, 12 Nov 2013 23:09:15 +0000 (15:09 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 13 Nov 2013 03:09:17 +0000 (12:09 +0900)
Use devm_backlight_device_register() to make cleanup paths simpler.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/video/backlight/generic_bl.c

index 48fa9146958b27112b67a3a4524061ad031eeec2..5d8d65200db77b739154c44e394138bc8b332641 100644 (file)
@@ -93,8 +93,8 @@ static int genericbl_probe(struct platform_device *pdev)
        memset(&props, 0, sizeof(struct backlight_properties));
        props.type = BACKLIGHT_RAW;
        props.max_brightness = machinfo->max_intensity;
-       bd = backlight_device_register(name, &pdev->dev, NULL, &genericbl_ops,
-                                      &props);
+       bd = devm_backlight_device_register(&pdev->dev, name, &pdev->dev,
+                                       NULL, &genericbl_ops, &props);
        if (IS_ERR(bd))
                return PTR_ERR(bd);
 
@@ -118,8 +118,6 @@ static int genericbl_remove(struct platform_device *pdev)
        bd->props.brightness = 0;
        backlight_update_status(bd);
 
-       backlight_device_unregister(bd);
-
        dev_info(&pdev->dev, "Generic Backlight Driver Unloaded\n");
        return 0;
 }