From: Harald Seiler <hws@denx.de>
To: Pavel Machek <pavel@ucw.cz>
Cc: linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org,
Harald Seiler <hws@denx.de>,
Jacek Anaszewski <j.anaszewski@samsung.com>
Subject: [PATCH] leds: gpio: Always provide cdev->brightness_set_blocking()
Date: Wed, 22 Sep 2021 19:21:33 +0200 [thread overview]
Message-ID: <20210922172133.2257467-1-hws@denx.de> (raw)
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@samsung.com>
Signed-off-by: Harald Seiler <hws@denx.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
next reply other threads:[~2021-09-22 17:21 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-22 17:21 Harald Seiler [this message]
2021-11-04 13:09 ` [PATCH] leds: gpio: Always provide cdev->brightness_set_blocking() Harald Seiler
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210922172133.2257467-1-hws@denx.de \
--to=hws@denx.de \
--cc=j.anaszewski@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=pavel@ucw.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).