* [PATCH v2] gpio: just plain warning when nonexisting gpio requested
@ 2020-12-02 13:37 Enrico Weigelt, metux IT consult
2020-12-05 22:29 ` Linus Walleij
0 siblings, 1 reply; 2+ messages in thread
From: Enrico Weigelt, metux IT consult @ 2020-12-02 13:37 UTC (permalink / raw)
To: linux-kernel; +Cc: linus.walleij, bgolaszewski, linux-gpio
From: Enrico Weigelt <info@metux.net>
When trying to export an nonexisting gpio ID, the kernel prints out a
big warning w/ stacktrace, sounding like a huge problem. In fact it's
a pretty normal situation, like file or device not found.
So, just print a more relaxed warning instead.
changes v2: drop defining pr_fmt()
Signed-off-by: Enrico Weigelt <info@metux.net>
---
drivers/gpio/gpiolib.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 089ddcaa9bc6..6639e7b77d6c 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -1,4 +1,5 @@
// SPDX-License-Identifier: GPL-2.0
+
#include <linux/bitmap.h>
#include <linux/kernel.h>
#include <linux/module.h>
@@ -119,7 +120,7 @@ struct gpio_desc *gpio_to_desc(unsigned gpio)
spin_unlock_irqrestore(&gpio_lock, flags);
if (!gpio_is_valid(gpio))
- WARN(1, "invalid GPIO %d\n", gpio);
+ pr_warn("invalid GPIO %d\n", gpio);
return NULL;
}
--
2.11.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] gpio: just plain warning when nonexisting gpio requested
2020-12-02 13:37 [PATCH v2] gpio: just plain warning when nonexisting gpio requested Enrico Weigelt, metux IT consult
@ 2020-12-05 22:29 ` Linus Walleij
0 siblings, 0 replies; 2+ messages in thread
From: Linus Walleij @ 2020-12-05 22:29 UTC (permalink / raw)
To: Enrico Weigelt, metux IT consult
Cc: linux-kernel, Bartosz Golaszewski, open list:GPIO SUBSYSTEM
On Wed, Dec 2, 2020 at 2:37 PM Enrico Weigelt, metux IT consult
<info@metux.net> wrote:
> From: Enrico Weigelt <info@metux.net>
>
> When trying to export an nonexisting gpio ID, the kernel prints out a
> big warning w/ stacktrace, sounding like a huge problem. In fact it's
> a pretty normal situation, like file or device not found.
>
> So, just print a more relaxed warning instead.
>
> changes v2: drop defining pr_fmt()
>
> Signed-off-by: Enrico Weigelt <info@metux.net>
Hm hm. It would mainly happen if someone was using the sysfs
ABI right? I don't mind if sysfs feels scary to use.
But I see it can happen for other code using the old GPIO
symbols so OK I applied it.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-12-05 22:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-02 13:37 [PATCH v2] gpio: just plain warning when nonexisting gpio requested Enrico Weigelt, metux IT consult
2020-12-05 22:29 ` Linus Walleij
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).