Commit a18863f5 authored by Jingoo Han's avatar Jingoo Han Committed by Linus Torvalds

backlight: s6e63m0: 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 289a65e4
...@@ -741,7 +741,8 @@ static int s6e63m0_probe(struct spi_device *spi) ...@@ -741,7 +741,8 @@ static int s6e63m0_probe(struct spi_device *spi)
return -EINVAL; return -EINVAL;
} }
ld = lcd_device_register("s6e63m0", &spi->dev, lcd, &s6e63m0_lcd_ops); ld = devm_lcd_device_register(&spi->dev, "s6e63m0", &spi->dev, lcd,
&s6e63m0_lcd_ops);
if (IS_ERR(ld)) if (IS_ERR(ld))
return PTR_ERR(ld); return PTR_ERR(ld);
...@@ -751,12 +752,11 @@ static int s6e63m0_probe(struct spi_device *spi) ...@@ -751,12 +752,11 @@ static int s6e63m0_probe(struct spi_device *spi)
props.type = BACKLIGHT_RAW; props.type = BACKLIGHT_RAW;
props.max_brightness = MAX_BRIGHTNESS; props.max_brightness = MAX_BRIGHTNESS;
bd = backlight_device_register("s6e63m0bl-bl", &spi->dev, lcd, bd = devm_backlight_device_register(&spi->dev, "s6e63m0bl-bl",
&s6e63m0_backlight_ops, &props); &spi->dev, lcd, &s6e63m0_backlight_ops,
if (IS_ERR(bd)) { &props);
ret = PTR_ERR(bd); if (IS_ERR(bd))
goto out_lcd_unregister; return PTR_ERR(bd);
}
bd->props.brightness = MAX_BRIGHTNESS; bd->props.brightness = MAX_BRIGHTNESS;
lcd->bd = bd; lcd->bd = bd;
...@@ -798,10 +798,6 @@ static int s6e63m0_probe(struct spi_device *spi) ...@@ -798,10 +798,6 @@ static int s6e63m0_probe(struct spi_device *spi)
dev_info(&spi->dev, "s6e63m0 panel driver has been probed.\n"); dev_info(&spi->dev, "s6e63m0 panel driver has been probed.\n");
return 0; return 0;
out_lcd_unregister:
lcd_device_unregister(ld);
return ret;
} }
static int s6e63m0_remove(struct spi_device *spi) static int s6e63m0_remove(struct spi_device *spi)
...@@ -811,8 +807,6 @@ static int s6e63m0_remove(struct spi_device *spi) ...@@ -811,8 +807,6 @@ static int s6e63m0_remove(struct spi_device *spi)
s6e63m0_power(lcd, FB_BLANK_POWERDOWN); s6e63m0_power(lcd, FB_BLANK_POWERDOWN);
device_remove_file(&spi->dev, &dev_attr_gamma_table); device_remove_file(&spi->dev, &dev_attr_gamma_table);
device_remove_file(&spi->dev, &dev_attr_gamma_mode); device_remove_file(&spi->dev, &dev_attr_gamma_mode);
backlight_device_unregister(lcd->bd);
lcd_device_unregister(lcd->ld);
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