msm: gpio-v2: Fix lockdep warning
In similar fashion as b5eee2f (ARM: mxc: Add missing lockdep
annotation, 2011-04-04) add a lock class so that lockdep knows
the gpio irqs are always locked correctly with respect to the
descriptor lock class.
=============================================
[ INFO: possible recursive locking detected ]
3.0.21-g51ce160-00020-g8eb5789-dirty #2894
---------------------------------------------
swapper/1 is trying to acquire lock:
(&irq_desc_lock_class){-.....}, at: [<c01ceaf0>] __irq_get_desc_lock+0x74/0x8c
but task is already holding lock:
(&irq_desc_lock_class){-.....}, at: [<c01ceaf0>] __irq_get_desc_lock+0x74/0x8c
other info that might help us debug this:
Possible unsafe locking scenario:
CPU0
----
lock(&irq_desc_lock_class);
lock(&irq_desc_lock_class);
*** DEADLOCK ***
May be due to missing lock nesting notation
3 locks held by swapper/1:
#0: (&__lockdep_no_validate__){+.+.+.}, at: device_attach+0x18/0xa4
#1: (&__lockdep_no_validate__){+.+.+.}, at: device_attach+0x18/0xa4
#2: (&irq_desc_lock_class){-.....}, at: __irq_get_desc_lock+0x74/0x8c
Change-Id: Icc0058370de4db17ae4fadb66f5fe970c37ecc6c
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
diff --git a/arch/arm/mach-msm/gpio-v2.c b/arch/arm/mach-msm/gpio-v2.c
index d1766a3..4e21a86 100644
--- a/arch/arm/mach-msm/gpio-v2.c
+++ b/arch/arm/mach-msm/gpio-v2.c
@@ -490,6 +490,12 @@
.irq_disable = msm_gpio_irq_disable,
};
+/*
+ * This lock class tells lockdep that GPIO irqs are in a different
+ * category than their parents, so it won't report false recursion.
+ */
+static struct lock_class_key msm_gpio_lock_class;
+
static int __devinit msm_gpio_probe(void)
{
int i, irq, ret;
@@ -504,6 +510,7 @@
for (i = 0; i < msm_gpio.gpio_chip.ngpio; ++i) {
irq = msm_gpio_to_irq(&msm_gpio.gpio_chip, i);
+ irq_set_lockdep_class(irq, &msm_gpio_lock_class);
irq_set_chip_and_handler(irq, &msm_gpio_irq_chip,
handle_level_irq);
set_irq_flags(irq, IRQF_VALID);