fbdev: omap2: improve usage of gpiod API
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Thu, 28 May 2015 08:05:15 +0000 (10:05 +0200)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Wed, 3 Jun 2015 09:41:53 +0000 (12:41 +0300)
Since 39b2bbe3d715 (gpio: add flags argument to gpiod_get*() functions)
which appeared in v3.17-rc1, the gpiod_get* functions take an additional
parameter that allows to specify direction and initial value for output.

Also make use of gpiod_get*_optional where applicable.

Apart from simplification of the affected drivers this is another step
towards making the flags argument to gpiod_get*() mandatory.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
drivers/video/fbdev/omap2/displays-new/encoder-opa362.c
drivers/video/fbdev/omap2/displays-new/panel-dpi.c
drivers/video/fbdev/omap2/displays-new/panel-lgphilips-lb035q02.c
drivers/video/fbdev/omap2/displays-new/panel-sharp-ls037v7dw01.c

index 84a6b33..a14d993 100644 (file)
@@ -201,15 +201,9 @@ static int opa362_probe(struct platform_device *pdev)
 
        platform_set_drvdata(pdev, ddata);
 
-       gpio = devm_gpiod_get(&pdev->dev, "enable");
-       if (IS_ERR(gpio)) {
-               if (PTR_ERR(gpio) != -ENOENT)
-                       return PTR_ERR(gpio);
-
-               gpio = NULL;
-       } else {
-               gpiod_direction_output(gpio, 0);
-       }
+       gpio = devm_gpiod_get_optional(&pdev->dev, "enable", GPIOD_OUT_LOW);
+       if (IS_ERR(gpio))
+               return PTR_ERR(gpio);
 
        ddata->enable_gpio = gpio;
 
index eb8fd81..f7be348 100644 (file)
@@ -209,16 +209,9 @@ static int panel_dpi_probe_of(struct platform_device *pdev)
        struct videomode vm;
        struct gpio_desc *gpio;
 
-       gpio = devm_gpiod_get(&pdev->dev, "enable");
-
-       if (IS_ERR(gpio)) {
-               if (PTR_ERR(gpio) != -ENOENT)
-                       return PTR_ERR(gpio);
-               else
-                       gpio = NULL;
-       } else {
-               gpiod_direction_output(gpio, 0);
-       }
+       gpio = devm_gpiod_get_optional(&pdev->dev, "enable", GPIOD_OUT_LOW);
+       if (IS_ERR(gpio))
+               return PTR_ERR(gpio);
 
        ddata->enable_gpio = gpio;