From patchwork Sat Jun 11 17:33:29 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shawn Guo X-Patchwork-Id: 871972 Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p5BHOZXs029643 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Sat, 11 Jun 2011 17:24:56 GMT Received: from canuck.infradead.org ([2001:4978:20e::1]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QVRvC-0002kP-1w; Sat, 11 Jun 2011 17:24:30 +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 1QVRvB-000833-KX; Sat, 11 Jun 2011 17:24:29 +0000 Received: from mail-pw0-f49.google.com ([209.85.160.49]) by canuck.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QVRv7-00082k-Vu for linux-arm-kernel@lists.infradead.org; Sat, 11 Jun 2011 17:24:26 +0000 Received: by pwi8 with SMTP id 8so2356309pwi.36 for ; Sat, 11 Jun 2011 10:24:21 -0700 (PDT) Received: by 10.142.43.6 with SMTP id q6mr528757wfq.421.1307813061157; Sat, 11 Jun 2011 10:24:21 -0700 (PDT) Received: from localhost.localdomain ([114.216.151.112]) by mx.google.com with ESMTPS id k4sm3255010pbl.75.2011.06.11.10.24.11 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 11 Jun 2011 10:24:19 -0700 (PDT) From: Shawn Guo To: linux-arm-kernel@lists.infradead.org Subject: [PATCH] gpio/mxc: fix a bug with gpio_get_value calling Date: Sun, 12 Jun 2011 01:33:29 +0800 Message-Id: <1307813609-27758-1-git-send-email-shawn.guo@linaro.org> X-Mailer: git-send-email 1.7.4.1 X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110611_132426_239813_2AA12109 X-CRM114-Status: GOOD ( 13.31 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.3.1 on canuck.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.160.49 listed in list.dnswl.org] Cc: Grant Likely , Shawn Guo , kernel@pengutronix.de, patches@linaro.org 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]); Sat, 11 Jun 2011 17:24:56 +0000 (UTC) When calling gpio_get_value, the gpio number other than bit offset should be passed as the argument. Signed-off-by: Shawn Guo --- Grant, Sascha, This is an important bug fix. Currently, if any driver request any gpio not on port 1 for IRQ_TYPE_EDGE_BOTH, we run into kernel oops. So please apply the patch asap. Thanks. drivers/gpio/gpio-mxc.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/gpio/gpio-mxc.c b/drivers/gpio/gpio-mxc.c index 950e53a..2f6a81b 100644 --- a/drivers/gpio/gpio-mxc.c +++ b/drivers/gpio/gpio-mxc.c @@ -83,7 +83,7 @@ static int gpio_set_irq_type(struct irq_data *d, u32 type) edge = GPIO_INT_FALL_EDGE; break; case IRQ_TYPE_EDGE_BOTH: - val = gpio_get_value(gpio & 31); + val = gpio_get_value(gpio); if (val) { edge = GPIO_INT_LOW_LEV; pr_debug("mxc: set GPIO %d to low trigger\n", gpio);