]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
drivers/video/backlight/l4f00242t03.c: use gpio_request_one() to simplify error handling
authorFabio Estevam <festevam@gmail.com>
Wed, 5 Oct 2011 00:43:31 +0000 (11:43 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Thu, 13 Oct 2011 06:49:43 +0000 (17:49 +1100)
Using gpio_request_one can make the error handling simpler.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
drivers/video/backlight/l4f00242t03.c

index 1ce32fd8dc15d82dab5f994c92b06fa2fd3c50e8..4f5d1c4cb6aba0a53c7bb75c2605bf9c000241f3 100644 (file)
@@ -172,29 +172,22 @@ static int __devinit l4f00242t03_probe(struct spi_device *spi)
 
        priv->spi = spi;
 
-       ret = gpio_request(pdata->reset_gpio, "lcd l4f00242t03 reset");
+       ret = gpio_request_one(pdata->reset_gpio, GPIOF_OUT_INIT_HIGH,
+                                               "lcd l4f00242t03 reset");
        if (ret) {
                dev_err(&spi->dev,
                        "Unable to get the lcd l4f00242t03 reset gpio.\n");
                goto err;
        }
 
-       ret = gpio_direction_output(pdata->reset_gpio, 1);
-       if (ret)
-               goto err2;
-
-       ret = gpio_request(pdata->data_enable_gpio,
-                               "lcd l4f00242t03 data enable");
+       ret = gpio_request_one(pdata->data_enable_gpio, GPIOF_OUT_INIT_LOW,
+                                               "lcd l4f00242t03 data enable");
        if (ret) {
                dev_err(&spi->dev,
                        "Unable to get the lcd l4f00242t03 data en gpio.\n");
                goto err2;
        }
 
-       ret = gpio_direction_output(pdata->data_enable_gpio, 0);
-       if (ret)
-               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",