linux-leds.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Heiner Kallweit <hkallweit1@gmail.com>
To: Pavel Machek <pavel@ucw.cz>
Cc: "linux-leds@vger.kernel.org" <linux-leds@vger.kernel.org>
Subject: [PATCH] leds: Don't emit brightness set error message if LED supports hw triggers only
Date: Thu, 22 Jul 2021 22:25:08 +0200	[thread overview]
Message-ID: <f80b57aa-a542-1d6b-50d9-6de0520f2871@gmail.com> (raw)

Working on a driver for specific network LEDs that support HW triggers
only I got error "Setting an LED's brightness failed" when switching
to a different trigger. This is caused by call
led_set_brightness(led_cdev, LED_OFF) in led_trigger_set() because
both brigthness_set callbacks are not implemented. Let's suppress
the error message in that case.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 drivers/leds/led-core.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/leds/led-core.c b/drivers/leds/led-core.c
index 8eb8054ef..1104a7f0a 100644
--- a/drivers/leds/led-core.c
+++ b/drivers/leds/led-core.c
@@ -130,6 +130,8 @@ static void set_brightness_delayed(struct work_struct *ws)
 		ret = __led_set_brightness_blocking(led_cdev,
 					led_cdev->delayed_set_value);
 	if (ret < 0 &&
+	    /* LED supports hw triggers only, therefore don't warn */
+	    ret != -ENOTSUPP &&
 	    /* LED HW might have been unplugged, therefore don't warn */
 	    !(ret == -ENODEV && (led_cdev->flags & LED_UNREGISTERING) &&
 	    (led_cdev->flags & LED_HW_PLUGGABLE)))
-- 
2.32.0



             reply	other threads:[~2021-07-22 20:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-22 20:25 Heiner Kallweit [this message]
2021-11-01 11:59 ` [PATCH] leds: Don't emit brightness set error message if LED supports hw triggers only Pavel Machek
2021-11-01 12:47   ` Heiner Kallweit
2021-11-01 12:48   ` Marek Behún

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=f80b57aa-a542-1d6b-50d9-6de0520f2871@gmail.com \
    --to=hkallweit1@gmail.com \
    --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).