From patchwork Fri Mar 1 17:22:48 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Hunter, Jon" X-Patchwork-Id: 2202511 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 5FE3ADF24C for ; Fri, 1 Mar 2013 17:24:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751610Ab3CARYR (ORCPT ); Fri, 1 Mar 2013 12:24:17 -0500 Received: from bear.ext.ti.com ([192.94.94.41]:60175 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751269Ab3CARYQ (ORCPT ); Fri, 1 Mar 2013 12:24:16 -0500 Received: from dlelxv30.itg.ti.com ([172.17.2.17]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id r21HO9Ih020558; Fri, 1 Mar 2013 11:24:09 -0600 Received: from DLEE70.ent.ti.com (dlee70.ent.ti.com [157.170.170.113]) by dlelxv30.itg.ti.com (8.13.8/8.13.8) with ESMTP id r21HO97l023905; Fri, 1 Mar 2013 11:24:09 -0600 Received: from dlelxv24.itg.ti.com (172.17.1.199) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.2.342.3; Fri, 1 Mar 2013 11:24:09 -0600 Received: from legion.dal.design.ti.com (legion.dal.design.ti.com [128.247.22.53]) by dlelxv24.itg.ti.com (8.13.8/8.13.8) with ESMTP id r21HO9rO030923; Fri, 1 Mar 2013 11:24:09 -0600 Received: from localhost (h115-230.vpn.ti.com [172.24.115.230]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id r21HO8V11196; Fri, 1 Mar 2013 11:24:08 -0600 (CST) From: Jon Hunter To: Kevin Hilman , Santosh Shilimkar , Linus Walleij CC: Tony Lindgren , linux-omap , linux-arm , Jon Hunter Subject: [PATCH 2/2] gpio/omap: warn if bank is not enabled on setting irq type Date: Fri, 1 Mar 2013 11:22:48 -0600 Message-ID: <1362158568-1624-3-git-send-email-jon-hunter@ti.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1362158568-1624-1-git-send-email-jon-hunter@ti.com> References: <1362158568-1624-1-git-send-email-jon-hunter@ti.com> MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org For OMAP devices, if a gpio is being used as an interrupt source but has not been requested by calling gpio_request(), a call to request_irq() may cause the kernel hang because the gpio bank may be disabled and hence the register access will fail. To prevent such hangs, test for this case and warn if this is detected. Signed-off-by: Jon Hunter Acked-by: Santosh Shilimkar Reviewed-by: Felipe Balbi --- drivers/gpio/gpio-omap.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c index c3598d1..0d30c7a 100644 --- a/drivers/gpio/gpio-omap.c +++ b/drivers/gpio/gpio-omap.c @@ -427,6 +427,9 @@ static int gpio_irq_type(struct irq_data *d, unsigned type) int retval; unsigned long flags; + if (WARN_ON(!bank->mod_usage)) + return -EINVAL; + #ifdef CONFIG_ARCH_OMAP1 if (d->irq > IH_MPUIO_BASE) gpio = OMAP_MPUIO(d->irq - IH_MPUIO_BASE);