Skip to contentSkip to conversation

OMAP: Make sure all resources used by the gpio-switch IRQ handler are initialized before use.

PATCH New Peter 'p2' De Schrijver 2 participants 2 messages Apr 17, 2009 – May 14, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 OMAP: Make sure all resources used by the gpio-switch IRQ handler are initialized before use.

Initialize the workqueue and timer used by the gpio-switch IRQ handler before we register the IRQ handler itself.

---
 arch/arm/plat-omap/gpio-switch.c |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)
arch/arm/plat-omap/gpio-switch.c +7 -6
index e9041af..d88b6de 100644
@@ -318,6 +318,13 @@ static int __init new_switch(struct gpio_switch *sw)
 		else
 			trigger = IRQF_TRIGGER_RISING;
 	}
+
+	INIT_WORK(&sw->work, gpio_sw_handler);
+	init_timer(&sw->timer);
+
+	sw->timer.function = gpio_sw_timer;
+	sw->timer.data = (unsigned long)sw;
+
 	r = request_irq(gpio_to_irq(sw->gpio), gpio_sw_irq_handler,
 			IRQF_SHARED | trigger, sw->name, sw);
 	if (r < 0) {
@@ -328,12 +335,6 @@ static int __init new_switch(struct gpio_switch *sw)
 		return r;
 	}
 
-	INIT_WORK(&sw->work, gpio_sw_handler);
-	init_timer(&sw->timer);
-
-	sw->timer.function = gpio_sw_timer;
-	sw->timer.data = (unsigned long)sw;
-
 	list_add(&sw->node, &gpio_switches);
 
 	return 0;
Signature · 1 line
1.5.6.3