All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] pwm-backlight: fix bogus request for GPIO#0 when instantiated from DT
@ 2014-08-20  6:38 Lothar Waßmann
  2014-08-20  7:32 ` Thierry Reding
  2014-08-20 12:17 ` Lee Jones
  0 siblings, 2 replies; 3+ messages in thread
From: Lothar Waßmann @ 2014-08-20  6:38 UTC (permalink / raw)
  To: Bryan Wu, Jean-Christophe Plagniol-Villard, Jingoo Han,
	Lee Jones, Thierry Reding, Tomi Valkeinen, linux-fbdev,
	linux-kernel, linux-pwm
  Cc: Lothar Waßmann

commit 257462dbf3ed ("pwm-backlight: switch to gpiod interface")
introduced a regression leading to acquiring a bogus GPIO-0 when
configured from DT without an 'enable-gpios' property.
The driver will happily accept the 0 initialized 'enable_gpio' member
of the struct platform_pwm_backlight_data as valid gpio number, and
request this GPIO as enable pin. In case of multiple driver instances,
the second will fail to register with the error message:
pwm-backlight backlight1.23: failed to request GPIO#0: -16

Fix this by setting enable_gpio in the pdata struct to -EINVAL.

Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>
---
 drivers/video/backlight/pwm_bl.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c
index d7a3d13..e6ef6b4 100644
--- a/drivers/video/backlight/pwm_bl.c
+++ b/drivers/video/backlight/pwm_bl.c
@@ -172,7 +172,7 @@ static int pwm_backlight_parse_dt(struct device *dev,
 		data->dft_brightness = value;
 		data->max_brightness--;
 	}
-
+	data->enable_gpio = -EINVAL;
 	return 0;
 }
 
-- 
1.7.10.4


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

* Re: [PATCH] pwm-backlight: fix bogus request for GPIO#0 when instantiated from DT
  2014-08-20  6:38 [PATCH] pwm-backlight: fix bogus request for GPIO#0 when instantiated from DT Lothar Waßmann
@ 2014-08-20  7:32 ` Thierry Reding
  2014-08-20 12:17 ` Lee Jones
  1 sibling, 0 replies; 3+ messages in thread
From: Thierry Reding @ 2014-08-20  7:32 UTC (permalink / raw)
  To: Lothar Waßmann
  Cc: Bryan Wu, Jean-Christophe Plagniol-Villard, Jingoo Han,
	Lee Jones, Tomi Valkeinen, linux-fbdev, linux-kernel, linux-pwm

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

On Wed, Aug 20, 2014 at 08:38:36AM +0200, Lothar Waßmann wrote:
> commit 257462dbf3ed ("pwm-backlight: switch to gpiod interface")
> introduced a regression leading to acquiring a bogus GPIO-0 when
> configured from DT without an 'enable-gpios' property.
> The driver will happily accept the 0 initialized 'enable_gpio' member
> of the struct platform_pwm_backlight_data as valid gpio number, and
> request this GPIO as enable pin. In case of multiple driver instances,
> the second will fail to register with the error message:
> pwm-backlight backlight1.23: failed to request GPIO#0: -16
> 
> Fix this by setting enable_gpio in the pdata struct to -EINVAL.
> 
> Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>
> ---
>  drivers/video/backlight/pwm_bl.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c
> index d7a3d13..e6ef6b4 100644
> --- a/drivers/video/backlight/pwm_bl.c
> +++ b/drivers/video/backlight/pwm_bl.c
> @@ -172,7 +172,7 @@ static int pwm_backlight_parse_dt(struct device *dev,
>  		data->dft_brightness = value;
>  		data->max_brightness--;
>  	}
> -
> +	data->enable_gpio = -EINVAL;

I'd prefer to keep the blank line for readability. Other than that:

Acked-by: Thierry Reding <treding@nvidia.com>

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

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

* Re: [PATCH] pwm-backlight: fix bogus request for GPIO#0 when instantiated from DT
  2014-08-20  6:38 [PATCH] pwm-backlight: fix bogus request for GPIO#0 when instantiated from DT Lothar Waßmann
  2014-08-20  7:32 ` Thierry Reding
@ 2014-08-20 12:17 ` Lee Jones
  1 sibling, 0 replies; 3+ messages in thread
From: Lee Jones @ 2014-08-20 12:17 UTC (permalink / raw)
  To: Lothar Waßmann
  Cc: Bryan Wu, Jean-Christophe Plagniol-Villard, Jingoo Han,
	Thierry Reding, Tomi Valkeinen, linux-fbdev, linux-kernel,
	linux-pwm

On Wed, 20 Aug 2014, Lothar Waßmann wrote:

> commit 257462dbf3ed ("pwm-backlight: switch to gpiod interface")
> introduced a regression leading to acquiring a bogus GPIO-0 when
> configured from DT without an 'enable-gpios' property.
> The driver will happily accept the 0 initialized 'enable_gpio' member
> of the struct platform_pwm_backlight_data as valid gpio number, and
> request this GPIO as enable pin. In case of multiple driver instances,
> the second will fail to register with the error message:
> pwm-backlight backlight1.23: failed to request GPIO#0: -16
> 
> Fix this by setting enable_gpio in the pdata struct to -EINVAL.
> 
> Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>
> ---
>  drivers/video/backlight/pwm_bl.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied to -fixes with Thierry's Ack and the blank line left.

> diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c
> index d7a3d13..e6ef6b4 100644
> --- a/drivers/video/backlight/pwm_bl.c
> +++ b/drivers/video/backlight/pwm_bl.c
> @@ -172,7 +172,7 @@ static int pwm_backlight_parse_dt(struct device *dev,
>  		data->dft_brightness = value;
>  		data->max_brightness--;
>  	}
> -
> +	data->enable_gpio = -EINVAL;
>  	return 0;
>  }
>  

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

end of thread, other threads:[~2014-08-20 12:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-20  6:38 [PATCH] pwm-backlight: fix bogus request for GPIO#0 when instantiated from DT Lothar Waßmann
2014-08-20  7:32 ` Thierry Reding
2014-08-20 12:17 ` Lee Jones

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.