Re: [PATCH] gpio: virtuser: refuse the atomic attributes for lines that can sleep

From: Bartosz Golaszewski

Date: Wed Dec 02 2026 - 03:47:35 EST



On Tue, 01 Dec 2026 22:49:50 +0800, Lin Tzu Yang wrote:
> The *_atomic debugfs attributes run the non-sleeping GPIO calls from a
> hard irq_work, but they are created for every line, also for lines on
> chips that can sleep. Using them on such a line, for example one of
> gpio-sim, makes gpiolib warn and the chip driver sleep in hard
> interrupt context. Reading value_atomic of a gpio-sim line gives:
>
> WARNING: drivers/gpio/gpiolib.c:3689 at gpiod_get_value+0xb4/0x128
> BUG: sleeping function called from invalid context at kernel/locking/mutex.c:623
> [ BUG: Invalid wait context ]
> cat/108 is trying to lock:
> (mutex_){+.+.}-{4:4}, at: gpio_sim_get+0x30/0xb4
> ...
> gpio_sim_get+0x30/0xb4
> gpiochip_get+0x78/0x150
> gpiod_get_raw_value_commit+0x10c/0x2ac
> gpiod_get_value+0x74/0x128
> gpio_virtuser_get_value_atomic+0x34/0x9c
> irq_work_single+0xb0/0x1e0
>
> [...]

Applied, thanks!

[1/1] gpio: virtuser: refuse the atomic attributes for lines that can sleep
https://git.kernel.org/brgl/c/1d1f6dd042e3fbf6f823a6c952803a0769a80484

Best regards,
--
Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxxxxxxxx>