From patchwork Fri May 20 07:59:17 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sascha Hauer X-Patchwork-Id: 802552 Received: from bombadil.infradead.org (bombadil.infradead.org [18.85.46.34]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p4K82Sbp015690 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 20 May 2011 08:02:49 GMT Received: from canuck.infradead.org ([2001:4978:20e::1]) by bombadil.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QNKcW-00018h-6A; Fri, 20 May 2011 07:59:40 +0000 Received: from localhost ([127.0.0.1] helo=canuck.infradead.org) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1QNKcT-0004by-HW; Fri, 20 May 2011 07:59:37 +0000 Received: from metis.ext.pengutronix.de ([2001:6f8:1178:4:290:27ff:fe1d:cc33]) by canuck.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QNKcM-0004Z2-SI for linux-arm-kernel@lists.infradead.org; Fri, 20 May 2011 07:59:32 +0000 Received: from octopus.hi.pengutronix.de ([2001:6f8:1178:2:215:17ff:fe12:23b0]) by metis.ext.pengutronix.de with esmtp (Exim 4.72) (envelope-from ) id 1QNKcI-0005j7-Sz; Fri, 20 May 2011 09:59:26 +0200 Received: from sha by octopus.hi.pengutronix.de with local (Exim 4.75) (envelope-from ) id 1QNKcI-0000V9-Po; Fri, 20 May 2011 09:59:26 +0200 From: Sascha Hauer To: alkml Subject: [PATCH] mfd wm8350: allocate irq descs dynamically Date: Fri, 20 May 2011 09:59:17 +0200 Message-Id: <1305878365-827-3-git-send-email-s.hauer@pengutronix.de> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1305878365-827-1-git-send-email-s.hauer@pengutronix.de> References: <1305878365-827-1-git-send-email-s.hauer@pengutronix.de> X-SA-Exim-Connect-IP: 2001:6f8:1178:2:215:17ff:fe12:23b0 X-SA-Exim-Mail-From: sha@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-arm-kernel@lists.infradead.org X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110520_035931_182194_0662572E X-CRM114-Status: GOOD ( 19.09 ) X-Spam-Score: -0.0 (/) X-Spam-Report: SpamAssassin version 3.3.1 on canuck.infradead.org summary: Content analysis details: (-0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain Cc: Thomas Gleixner , Sascha Hauer , Guennadi Liakhovetski X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Fri, 20 May 2011 08:02:49 +0000 (UTC) This allows boards to leave the irq_base field unitialized and prevents them having to reserve irqs in the platform. Signed-off-by: Sascha Hauer --- drivers/mfd/wm8350-irq.c | 16 +++++++++++++--- 1 files changed, 13 insertions(+), 3 deletions(-) diff --git a/drivers/mfd/wm8350-irq.c b/drivers/mfd/wm8350-irq.c index ed4b22a..04408a5 100644 --- a/drivers/mfd/wm8350-irq.c +++ b/drivers/mfd/wm8350-irq.c @@ -479,8 +479,8 @@ int wm8350_irq_init(struct wm8350 *wm8350, int irq, return 0; } - if (!pdata || !pdata->irq_base) { - dev_warn(wm8350->dev, "No interrupt support, no IRQ base\n"); + if (!pdata) { + dev_warn(wm8350->dev, "No interrupt support, no platform data\n"); return 0; } @@ -500,7 +500,17 @@ int wm8350_irq_init(struct wm8350 *wm8350, int irq, mutex_init(&wm8350->irq_lock); wm8350->chip_irq = irq; - wm8350->irq_base = pdata->irq_base; + + if (!pdata->irq_base) { + wm8350->irq_base = irq_alloc_descs(-1, 0, ARRAY_SIZE(wm8350_irqs), 0); + if (wm8350->irq_base < 0) { + dev_warn(wm8350->dev, "Allocating irqs failed with %d\n", + wm8350->irq_base); + return 0; + } + } else { + wm8350->irq_base = pdata->irq_base; + } if (pdata->irq_high) { flags |= IRQF_TRIGGER_HIGH;