0026-pinctrl-msm-Silence-recursive-lockdep-warning.patch 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. From 9588c91936434166007c3a15ad7f4e2f3729c5e7 Mon Sep 17 00:00:00 2001
  2. From: Stephen Boyd <[email protected]>
  3. Date: Thu, 6 Mar 2014 22:44:40 -0800
  4. Subject: [PATCH 026/182] pinctrl: msm: Silence recursive lockdep warning
  5. If a driver calls enable_irq_wake() on a gpio turned interrupt
  6. from the msm pinctrl driver we'll get a lockdep warning like so:
  7. =============================================
  8. [ INFO: possible recursive locking detected ]
  9. 3.14.0-rc3 #2 Not tainted
  10. ---------------------------------------------
  11. modprobe/52 is trying to acquire lock:
  12. (&irq_desc_lock_class){-.....}, at: [<c026aea0>] __irq_get_desc_lock+0x48/0x88
  13. but task is already holding lock:
  14. (&irq_desc_lock_class){-.....}, at: [<c026aea0>] __irq_get_desc_lock+0x48/0x88
  15. other info that might help us debug this:
  16. Possible unsafe locking scenario:
  17. CPU0
  18. ----
  19. lock(&irq_desc_lock_class);
  20. lock(&irq_desc_lock_class);
  21. *** DEADLOCK ***
  22. May be due to missing lock nesting notation
  23. 4 locks held by modprobe/52:
  24. #0: (&__lockdep_no_validate__){......}, at: [<c04f2864>] __driver_attach+0x48/0x98
  25. #1: (&__lockdep_no_validate__){......}, at: [<c04f2874>] __driver_attach+0x58/0x98
  26. #2: (&irq_desc_lock_class){-.....}, at: [<c026aea0>] __irq_get_desc_lock+0x48/0x88
  27. #3: (&(&pctrl->lock)->rlock){......}, at: [<c04bb4b8>] msm_gpio_irq_set_wake+0x20/0xa8
  28. Silence it by putting the gpios into their own lock class.
  29. Signed-off-by: Stephen Boyd <[email protected]>
  30. Acked-by: Bjorn Andersson <[email protected]>
  31. Signed-off-by: Linus Walleij <[email protected]>
  32. ---
  33. drivers/pinctrl/pinctrl-msm.c | 7 +++++++
  34. 1 file changed, 7 insertions(+)
  35. --- a/drivers/pinctrl/pinctrl-msm.c
  36. +++ b/drivers/pinctrl/pinctrl-msm.c
  37. @@ -857,6 +857,12 @@ static void msm_gpio_irq_handler(unsigne
  38. chained_irq_exit(chip, desc);
  39. }
  40. +/*
  41. + * This lock class tells lockdep that GPIO irqs are in a different
  42. + * category than their parents, so it won't report false recursion.
  43. + */
  44. +static struct lock_class_key gpio_lock_class;
  45. +
  46. static int msm_gpio_init(struct msm_pinctrl *pctrl)
  47. {
  48. struct gpio_chip *chip;
  49. @@ -895,6 +901,7 @@ static int msm_gpio_init(struct msm_pinc
  50. for (i = 0; i < chip->ngpio; i++) {
  51. irq = irq_create_mapping(pctrl->domain, i);
  52. + irq_set_lockdep_class(irq, &gpio_lock_class);
  53. irq_set_chip_and_handler(irq, &msm_gpio_irq_chip, handle_edge_irq);
  54. irq_set_chip_data(irq, pctrl);
  55. }