[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210922172133.2257467-1-hws@denx.de>
Date: Wed, 22 Sep 2021 19:21:33 +0200
From: Harald Seiler <hws@...x.de>
To: Pavel Machek <pavel@....cz>
Cc: linux-leds@...r.kernel.org, linux-kernel@...r.kernel.org,
Harald Seiler <hws@...x.de>,
Jacek Anaszewski <j.anaszewski@...sung.com>
Subject: [PATCH] leds: gpio: Always provide cdev->brightness_set_blocking()
Even if the GPIO driver will never sleep, setting
cdev->brightness_set_blocking() makes sense so
led_set_brightness_sync() can be used with such LEDs.
Internally, both gpio_led_set_blocking() and gpio_led_set() call
the same implementation anyway.
Cc: Jacek Anaszewski <j.anaszewski@...sung.com>
Signed-off-by: Harald Seiler <hws@...x.de>
---
drivers/leds/leds-gpio.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c
index b5d5e22d2d1e..bbe582e47607 100644
--- a/drivers/leds/leds-gpio.c
+++ b/drivers/leds/leds-gpio.c
@@ -79,11 +79,12 @@ static int create_gpio_led(const struct gpio_led *template,
int ret, state;
led_dat->cdev.default_trigger = template->default_trigger;
+ led_dat->cdev.brightness_set_blocking = gpio_led_set_blocking;
+
led_dat->can_sleep = gpiod_cansleep(led_dat->gpiod);
if (!led_dat->can_sleep)
led_dat->cdev.brightness_set = gpio_led_set;
- else
- led_dat->cdev.brightness_set_blocking = gpio_led_set_blocking;
+
led_dat->blinking = 0;
if (blink_set) {
led_dat->platform_gpio_blink_set = blink_set;
--
2.33.0
Powered by blists - more mailing lists