diff mbox series

[v1,1/2] gpio: tegra: Add lockdep class

Message ID 20201104132624.17168-1-digetx@gmail.com
State New
Headers show
Series [v1,1/2] gpio: tegra: Add lockdep class | expand

Commit Message

Dmitry Osipenko Nov. 4, 2020, 1:26 p.m. UTC
Add lockdep class in order to fix debug warnings that are coming from a
legit nested use of irq_set_irq_wake() by the Tegra GPIO driver.

 WARNING: possible recursive locking detected
 ...
  (irq_set_irq_wake) from (tegra_gpio_irq_set_wake)
  (tegra_gpio_irq_set_wake) from (irq_set_irq_wake)
  (irq_set_irq_wake) from (brcmf_sdiod_intr_register [brcmfmac])
 ...

Tested-by: Peter Geis <pgwipeout@gmail.com>
Reported-by: Peter Geis <pgwipeout@gmail.com>
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
---
 drivers/gpio/gpio-tegra.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Bartosz Golaszewski Nov. 6, 2020, 2:31 p.m. UTC | #1
On Wed, Nov 4, 2020 at 2:26 PM Dmitry Osipenko <digetx@gmail.com> wrote:
>
> Add lockdep class in order to fix debug warnings that are coming from a
> legit nested use of irq_set_irq_wake() by the Tegra GPIO driver.
>
>  WARNING: possible recursive locking detected
>  ...
>   (irq_set_irq_wake) from (tegra_gpio_irq_set_wake)
>   (tegra_gpio_irq_set_wake) from (irq_set_irq_wake)
>   (irq_set_irq_wake) from (brcmf_sdiod_intr_register [brcmfmac])
>  ...
>
> Tested-by: Peter Geis <pgwipeout@gmail.com>
> Reported-by: Peter Geis <pgwipeout@gmail.com>
> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
> ---
>  drivers/gpio/gpio-tegra.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c
> index 86568154cdb3..98fc78739ebf 100644
> --- a/drivers/gpio/gpio-tegra.c
> +++ b/drivers/gpio/gpio-tegra.c
> @@ -560,6 +560,9 @@ static const struct dev_pm_ops tegra_gpio_pm_ops = {
>         SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(tegra_gpio_suspend, tegra_gpio_resume)
>  };
>
> +static struct lock_class_key gpio_lock_class;
> +static struct lock_class_key gpio_request_class;
> +
>  static int tegra_gpio_probe(struct platform_device *pdev)
>  {
>         struct tegra_gpio_info *tgi;
> @@ -661,6 +664,7 @@ static int tegra_gpio_probe(struct platform_device *pdev)
>                 bank = &tgi->bank_info[GPIO_BANK(gpio)];
>
>                 irq_set_chip_data(irq, bank);
> +               irq_set_lockdep_class(irq, &gpio_lock_class, &gpio_request_class);
>                 irq_set_chip_and_handler(irq, &tgi->ic, handle_simple_irq);
>         }
>
> --
> 2.27.0
>

Patch applied, thanks!

Bartosz
diff mbox series

Patch

diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c
index 86568154cdb3..98fc78739ebf 100644
--- a/drivers/gpio/gpio-tegra.c
+++ b/drivers/gpio/gpio-tegra.c
@@ -560,6 +560,9 @@  static const struct dev_pm_ops tegra_gpio_pm_ops = {
 	SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(tegra_gpio_suspend, tegra_gpio_resume)
 };
 
+static struct lock_class_key gpio_lock_class;
+static struct lock_class_key gpio_request_class;
+
 static int tegra_gpio_probe(struct platform_device *pdev)
 {
 	struct tegra_gpio_info *tgi;
@@ -661,6 +664,7 @@  static int tegra_gpio_probe(struct platform_device *pdev)
 		bank = &tgi->bank_info[GPIO_BANK(gpio)];
 
 		irq_set_chip_data(irq, bank);
+		irq_set_lockdep_class(irq, &gpio_lock_class, &gpio_request_class);
 		irq_set_chip_and_handler(irq, &tgi->ic, handle_simple_irq);
 	}