]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
gpio: don't use same lockdep class for all devm_gpiochip_add_data users
authorAhmad Fatoum <a.fatoum@pengutronix.de>
Fri, 31 Jul 2020 12:38:36 +0000 (14:38 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 19 Aug 2020 06:24:08 +0000 (08:24 +0200)
commitca318309580dd46e654ab0fff1d2472a090d4da9
treeb8efa61a49d40959faf60e8b7c78397c2bd9c205
parent4309ab4b8d69bd4a340c26282ba8470fa169ad8c
gpio: don't use same lockdep class for all devm_gpiochip_add_data users

[ Upstream commit 5f402bb17533113c21d61c2d4bc4ef4a6fa1c9a5 ]

Commit 959bc7b22bd2 ("gpio: Automatically add lockdep keys") documents
in its commits message its intention to "create a unique class key for
each driver".

It does so by having gpiochip_add_data add in-place the definition of
two static lockdep classes for LOCKDEP use. That way, every caller of
the macro adds their gpiochip with unique lockdep classes.

There are many indirect callers of gpiochip_add_data, however, via
use of devm_gpiochip_add_data. devm_gpiochip_add_data has external
linkage and all its users will share the same lockdep classes, which
probably is not intended.

Fix this by replicating the gpio_chip_add_data statics-in-macro for
the devm_ version as well.

Fixes: 959bc7b22bd2 ("gpio: Automatically add lockdep keys")
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Link: https://lore.kernel.org/r/20200731123835.8003-1-a.fatoum@pengutronix.de
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpio/gpiolib-devres.c
include/linux/gpio/driver.h