gpio: aggregator: Fix calling into sleeping GPIO controllers
authorGeert Uytterhoeven <geert+renesas@glider.be>
Mon, 31 Jan 2022 10:35:53 +0000 (11:35 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 16 Feb 2022 11:56:24 +0000 (12:56 +0100)
commit00181d6c966549b470b09dda8c26445abe62614c
tree8d8ef4b0b2ec18701fe1b02b00e70dcd482d1b76
parentddcb149ce10a31e3d9bcba38033b39d3c29dee74
gpio: aggregator: Fix calling into sleeping GPIO controllers

[ Upstream commit 2cba05451a6d0c703bb74f1a250691404f27c4f1 ]

If the parent GPIO controller is a sleeping controller (e.g. a GPIO
controller connected to I2C), getting or setting a GPIO triggers a
might_sleep() warning.  This happens because the GPIO Aggregator takes
the can_sleep flag into account only for its internal locking, not for
calling into the parent GPIO controller.

Fix this by using the gpiod_[gs]et*_cansleep() APIs when calling into a
sleeping GPIO controller.

Reported-by: Mikko Salomäki <ms@datarespons.se>
Fixes: 828546e24280f721 ("gpio: Add GPIO Aggregator")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpio/gpio-aggregator.c