diff options
Diffstat (limited to 'drivers/video/backlight/l4f00242t03.c')
-rw-r--r-- | drivers/video/backlight/l4f00242t03.c | 36 |
1 files changed, 11 insertions, 25 deletions
diff --git a/drivers/video/backlight/l4f00242t03.c b/drivers/video/backlight/l4f00242t03.c index 9a35196d12d..fb615577132 100644 --- a/drivers/video/backlight/l4f00242t03.c +++ b/drivers/video/backlight/l4f00242t03.c @@ -49,7 +49,7 @@ static void l4f00242t03_reset(unsigned int gpio) static void l4f00242t03_lcd_init(struct spi_device *spi) { struct l4f00242t03_pdata *pdata = spi->dev.platform_data; - struct l4f00242t03_priv *priv = dev_get_drvdata(&spi->dev); + struct l4f00242t03_priv *priv = spi_get_drvdata(spi); const u16 cmd[] = { 0x36, param(0), 0x3A, param(0x60) }; dev_dbg(&spi->dev, "initializing LCD\n"); @@ -70,7 +70,7 @@ static void l4f00242t03_lcd_init(struct spi_device *spi) static void l4f00242t03_lcd_powerdown(struct spi_device *spi) { struct l4f00242t03_pdata *pdata = spi->dev.platform_data; - struct l4f00242t03_priv *priv = dev_get_drvdata(&spi->dev); + struct l4f00242t03_priv *priv = spi_get_drvdata(spi); dev_dbg(&spi->dev, "Powering down LCD\n"); @@ -168,7 +168,7 @@ static int l4f00242t03_probe(struct spi_device *spi) return -ENOMEM; } - dev_set_drvdata(&spi->dev, priv); + spi_set_drvdata(spi, priv); spi->bits_per_word = 9; spi_setup(spi); @@ -190,27 +190,24 @@ static int l4f00242t03_probe(struct spi_device *spi) return ret; } - priv->io_reg = regulator_get(&spi->dev, "vdd"); + priv->io_reg = devm_regulator_get(&spi->dev, "vdd"); if (IS_ERR(priv->io_reg)) { dev_err(&spi->dev, "%s: Unable to get the IO regulator\n", __func__); return PTR_ERR(priv->io_reg); } - priv->core_reg = regulator_get(&spi->dev, "vcore"); + priv->core_reg = devm_regulator_get(&spi->dev, "vcore"); if (IS_ERR(priv->core_reg)) { - ret = PTR_ERR(priv->core_reg); dev_err(&spi->dev, "%s: Unable to get the core regulator\n", __func__); - goto err1; + return PTR_ERR(priv->core_reg); } priv->ld = lcd_device_register("l4f00242t03", &spi->dev, priv, &l4f_ops); - if (IS_ERR(priv->ld)) { - ret = PTR_ERR(priv->ld); - goto err2; - } + if (IS_ERR(priv->ld)) + return PTR_ERR(priv->ld); /* Init the LCD */ l4f00242t03_lcd_init(spi); @@ -220,33 +217,22 @@ static int l4f00242t03_probe(struct spi_device *spi) dev_info(&spi->dev, "Epson l4f00242t03 lcd probed.\n"); return 0; - -err2: - regulator_put(priv->core_reg); -err1: - regulator_put(priv->io_reg); - - return ret; } static int l4f00242t03_remove(struct spi_device *spi) { - struct l4f00242t03_priv *priv = dev_get_drvdata(&spi->dev); + struct l4f00242t03_priv *priv = spi_get_drvdata(spi); l4f00242t03_lcd_power_set(priv->ld, FB_BLANK_POWERDOWN); lcd_device_unregister(priv->ld); - - dev_set_drvdata(&spi->dev, NULL); - - regulator_put(priv->io_reg); - regulator_put(priv->core_reg); + spi_set_drvdata(spi, NULL); return 0; } static void l4f00242t03_shutdown(struct spi_device *spi) { - struct l4f00242t03_priv *priv = dev_get_drvdata(&spi->dev); + struct l4f00242t03_priv *priv = spi_get_drvdata(spi); if (priv) l4f00242t03_lcd_power_set(priv->ld, FB_BLANK_POWERDOWN); |