public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/panel: simple: Use devm_gpiod_get_optional()
@ 2014-07-25 14:47 Alexandre Courbot
  2014-08-07  7:10 ` Alexandre Courbot
  2014-08-07  7:46 ` Thierry Reding
  0 siblings, 2 replies; 3+ messages in thread
From: Alexandre Courbot @ 2014-07-25 14:47 UTC (permalink / raw)
  To: Thierry Reding; +Cc: dri-devel, linux-kernel, gnurou, Alexandre Courbot

Use the new devm_gpiod_get_optional() to simplify the probe code.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
---
 drivers/gpu/drm/panel/panel-simple.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c
index a251361..91bf566 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -185,16 +185,14 @@ static int panel_simple_probe(struct device *dev, const struct panel_desc *desc)
 	if (IS_ERR(panel->supply))
 		return PTR_ERR(panel->supply);
 
-	panel->enable_gpio = devm_gpiod_get(dev, "enable");
+	panel->enable_gpio = devm_gpiod_get_optional(dev, "enable");
 	if (IS_ERR(panel->enable_gpio)) {
 		err = PTR_ERR(panel->enable_gpio);
-		if (err != -ENOENT) {
-			dev_err(dev, "failed to request GPIO: %d\n", err);
-			return err;
-		}
+		dev_err(dev, "failed to request GPIO: %d\n", err);
+		return err;
+	}
 
-		panel->enable_gpio = NULL;
-	} else {
+	if (panel->enable_gpio) {
 		err = gpiod_direction_output(panel->enable_gpio, 0);
 		if (err < 0) {
 			dev_err(dev, "failed to setup GPIO: %d\n", err);
-- 
2.0.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/panel: simple: Use devm_gpiod_get_optional()
  2014-07-25 14:47 [PATCH] drm/panel: simple: Use devm_gpiod_get_optional() Alexandre Courbot
@ 2014-08-07  7:10 ` Alexandre Courbot
  2014-08-07  7:46 ` Thierry Reding
  1 sibling, 0 replies; 3+ messages in thread
From: Alexandre Courbot @ 2014-08-07  7:10 UTC (permalink / raw)
  To: Alexandre Courbot
  Cc: Thierry Reding, dri-devel@lists.freedesktop.org,
	Linux Kernel Mailing List

Ping, Thierry?

On Fri, Jul 25, 2014 at 11:47 PM, Alexandre Courbot <acourbot@nvidia.com> wrote:
> Use the new devm_gpiod_get_optional() to simplify the probe code.
>
> Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
> ---
>  drivers/gpu/drm/panel/panel-simple.c | 12 +++++-------
>  1 file changed, 5 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c
> index a251361..91bf566 100644
> --- a/drivers/gpu/drm/panel/panel-simple.c
> +++ b/drivers/gpu/drm/panel/panel-simple.c
> @@ -185,16 +185,14 @@ static int panel_simple_probe(struct device *dev, const struct panel_desc *desc)
>         if (IS_ERR(panel->supply))
>                 return PTR_ERR(panel->supply);
>
> -       panel->enable_gpio = devm_gpiod_get(dev, "enable");
> +       panel->enable_gpio = devm_gpiod_get_optional(dev, "enable");
>         if (IS_ERR(panel->enable_gpio)) {
>                 err = PTR_ERR(panel->enable_gpio);
> -               if (err != -ENOENT) {
> -                       dev_err(dev, "failed to request GPIO: %d\n", err);
> -                       return err;
> -               }
> +               dev_err(dev, "failed to request GPIO: %d\n", err);
> +               return err;
> +       }
>
> -               panel->enable_gpio = NULL;
> -       } else {
> +       if (panel->enable_gpio) {
>                 err = gpiod_direction_output(panel->enable_gpio, 0);
>                 if (err < 0) {
>                         dev_err(dev, "failed to setup GPIO: %d\n", err);
> --
> 2.0.2
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/panel: simple: Use devm_gpiod_get_optional()
  2014-07-25 14:47 [PATCH] drm/panel: simple: Use devm_gpiod_get_optional() Alexandre Courbot
  2014-08-07  7:10 ` Alexandre Courbot
@ 2014-08-07  7:46 ` Thierry Reding
  1 sibling, 0 replies; 3+ messages in thread
From: Thierry Reding @ 2014-08-07  7:46 UTC (permalink / raw)
  To: Alexandre Courbot; +Cc: dri-devel, linux-kernel, gnurou

[-- Attachment #1: Type: text/plain, Size: 438 bytes --]

On Fri, Jul 25, 2014 at 11:47:25PM +0900, Alexandre Courbot wrote:
> Use the new devm_gpiod_get_optional() to simplify the probe code.
> 
> Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
> ---
>  drivers/gpu/drm/panel/panel-simple.c | 12 +++++-------
>  1 file changed, 5 insertions(+), 7 deletions(-)

For some reason I thought I had already applied this, but apparently I
was mistaken. Applied now, thanks.

Thierry

[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-08-07  7:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-25 14:47 [PATCH] drm/panel: simple: Use devm_gpiod_get_optional() Alexandre Courbot
2014-08-07  7:10 ` Alexandre Courbot
2014-08-07  7:46 ` Thierry Reding

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox