From patchwork Fri Apr 17 09:39:41 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter 'p2' De Schrijver X-Patchwork-Id: 18660 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n3H9eOP5025864 for ; Fri, 17 Apr 2009 09:40:24 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757998AbZDQJkX (ORCPT ); Fri, 17 Apr 2009 05:40:23 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1758044AbZDQJkX (ORCPT ); Fri, 17 Apr 2009 05:40:23 -0400 Received: from smtp.nokia.com ([192.100.122.230]:61988 "EHLO mgw-mx03.nokia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757998AbZDQJkW (ORCPT ); Fri, 17 Apr 2009 05:40:22 -0400 Received: from esebh105.NOE.Nokia.com (esebh105.ntc.nokia.com [172.21.138.211]) by mgw-mx03.nokia.com (Switch-3.2.6/Switch-3.2.6) with ESMTP id n3H9eCG7006583 for ; Fri, 17 Apr 2009 12:40:17 +0300 Received: from vaebh104.NOE.Nokia.com ([10.160.244.30]) by esebh105.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); Fri, 17 Apr 2009 12:39:53 +0300 Received: from mgw-int02.ntc.nokia.com ([172.21.143.97]) by vaebh104.NOE.Nokia.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.3959); Fri, 17 Apr 2009 12:39:47 +0300 Received: from localhost.localdomain (esdhcp04238.research.nokia.com [172.21.42.38]) by mgw-int02.ntc.nokia.com (Switch-3.2.5/Switch-3.2.5) with ESMTP id n3H9djG0022939; Fri, 17 Apr 2009 12:39:46 +0300 From: "Peter 'p2' De Schrijver" To: linux-omap@vger.kernel.org Cc: "Peter 'p2' De Schrijver" Subject: [PATCH] OMAP: Make sure all resources used by the gpio-switch IRQ handler are initialized before use. Date: Fri, 17 Apr 2009 12:39:41 +0300 Message-Id: <1239961181-5777-1-git-send-email-peter.de-schrijver@nokia.com> X-Mailer: git-send-email 1.5.6.3 X-OriginalArrivalTime: 17 Apr 2009 09:39:47.0513 (UTC) FILETIME=[7269FA90:01C9BF40] X-Nokia-AV: Clean Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org Initialize the workqueue and timer used by the gpio-switch IRQ handler before we register the IRQ handler itself. Signed-off-by: Peter 'p2' De Schrijver --- arch/arm/plat-omap/gpio-switch.c | 13 +++++++------ 1 files changed, 7 insertions(+), 6 deletions(-) diff --git a/arch/arm/plat-omap/gpio-switch.c b/arch/arm/plat-omap/gpio-switch.c index e9041af..d88b6de 100644 --- a/arch/arm/plat-omap/gpio-switch.c +++ b/arch/arm/plat-omap/gpio-switch.c @@ -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;