backlight: fix broken regulator API usage in l4f00242t03
[pandora-kernel.git] / drivers / video / backlight / l4f00242t03.c
index 98ad3e5..77ec70b 100644 (file)
@@ -52,15 +52,11 @@ static void l4f00242t03_lcd_init(struct spi_device *spi)
 
        dev_dbg(&spi->dev, "initializing LCD\n");
 
-       if (priv->io_reg) {
-               regulator_set_voltage(priv->io_reg, 1800000, 1800000);
-               regulator_enable(priv->io_reg);
-       }
+       regulator_set_voltage(priv->io_reg, 1800000, 1800000);
+       regulator_enable(priv->io_reg);
 
-       if (priv->core_reg) {
-               regulator_set_voltage(priv->core_reg, 2800000, 2800000);
-               regulator_enable(priv->core_reg);
-       }
+       regulator_set_voltage(priv->core_reg, 2800000, 2800000);
+       regulator_enable(priv->core_reg);
 
        l4f00242t03_reset(pdata->reset_gpio);
 
@@ -78,11 +74,8 @@ static void l4f00242t03_lcd_powerdown(struct spi_device *spi)
 
        gpio_set_value(pdata->data_enable_gpio, 0);
 
-       if (priv->io_reg)
-               regulator_disable(priv->io_reg);
-
-       if (priv->core_reg)
-               regulator_disable(priv->core_reg);
+       regulator_disable(priv->io_reg);
+       regulator_disable(priv->core_reg);
 }
 
 static int l4f00242t03_lcd_power_get(struct lcd_device *ld)
@@ -201,24 +194,18 @@ static int __devinit l4f00242t03_probe(struct spi_device *spi)
        if (ret)
                goto err3;
 
-       if (pdata->io_supply) {
-               priv->io_reg = regulator_get(NULL, pdata->io_supply);
-
-               if (IS_ERR(priv->io_reg)) {
-                       pr_err("%s: Unable to get the IO regulator\n",
-                                                               __func__);
-                       goto err3;
-               }
+       priv->io_reg = regulator_get(&spi->dev, "vdd");
+       if (IS_ERR(priv->io_reg)) {
+               dev_err(&spi->dev, "%s: Unable to get the IO regulator\n",
+                      __func__);
+               goto err3;
        }
 
-       if (pdata->core_supply) {
-               priv->core_reg = regulator_get(NULL, pdata->core_supply);
-
-               if (IS_ERR(priv->core_reg)) {
-                       pr_err("%s: Unable to get the core regulator\n",
-                                                               __func__);
-                       goto err4;
-               }
+       priv->core_reg = regulator_get(&spi->dev, "vcore");
+       if (IS_ERR(priv->core_reg)) {
+               dev_err(&spi->dev, "%s: Unable to get the core regulator\n",
+                      __func__);
+               goto err4;
        }
 
        priv->ld = lcd_device_register("l4f00242t03",
@@ -238,11 +225,9 @@ static int __devinit l4f00242t03_probe(struct spi_device *spi)
        return 0;
 
 err5:
-       if (priv->core_reg)
-               regulator_put(priv->core_reg);
+       regulator_put(priv->core_reg);
 err4:
-       if (priv->io_reg)
-               regulator_put(priv->io_reg);
+       regulator_put(priv->io_reg);
 err3:
        gpio_free(pdata->data_enable_gpio);
 err2:
@@ -266,10 +251,8 @@ static int __devexit l4f00242t03_remove(struct spi_device *spi)
        gpio_free(pdata->data_enable_gpio);
        gpio_free(pdata->reset_gpio);
 
-       if (priv->io_reg)
-               regulator_put(priv->io_reg);
-       if (priv->core_reg)
-               regulator_put(priv->core_reg);
+       regulator_put(priv->io_reg);
+       regulator_put(priv->core_reg);
 
        kfree(priv);