From patchwork Mon Jun 6 06:20:46 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shawn Guo X-Patchwork-Id: 98805 Return-Path: X-Original-To: incoming-imx@patchwork.ozlabs.org Delivered-To: patchwork-incoming-imx@bilbo.ozlabs.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id E89ABB6FB0 for ; Mon, 6 Jun 2011 16:13:09 +1000 (EST) Received: from canuck.infradead.org ([2001:4978:20e::1]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QTT3e-0001sH-9G; Mon, 06 Jun 2011 06:13:02 +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 1QTT3d-0003xJ-UD; Mon, 06 Jun 2011 06:13:01 +0000 Received: from mail-px0-f171.google.com ([209.85.212.171]) by canuck.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QTT3b-0003wz-Gp for linux-arm-kernel@lists.infradead.org; Mon, 06 Jun 2011 06:13:00 +0000 Received: by pxi7 with SMTP id 7so2198689pxi.16 for ; Sun, 05 Jun 2011 23:12:55 -0700 (PDT) Received: by 10.142.62.29 with SMTP id k29mr629524wfa.397.1307340774888; Sun, 05 Jun 2011 23:12:54 -0700 (PDT) Received: from localhost.localdomain ([114.216.154.92]) by mx.google.com with ESMTPS id y2sm3447688pbi.67.2011.06.05.23.12.39 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 05 Jun 2011 23:12:54 -0700 (PDT) From: Shawn Guo To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 1/2] gpio/mxs: save the unnecessary function mxs_gpio_to_irq Date: Mon, 6 Jun 2011 14:20:46 +0800 Message-Id: <1307341247-26382-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-20110606_021259_689206_13E2E734 X-CRM114-Status: GOOD ( 10.70 ) 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.212.171 listed in list.dnswl.org] Cc: grant.likely@secretlab.ca, jamie@jamieiles.com, 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-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+incoming-imx=patchwork.ozlabs.org@lists.infradead.org List-Id: linux-imx-kernel.lists.patchwork.ozlabs.org The irq number can be easily calculated from the sum of MXS_GPIO_IRQ_START and gpio number. The patch directly defines gpio_to_irq for it and removes mxs_gpio_to_irq to simplify the the driver. Signed-off-by: Shawn Guo --- arch/arm/mach-mxs/include/mach/gpio.h | 2 +- drivers/gpio/gpio-mxs.c | 9 --------- 2 files changed, 1 insertions(+), 10 deletions(-) diff --git a/arch/arm/mach-mxs/include/mach/gpio.h b/arch/arm/mach-mxs/include/mach/gpio.h index 828cccc..18017c5 100644 --- a/arch/arm/mach-mxs/include/mach/gpio.h +++ b/arch/arm/mach-mxs/include/mach/gpio.h @@ -28,8 +28,8 @@ #define gpio_get_value __gpio_get_value #define gpio_set_value __gpio_set_value #define gpio_cansleep __gpio_cansleep -#define gpio_to_irq __gpio_to_irq #define irq_to_gpio(irq) ((irq) - MXS_GPIO_IRQ_START) +#define gpio_to_irq(gpio) (MXS_GPIO_IRQ_START + (gpio)) #endif /* __MACH_MXS_GPIO_H__ */ diff --git a/drivers/gpio/gpio-mxs.c b/drivers/gpio/gpio-mxs.c index a287614..d01f046 100644 --- a/drivers/gpio/gpio-mxs.c +++ b/drivers/gpio/gpio-mxs.c @@ -236,14 +236,6 @@ static void mxs_gpio_set(struct gpio_chip *chip, unsigned offset, int value) writel(1 << offset, pin_addr + MXS_CLR); } -static int mxs_gpio_to_irq(struct gpio_chip *chip, unsigned offset) -{ - struct mxs_gpio_port *port = - container_of(chip, struct mxs_gpio_port, chip); - - return port->virtual_irq_start + offset; -} - static int mxs_gpio_direction_input(struct gpio_chip *chip, unsigned offset) { mxs_set_gpio_direction(chip, offset, 0); @@ -327,7 +319,6 @@ static int __devinit mxs_gpio_probe(struct platform_device *pdev) port->chip.direction_output = mxs_gpio_direction_output; port->chip.get = mxs_gpio_get; port->chip.set = mxs_gpio_set; - port->chip.to_irq = mxs_gpio_to_irq; port->chip.base = port->id * 32; port->chip.ngpio = 32;