Skip to content

Commit e01134e

Browse files
geertulag-linaro
authored andcommitted
backlight: pwm_bl: Remove unneeded checks for valid GPIOs
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> Link: https://lore.kernel.org/r/00be8237e0e2bc9b179177b5490f175d657261a2.1684856337.git.geert+renesas@glider.be Signed-off-by: Lee Jones <lee@kernel.org>
1 parent 29554f2 commit e01134e

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

drivers/video/backlight/pwm_bl.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@ static void pwm_backlight_power_on(struct pwm_bl_data *pb)
5454
if (pb->post_pwm_on_delay)
5555
msleep(pb->post_pwm_on_delay);
5656

57-
if (pb->enable_gpio)
58-
gpiod_set_value_cansleep(pb->enable_gpio, 1);
57+
gpiod_set_value_cansleep(pb->enable_gpio, 1);
5958

6059
pb->enabled = true;
6160
}
@@ -65,8 +64,7 @@ static void pwm_backlight_power_off(struct pwm_bl_data *pb)
6564
if (!pb->enabled)
6665
return;
6766

68-
if (pb->enable_gpio)
69-
gpiod_set_value_cansleep(pb->enable_gpio, 0);
67+
gpiod_set_value_cansleep(pb->enable_gpio, 0);
7068

7169
if (pb->pwm_off_delay)
7270
msleep(pb->pwm_off_delay);
@@ -429,8 +427,7 @@ static int pwm_backlight_initial_power_state(const struct pwm_bl_data *pb)
429427
* Synchronize the enable_gpio with the observed state of the
430428
* hardware.
431429
*/
432-
if (pb->enable_gpio)
433-
gpiod_direction_output(pb->enable_gpio, active);
430+
gpiod_direction_output(pb->enable_gpio, active);
434431

435432
/*
436433
* Do not change pb->enabled here! pb->enabled essentially

0 commit comments

Comments
 (0)