gpio: Automatically add lockdep keys
authorThierry Reding <treding@nvidia.com>
Tue, 7 Nov 2017 18:15:59 +0000 (19:15 +0100)
committerLinus Walleij <linus.walleij@linaro.org>
Wed, 8 Nov 2017 13:24:51 +0000 (14:24 +0100)
commit959bc7b22bd25a3a907fbb9b26a1d0cbdf98ef40
tree4fa59fb33b124369f71dc037e198775b26e08ea4
parent8302cf585288f75fd253f6b9a094d51ae371a3f3
gpio: Automatically add lockdep keys

In order to avoid lockdep boilerplate in individual drivers, turn the
gpiochip_add_data() function into a macro that creates a unique class
key for each driver.

Note that this has the slight disadvantage of adding a key for each
driver registered with the system. However, these keys are 8 bytes in
size, which is negligible and a small price to pay for generic
infrastructure.

Suggested-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Acked-by: Grygorii Strashko <grygorii.strashko@ti.com>
[renane __gpiochip_add_data() to gpiochip_add_data_with_key]
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/gpio/gpiolib.c
include/linux/gpio/driver.h