aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJingoo Han <jg1.han@samsung.com>2013-11-12 18:09:25 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-11-12 22:09:19 -0500
commitea5092c890ed093297554e0216188543ee445068 (patch)
tree5797cbab152e85fcc91a300a59ba678ba91562cd
parentf369e664498c8e73f24d137f5356bb3492917bc2 (diff)
backlight: hx8357: use devm_lcd_device_register()
Use devm_lcd_device_register() to make cleanup paths simpler, and remove unnecessary remove(). 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>
-rw-r--r--drivers/video/backlight/hx8357.c18
1 files changed, 3 insertions, 15 deletions
diff --git a/drivers/video/backlight/hx8357.c b/drivers/video/backlight/hx8357.c
index c7af8c45ab8a..0d252e720d13 100644
--- a/drivers/video/backlight/hx8357.c
+++ b/drivers/video/backlight/hx8357.c
@@ -648,7 +648,8 @@ static int hx8357_probe(struct spi_device *spi)
648 lcd->use_im_pins = 0; 648 lcd->use_im_pins = 0;
649 } 649 }
650 650
651 lcdev = lcd_device_register("mxsfb", &spi->dev, lcd, &hx8357_ops); 651 lcdev = devm_lcd_device_register(&spi->dev, "mxsfb", &spi->dev, lcd,
652 &hx8357_ops);
652 if (IS_ERR(lcdev)) { 653 if (IS_ERR(lcdev)) {
653 ret = PTR_ERR(lcdev); 654 ret = PTR_ERR(lcdev);
654 return ret; 655 return ret;
@@ -660,29 +661,16 @@ static int hx8357_probe(struct spi_device *spi)
660 ret = ((int (*)(struct lcd_device *))match->data)(lcdev); 661 ret = ((int (*)(struct lcd_device *))match->data)(lcdev);
661 if (ret) { 662 if (ret) {
662 dev_err(&spi->dev, "Couldn't initialize panel\n"); 663 dev_err(&spi->dev, "Couldn't initialize panel\n");
663 goto init_error; 664 return ret;
664 } 665 }
665 666
666 dev_info(&spi->dev, "Panel probed\n"); 667 dev_info(&spi->dev, "Panel probed\n");
667 668
668 return 0; 669 return 0;
669
670init_error:
671 lcd_device_unregister(lcdev);
672 return ret;
673}
674
675static int hx8357_remove(struct spi_device *spi)
676{
677 struct lcd_device *lcdev = spi_get_drvdata(spi);
678
679 lcd_device_unregister(lcdev);
680 return 0;
681} 670}
682 671
683static struct spi_driver hx8357_driver = { 672static struct spi_driver hx8357_driver = {
684 .probe = hx8357_probe, 673 .probe = hx8357_probe,
685 .remove = hx8357_remove,
686 .driver = { 674 .driver = {
687 .name = "hx8357", 675 .name = "hx8357",
688 .of_match_table = of_match_ptr(hx8357_dt_ids), 676 .of_match_table = of_match_ptr(hx8357_dt_ids),