* [PATCH] leds: trigger: gpio: Avoid warning on update of inverted
@ 2020-06-13 7:15 Jan Kiszka
2020-07-12 8:06 ` Pavel Machek
0 siblings, 1 reply; 2+ messages in thread
From: Jan Kiszka @ 2020-06-13 7:15 UTC (permalink / raw)
To: Jacek Anaszewski, Pavel Machek; +Cc: linux-leds, Linux Kernel Mailing List
From: Jan Kiszka <jan.kiszka@siemens.com>
If the GPIO has not been configured yet, writing to inverted will raise
a kernel warning.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
drivers/leds/trigger/ledtrig-gpio.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/leds/trigger/ledtrig-gpio.c b/drivers/leds/trigger/ledtrig-gpio.c
index dc64679b1a92..0120faa3dafa 100644
--- a/drivers/leds/trigger/ledtrig-gpio.c
+++ b/drivers/leds/trigger/ledtrig-gpio.c
@@ -99,7 +99,8 @@ static ssize_t gpio_trig_inverted_store(struct device *dev,
gpio_data->inverted = inverted;
/* After inverting, we need to update the LED. */
- gpio_trig_irq(0, led);
+ if (gpio_is_valid(gpio_data->gpio))
+ gpio_trig_irq(0, led);
return n;
}
--
2.26.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] leds: trigger: gpio: Avoid warning on update of inverted
2020-06-13 7:15 [PATCH] leds: trigger: gpio: Avoid warning on update of inverted Jan Kiszka
@ 2020-07-12 8:06 ` Pavel Machek
0 siblings, 0 replies; 2+ messages in thread
From: Pavel Machek @ 2020-07-12 8:06 UTC (permalink / raw)
To: Jan Kiszka; +Cc: Jacek Anaszewski, linux-leds, Linux Kernel Mailing List
[-- Attachment #1: Type: text/plain, Size: 432 bytes --]
On Sat 2020-06-13 09:15:06, Jan Kiszka wrote:
> From: Jan Kiszka <jan.kiszka@siemens.com>
>
> If the GPIO has not been configured yet, writing to inverted will raise
> a kernel warning.
>
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Thanks, applied.
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-07-12 8:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-13 7:15 [PATCH] leds: trigger: gpio: Avoid warning on update of inverted Jan Kiszka
2020-07-12 8:06 ` Pavel Machek
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).