mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Christophe Leroy (CS GROUP)" <chleroy@kernel.org>
To: Bartosz Golaszewski <brgl@kernel.org>
Cc: PRAT Maximilien <maximilien.prat@cs-soprasteria.com>,
	Linus Walleij <linusw@kernel.org>,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>,
	linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] gpiolib: Remove big fat warning in gpiochip_get_direction()
Date: Tue, 2 Jun 2026 23:40:22 +0200	[thread overview]
Message-ID: <24500088-9849-46e9-b32f-3f08c2ae6261@kernel.org> (raw)
In-Reply-To: <CAMRc=MdngQbJVQTZXvPKzFjcLOPs4=-6Jtf4Ua4AU0D+sUb9bw@mail.gmail.com>



Le 02/06/2026 à 18:13, Bartosz Golaszewski a écrit :
> On Tue, Jun 2, 2026 at 1:31 PM Christophe Leroy (CS GROUP)
> <chleroy@kernel.org> wrote:
>>
>> Since kernel v6.15 the following big fat warning is encountered when
>> reading /sys/kernel/debug/gpio, leading to kernel latency while
>> emiting the warning, and panicing on systems configured to panic on
>> warnings.
>>
>>    ------------[ cut here ]------------
>>    WARNING: drivers/gpio/gpiolib.c:423 at gpiochip_get_direction+0x3c/0x48, CPU#0: cat/12531
>>    CPU: 0 UID: 0 PID: 12531 Comm: cat Tainted: G        W           7.0.10-gitc72c39~-01802-g28c351659258 #27 PREEMPT
>>    Tainted: [W]=WARN
>>    Hardware name: MIAE 8xx 0x500000 CMPC885
>>    NIP:  c043c2f8 LR: c043d740 CTR: 00000000
>>    REGS: ca89bc20 TRAP: 0700   Tainted: G        W            (7.0.10-gitc72c39~-01802-g28c351659258)
>>    MSR:  00029032 <EE,ME,IR,DR,RI>  CR: 24004884  XER: 00000302
>>
>>    GPR00: c043f3f0 ca89bce0 c3278000 c20b5f20 0000000d 00000002 00000000 c0a76208
>>    GPR08: 00000001 00000000 cccccccd c313d830 84004884 100d815e c0a76208 c0a761f8
>>    GPR16: c0a761f4 c0a76278 1048834c 10488350 c21c0b04 c21c0d93 c0a5fb74 c313d848
>>    GPR24: c20b5f20 c21c0d94 00000000 00000000 c21c0d94 00000000 c21c0c00 c21c0b04
>>    NIP [c043c2f8] gpiochip_get_direction+0x3c/0x48
>>    LR [c043d740] gpiod_get_direction+0xa0/0x170
>>    Call Trace:
>>    [ca89bce0] [c28157e8] 0xc28157e8 (unreliable)
>>    [ca89bd10] [c043f3f0] gpiolib_seq_show+0x370/0x524
>>    [ca89bd90] [c021dd1c] seq_read_iter+0x174/0x618
>>    [ca89bdd0] [c021e260] seq_read+0xa0/0xd0
>>    [ca89be40] [c031063c] full_proxy_read+0x80/0xc4
>>    [ca89be70] [c01df3e0] vfs_read+0xb4/0x35c
>>    [ca89bee0] [c01e0180] ksys_read+0x8c/0x15c
>>    [ca89bf10] [c000dc94] system_call_exception+0x88/0x154
>>    [ca89bf30] [c00110a8] ret_from_syscall+0x0/0x28
>>    ---- interrupt: c00 at 0xfc629e8
>>    NIP:  0fc629e8 LR: 0fc62a34 CTR: 00000000
>>    REGS: ca89bf40 TRAP: 0c00   Tainted: G        W            (7.0.10-gitc72c39~-01802-g28c351659258)
>>    MSR:  0000d032 <EE,PR,ME,IR,DR,RI>  CR: 28004884  XER: 00000302
>>
>>    GPR00: 00000003 7f8df6a0 77e37540 00000003 7f8df6e8 00001000 00000000 00000000
>>    GPR08: 00000000 7f8e3efc 00000000 7f8e06f0 7f8e3efc 100d815e 7fe70e10 100d0000
>>    GPR16: 100d0000 00000001 1048834c 10488350 22000882 77e3fe68 1000596c 77e40b28
>>    GPR24: 00000000 28004884 01000000 00001000 7f8df6e8 00000003 0fde36a0 00000000
>>    NIP [0fc629e8] 0xfc629e8
>>    LR [0fc62a34] 0xfc62a34
>>    ---- interrupt: c00
>>    Code: 9421fff0 7c0802a6 90010014 7d2903a6 4e800421 2c030001 40810008 3860ffcc 80010014 38210010 7c0803a6 4e800020 <0fe00000> 3860ffa1 4e800020 81230020
>>    ---[ end trace 0000000000000000 ]---
>>
>> This is due to a WARN_ON() added by commit ec2cceadfae7 ("gpiolib:
>> normalize the return value of gc->get() on behalf of buggy drivers")
>> when the gpiochip doesn't implement get_direction() function. But
>> according to the documentation in <linux/gpio/driver.h> implementing
>> get_direction() is only a recommendation, not a requirement. And
>> regarless, WARN_ON() has no added value here, dumping all CPU
>> registers doesn't give any useful information for that case.
>>
>> Lower it to a simple warn_on_once() message.
>>
>> Fixes: ec2cceadfae7 ("gpiolib: normalize the return value of gc->get() on behalf of buggy drivers")
>> Signed-off-by: Christophe Leroy (CS GROUP) <chleroy@kernel.org>
>> ---
> 
> Please use scripts/get_maintainers.pl.

That's what I did, what is the problem ?

$ ./scripts/get_maintainer.pl --nom --nor --nomultiline --norolestats 
--nogit --nogit-fallback 
tmp/0001-gpiolib-Remove-big-fat-warning-in-gpiochip_get_direc.patch
Dmitry Torokhov <dmitry.torokhov@gmail.com>, Linus Walleij 
<linusw@kernel.org>, Bartosz Golaszewski 
<bartosz.golaszewski@oss.qualcomm.com>, linux-gpio@vger.kernel.org, 
linux-kernel@vger.kernel.org

> 
> What driver are you using?

I have the following ones declared in the device tree:

			CPM1_PIO_A: gpio-controller@950 {
				#gpio-cells = <2>;
				compatible = "fsl,cpm1-pario-bank-a";
				reg = <0x950 0x10>;
				gpio-controller;
			};

			CPM1_PIO_B: gpio-controller@ab8 {
				#gpio-cells = <2>;
				compatible = "fsl,cpm1-pario-bank-b";
				reg = <0xab8 0x10>;
				gpio-controller;
			};

			CPM1_PIO_C: gpio-controller@960 {
				#gpio-cells = <2>;
				compatible = "fsl,cpm1-pario-bank-c";
				reg = <0x960 0x10>;
				interrupts = <1 2 6 9 10 11 14 15 23 24 26 31>;
				fsl,cpm1-gpio-irq-mask = <0x0fff>;
				interrupt-parent = <&CPM_PIC>;
				gpio-controller;
			};

			CPM1_PIO_D: gpio-controller@970 {
				#gpio-cells = <2>;
				compatible = "fsl,cpm1-pario-bank-d";
				reg = <0x970 0x10>;
				gpio-controller;
			};


				codec_fav: peb2466@3 {
					compatible = "infineon,peb2466";
					reg = <3>;
					clocks = <&clk_mclk>;
					clock-names = "mclk";
					spi-max-frequency = <1000000>;
					spi-cs-high;
					reset-gpios = <&rst 6 GPIO_ACTIVE_LOW>;
					#sound-dai-cells = <0>;
					sound-name-prefix = "C2";
					#gpio-cells = <2>;
					gpio-controller;
					firmware-name = "mcr-peb2466-coeffs.bin";
				};
				codec_radio: peb2466@7 {
					compatible = "infineon,peb2466";
					reg = <7>;
					clocks = <&clk_mclk>;
					clock-names = "mclk";
					spi-max-frequency = <1000000>;
					spi-cs-high;
					reset-gpios = <&rst 5 GPIO_ACTIVE_LOW>;
					#sound-dai-cells = <0>;
					sound-name-prefix = "C1";
					#gpio-cells = <2>;
					gpio-controller;
					firmware-name = "mcr-peb2466-coeffs.bin";
				};


Christophe

  reply	other threads:[~2026-06-02 21:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-02 11:30 Christophe Leroy (CS GROUP)
2026-06-02 16:13 ` Bartosz Golaszewski
2026-06-02 21:40   ` Christophe Leroy (CS GROUP) [this message]
2026-06-03  8:11     ` Bartosz Golaszewski
2026-06-03  8:23       ` Christophe Leroy (CS GROUP)
2026-06-03  8:33         ` Bartosz Golaszewski

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=24500088-9849-46e9-b32f-3f08c2ae6261@kernel.org \
    --to=chleroy@kernel.org \
    --cc=bartosz.golaszewski@oss.qualcomm.com \
    --cc=brgl@kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linusw@kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maximilien.prat@cs-soprasteria.com \
    /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

Powered by JetHome