Commit 289a65e4 authored by Jingoo Han's avatar Jingoo Han Committed by Linus Torvalds

backlight: cr_bllcd: use devm_{backlight,lcd}_device_register()

Use devm_backlight_device_register() and devm_lcd_device_register() to
make cleanup paths simpler.
Signed-off-by: default avatarJingoo Han <jg1.han@samsung.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 10645a1d
...@@ -195,16 +195,17 @@ static int cr_backlight_probe(struct platform_device *pdev) ...@@ -195,16 +195,17 @@ static int cr_backlight_probe(struct platform_device *pdev)
memset(&props, 0, sizeof(struct backlight_properties)); memset(&props, 0, sizeof(struct backlight_properties));
props.type = BACKLIGHT_RAW; props.type = BACKLIGHT_RAW;
bdp = backlight_device_register("cr-backlight", &pdev->dev, NULL, bdp = devm_backlight_device_register(&pdev->dev, "cr-backlight",
&cr_backlight_ops, &props); &pdev->dev, NULL, &cr_backlight_ops,
&props);
if (IS_ERR(bdp)) { if (IS_ERR(bdp)) {
pci_dev_put(lpc_dev); pci_dev_put(lpc_dev);
return PTR_ERR(bdp); return PTR_ERR(bdp);
} }
ldp = lcd_device_register("cr-lcd", &pdev->dev, NULL, &cr_lcd_ops); ldp = devm_lcd_device_register(&pdev->dev, "cr-lcd", &pdev->dev, NULL,
&cr_lcd_ops);
if (IS_ERR(ldp)) { if (IS_ERR(ldp)) {
backlight_device_unregister(bdp);
pci_dev_put(lpc_dev); pci_dev_put(lpc_dev);
return PTR_ERR(ldp); return PTR_ERR(ldp);
} }
...@@ -215,8 +216,6 @@ static int cr_backlight_probe(struct platform_device *pdev) ...@@ -215,8 +216,6 @@ static int cr_backlight_probe(struct platform_device *pdev)
crp = devm_kzalloc(&pdev->dev, sizeof(*crp), GFP_KERNEL); crp = devm_kzalloc(&pdev->dev, sizeof(*crp), GFP_KERNEL);
if (!crp) { if (!crp) {
lcd_device_unregister(ldp);
backlight_device_unregister(bdp);
pci_dev_put(lpc_dev); pci_dev_put(lpc_dev);
return -ENOMEM; return -ENOMEM;
} }
...@@ -241,8 +240,6 @@ static int cr_backlight_remove(struct platform_device *pdev) ...@@ -241,8 +240,6 @@ static int cr_backlight_remove(struct platform_device *pdev)
crp->cr_backlight_device->props.max_brightness = 0; crp->cr_backlight_device->props.max_brightness = 0;
cr_backlight_set_intensity(crp->cr_backlight_device); cr_backlight_set_intensity(crp->cr_backlight_device);
cr_lcd_set_power(crp->cr_lcd_device, FB_BLANK_POWERDOWN); cr_lcd_set_power(crp->cr_lcd_device, FB_BLANK_POWERDOWN);
backlight_device_unregister(crp->cr_backlight_device);
lcd_device_unregister(crp->cr_lcd_device);
pci_dev_put(lpc_dev); pci_dev_put(lpc_dev);
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment