]> git.baikalelectronics.ru Git - kernel.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)
committerLinus Walleij <linus.walleij@linaro.org>
Mon, 3 Aug 2020 23:22:02 +0000 (01:22 +0200)
commit7d93d447920c2f8be9e45f6cd011ade26d4a88ef
treeab2c1f0d7491c03dd164bc29ad370f2bfb52da6c
parent203c1d4764bc8bfdbf478413f81078463d5b9823
gpio: don't use same lockdep class for all devm_gpiochip_add_data users

Commit 4f9ebb35348c ("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: 4f9ebb35348c ("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>
drivers/gpio/gpiolib-devres.c
include/linux/gpio/driver.h