Re: [PATCH v7 15/15] gpio: Automatically add lockdep keys

From: Linus Walleij
Date: Wed Nov 08 2017 - 08:21:51 EST


On Tue, Nov 7, 2017 at 7:15 PM, Thierry Reding <thierry.reding@xxxxxxxxx> wrote:

> From: Thierry Reding <treding@xxxxxxxxxx>
>
> 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@xxxxxx>
> Signed-off-by: Thierry Reding <treding@xxxxxxxxxx>

> -extern int gpiochip_add_data(struct gpio_chip *chip, void *data);
> +extern int __gpiochip_add_data(struct gpio_chip *chip, void *data,
> + struct lock_class_key *lock_key);

As it happens I hate __functions because this syntax is so ambigous.
So I just took the liberty to rename this
gpiochip_add_data_with_key() when applying.

Apart from that it is fine :)

Yours,
Linus Walleij