* [PATCH] backlight: pwm_bl: Remove unneeded checks for valid GPIOs
@ 2023-05-23 15:40 Geert Uytterhoeven
2023-05-25 11:28 ` Lee Jones
0 siblings, 1 reply; 2+ messages in thread
From: Geert Uytterhoeven @ 2023-05-23 15:40 UTC (permalink / raw)
To: Thierry Reding, Uwe Kleine-König, Lee Jones, Daniel Thompson,
Jingoo Han, Linus Walleij, Bartosz Golaszewski
Cc: linux-pwm, dri-devel, linux-fbdev, linux-gpio, linux-kernel,
Geert Uytterhoeven
All of gpiod_set_value_cansleep() and gpiod_direction_output() handle
NULL GPIO pointers just fine, so there is no need to check for that in
the caller.
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
drivers/video/backlight/pwm_bl.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c
index fce412234d10399a..a51fbab96368053b 100644
--- a/drivers/video/backlight/pwm_bl.c
+++ b/drivers/video/backlight/pwm_bl.c
@@ -54,8 +54,7 @@ static void pwm_backlight_power_on(struct pwm_bl_data *pb)
if (pb->post_pwm_on_delay)
msleep(pb->post_pwm_on_delay);
- if (pb->enable_gpio)
- gpiod_set_value_cansleep(pb->enable_gpio, 1);
+ gpiod_set_value_cansleep(pb->enable_gpio, 1);
pb->enabled = true;
}
@@ -65,8 +64,7 @@ static void pwm_backlight_power_off(struct pwm_bl_data *pb)
if (!pb->enabled)
return;
- if (pb->enable_gpio)
- gpiod_set_value_cansleep(pb->enable_gpio, 0);
+ gpiod_set_value_cansleep(pb->enable_gpio, 0);
if (pb->pwm_off_delay)
msleep(pb->pwm_off_delay);
@@ -429,8 +427,7 @@ static int pwm_backlight_initial_power_state(const struct pwm_bl_data *pb)
* Synchronize the enable_gpio with the observed state of the
* hardware.
*/
- if (pb->enable_gpio)
- gpiod_direction_output(pb->enable_gpio, active);
+ gpiod_direction_output(pb->enable_gpio, active);
/*
* Do not change pb->enabled here! pb->enabled essentially
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] backlight: pwm_bl: Remove unneeded checks for valid GPIOs
2023-05-23 15:40 [PATCH] backlight: pwm_bl: Remove unneeded checks for valid GPIOs Geert Uytterhoeven
@ 2023-05-25 11:28 ` Lee Jones
0 siblings, 0 replies; 2+ messages in thread
From: Lee Jones @ 2023-05-25 11:28 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Thierry Reding, Uwe Kleine-König, Daniel Thompson,
Jingoo Han, Linus Walleij, Bartosz Golaszewski, linux-pwm,
dri-devel, linux-fbdev, linux-gpio, linux-kernel
On Tue, 23 May 2023, Geert Uytterhoeven wrote:
> All of gpiod_set_value_cansleep() and gpiod_direction_output() handle
> NULL GPIO pointers just fine, so there is no need to check for that in
> the caller.
>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
> drivers/video/backlight/pwm_bl.c | 9 +++------
> 1 file changed, 3 insertions(+), 6 deletions(-)
Applied, thanks
--
Lee Jones [李琼斯]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-05-25 11:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-23 15:40 [PATCH] backlight: pwm_bl: Remove unneeded checks for valid GPIOs Geert Uytterhoeven
2023-05-25 11:28 ` Lee Jones
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).