Commit 5690378e authored by Jingoo Han's avatar Jingoo Han Committed by Linus Torvalds

backlight: ili9320: use devm_lcd_device_register()

Use 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 a7e9e3ff
...@@ -235,7 +235,8 @@ int ili9320_probe_spi(struct spi_device *spi, ...@@ -235,7 +235,8 @@ int ili9320_probe_spi(struct spi_device *spi,
ili9320_setup_spi(ili, spi); ili9320_setup_spi(ili, spi);
lcd = lcd_device_register("ili9320", dev, ili, &ili9320_ops); lcd = devm_lcd_device_register(&spi->dev, "ili9320", dev, ili,
&ili9320_ops);
if (IS_ERR(lcd)) { if (IS_ERR(lcd)) {
dev_err(dev, "failed to register lcd device\n"); dev_err(dev, "failed to register lcd device\n");
return PTR_ERR(lcd); return PTR_ERR(lcd);
...@@ -248,24 +249,16 @@ int ili9320_probe_spi(struct spi_device *spi, ...@@ -248,24 +249,16 @@ int ili9320_probe_spi(struct spi_device *spi,
ret = ili9320_power(ili, FB_BLANK_UNBLANK); ret = ili9320_power(ili, FB_BLANK_UNBLANK);
if (ret != 0) { if (ret != 0) {
dev_err(dev, "failed to set lcd power state\n"); dev_err(dev, "failed to set lcd power state\n");
goto err_unregister; return ret;
} }
return 0; return 0;
err_unregister:
lcd_device_unregister(lcd);
return ret;
} }
EXPORT_SYMBOL_GPL(ili9320_probe_spi); EXPORT_SYMBOL_GPL(ili9320_probe_spi);
int ili9320_remove(struct ili9320 *ili) int ili9320_remove(struct ili9320 *ili)
{ {
ili9320_power(ili, FB_BLANK_POWERDOWN); ili9320_power(ili, FB_BLANK_POWERDOWN);
lcd_device_unregister(ili->lcd);
return 0; return 0;
} }
EXPORT_SYMBOL_GPL(ili9320_remove); EXPORT_SYMBOL_GPL(ili9320_remove);
......
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