From patchwork Tue Feb 16 15:40:34 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 102769 Delivered-To: patch@linaro.org Received: by 10.112.43.199 with SMTP id y7csp1737963lbl; Tue, 16 Feb 2016 07:42:04 -0800 (PST) X-Received: by 10.66.235.9 with SMTP id ui9mr31857177pac.135.1455637324821; Tue, 16 Feb 2016 07:42:04 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m80si51824455pfi.252.2016.02.16.07.42.04; Tue, 16 Feb 2016 07:42:04 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932950AbcBPPmB (ORCPT + 30 others); Tue, 16 Feb 2016 10:42:01 -0500 Received: from mout.kundenserver.de ([212.227.126.187]:59051 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932606AbcBPPl4 (ORCPT ); Tue, 16 Feb 2016 10:41:56 -0500 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue003) with ESMTPA (Nemesis) id 0LpAdk-1a2AM12BpU-00epso; Tue, 16 Feb 2016 16:41:13 +0100 From: Arnd Bergmann To: Linus Walleij Cc: linux-arm-kernel@lists.infradead.org, Arnd Bergmann , Russell King , Bjorn Helgaas , Alexandre Courbot , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Lars-Peter Clausen , Ralf Baechle , linux-mips@linux-mips.org, "# v4 . 3+" , Alban Bedel , Thomas Gleixner , Paul Burton Subject: [PATCH v2 1/5] MIPS: jz4740: remove broken irq_to_gpio() call Date: Tue, 16 Feb 2016 16:40:34 +0100 Message-Id: <1455637261-2920972-1-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 2.7.0 In-Reply-To: <455637086-2794174-1-git-send-email-arnd@arndb.de> References: <455637086-2794174-1-git-send-email-arnd@arndb.de> X-Provags-ID: V03:K0:gSycZQZpcMneao4j+bplvES8VGXkXohQ0lbdhcmpTyYYyDQBE8k PT4qa7Pr0V/v53emodKthu5X77UOG4Zi9bVu/XQoswEXyRnCdmMf8RLRvV68ASER2jwW6Jp +wzsYF8s4p534evQ0NVwIrNNF1WwgSgfnigrGV97g5dC1tHh181jtqx0iDo7iOGYDbpT8Ty Nj27BZtLQQvSAoGSaZt0A== X-UI-Out-Filterresults: notjunk:1; V01:K0:ZRt5ZyZSNH0=:IWlXwxYCG1u0IDjdJNiFfv sIE83fZ6GzlNUdxQA5+Luyc2UbjdiyAVmPLbmmAc0Y/N/aAZ51rpR6dQOMzf9lBvLSCQG4KiA /6fFjc6QTziD6H5VpPQdxYcT3byJcrqnKzhSgINUpYZCooYPw9knZ+KGErl6HvzgmYBvFAbp1 BL0SwxJZ8QKUh9HYFKQUGXSAKxMY6svd5GtFiIdPaHMJfyNDCFUnHMAkXGyNiXxWGW38f1C+h TQSpq2FI9ADzHAyKPx1+T0LE8uDXqALr/JZy2DUnFs/wlPTzyydFMzu58gWGk8qpOiB8N1T0a dDyA75sJsLUEiQ2a0Otg9LAeNrCLlE4wCijcMfYQX/eAMzZ6l3VmcBYmOgEvBNtgpMnBoa6Og IuiCGjVekBl34kbMekN8+1cagiYJsGYNcz5BXarcM8gXgUcPhWdYkRIB7OkxOC9dgbas6JIM5 sUoxf0Q8Vhh7pHcQLJonMNt9Qh6hraOm0MhKUKPb+irxkGm8YhIp6HqO9HHWJFz1YCnaAXwkx b6o82krNX0KpF82IXkRLnymtU+jBaTUoJrQDs0iqPSssh+kNmWjrMwZfNVTkWw81mCvccFjzr TDqRwKpqKuhG0Pk8D7fHOx+zhJrZSdUHE5vF2F+hum9TYTsPii672PxxaxAZPzz5Lv3QZJRMy Kc5EUucMzwodz5IObAJTHuVQ/yCyh6U6uvP6eFzKP3CyoDEfwB/UDR3YnYVMxbG/owGQ= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org gpiolib has removed the irq_to_gpio() API several years ago, but the global header still provided a non-working stub. With a MIPS-wide change to use the generic header file, the jz4740 platform is now using the wrong stub implementation of irq_to_gpio(), which cannot work. This uses an open-coded implementation in the only line it is used in. Suggested-by: Lars-Peter Clausen Signed-off-by: Arnd Bergmann Cc: # v4.3+ Fixes: 832f5dacfa0b ("MIPS: Remove all the uses of custom gpio.h"). --- arch/mips/jz4740/gpio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.7.0 diff --git a/arch/mips/jz4740/gpio.c b/arch/mips/jz4740/gpio.c index 8c6d76c9b2d6..d9907e57e9b9 100644 --- a/arch/mips/jz4740/gpio.c +++ b/arch/mips/jz4740/gpio.c @@ -270,7 +270,7 @@ uint32_t jz_gpio_port_get_value(int port, uint32_t mask) } EXPORT_SYMBOL(jz_gpio_port_get_value); -#define IRQ_TO_BIT(irq) BIT(irq_to_gpio(irq) & 0x1f) +#define IRQ_TO_BIT(irq) BIT((irq - JZ4740_IRQ_GPIO(0)) & 0x1f) static void jz_gpio_check_trigger_both(struct jz_gpio_chip *chip, unsigned int irq) { From patchwork Tue Feb 16 15:40:35 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 102770 Delivered-To: patch@linaro.org Received: by 10.112.43.199 with SMTP id y7csp1737921lbl; Tue, 16 Feb 2016 07:42:00 -0800 (PST) X-Received: by 10.98.65.193 with SMTP id g62mr31938593pfd.148.1455637319887; Tue, 16 Feb 2016 07:41:59 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id vg13si31404085pab.48.2016.02.16.07.41.59; Tue, 16 Feb 2016 07:41:59 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932572AbcBPPly (ORCPT + 30 others); Tue, 16 Feb 2016 10:41:54 -0500 Received: from mout.kundenserver.de ([212.227.126.187]:51879 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932069AbcBPPlu (ORCPT ); Tue, 16 Feb 2016 10:41:50 -0500 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue003) with ESMTPA (Nemesis) id 0Lr6Rz-1a0EYS1l3b-00eZAT; Tue, 16 Feb 2016 16:41:23 +0100 From: Arnd Bergmann To: Linus Walleij Cc: linux-arm-kernel@lists.infradead.org, Arnd Bergmann , Russell King , Bjorn Helgaas , Alexandre Courbot , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Lars-Peter Clausen , Ralf Baechle , linux-mips@linux-mips.org Subject: [PATCH v2 2/5] gpio: remove broken irq_to_gpio() interface Date: Tue, 16 Feb 2016 16:40:35 +0100 Message-Id: <1455637261-2920972-2-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1455637261-2920972-1-git-send-email-arnd@arndb.de> References: <455637086-2794174-1-git-send-email-arnd@arndb.de> <1455637261-2920972-1-git-send-email-arnd@arndb.de> X-Provags-ID: V03:K0:UY7KgFRESGsZqo3RjHOskQaSayC6+nUAG4MDu3zYUjuMv/jE+l1 ZBGa8OlIBPPw6osqfSSVXYmlftsu1ckWT7ES3RXACMjlJLws5Ac5iQaaMco2KWGX7yB+yT3 zeVdwqMaNHeTJ75IzCtHwY14LQmPD6poRMCblKCCFrKESt9m6SalFl02oKYjrrpl2E/3gOb 5HMBeFp5Q6k3xlQ5ZjB5w== X-UI-Out-Filterresults: notjunk:1; V01:K0:2RdMCxG5lto=:6db6buIAUFCj06FeOmvow/ KwRcWBcK4NKaqYlYjZbhSXu+4xEX0GqN4uD89TjpM8llF8BiTTjl4LU3zD9T0vPyz1gkSchrg aOwK2VuiXw2ldJ6gUqb7MzQehuSwtih9XZJNZAj6y/eoOv6FyUan9ik+MRjyMmKqERPtD7rWX iROJn+9t0yWxtMnVmNcuesQ7M2UweUvWZDH4ezKKQmGDjGcJnyJI58WNosNemGDtkBb5eMei8 QBzTMSxZgm3sAa8WF45ilvoX9ZtmFthiDmbbNj/NJyAOyA1H2icU8vu2OK8TenW96Z2/020IA p1jcYTxShVeUPyfxhj8F1UBvEHIERXFIKtn9IS/1EW2MdMcFKTbIKURuUGEfLBNoD5S7H7Scv 2DswQL/3MPs2lqFzhrUJlXNmKTVjJ+XVCSPKHfiHtxXvEGt3i4YxLjVtl8/kSOwsnELdNqGHe lu86zDn+BDSyyW/SakdE/RHs9O/pa11eIJzVpI9vhfseFRnqOKshxdx6BzxR8NmJXt66nYSZ8 XUKtYG4Hu61PopZspMSwi85xMqmeo3eGGYsaS1BevLzpk10+Drop9+w2/sZkeQOA+Ppon79os l5OLr8fIsTMDjaZX9wbnANbS0YyB8hdj/v0QovLtaId5z0t0QoN7P40qzVkfwYzU7yw0Yl3cd Q6PqOVmCTn+ErQ8ZyrdbQKv5jNPiXQoat8gcXluxnKjsiRHSjYHEPj3aLjsbRT8DPwPY= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org gpiolib has removed the irq_to_gpio() API several years ago, but the global header still provided a non-working stub. To prevent new users of this broken function from showing up, let's remove the stubs as well. Signed-off-by: Arnd Bergmann --- include/linux/gpio.h | 12 ------------ 1 file changed, 12 deletions(-) -- 2.7.0 diff --git a/include/linux/gpio.h b/include/linux/gpio.h index d12b5d566e4b..6fc1c9e74854 100644 --- a/include/linux/gpio.h +++ b/include/linux/gpio.h @@ -70,11 +70,6 @@ static inline int gpio_to_irq(unsigned int gpio) return __gpio_to_irq(gpio); } -static inline int irq_to_gpio(unsigned int irq) -{ - return -EINVAL; -} - #endif /* ! CONFIG_ARCH_HAVE_CUSTOM_GPIO_H */ /* CONFIG_GPIOLIB: bindings for managed devices that want to request gpios */ @@ -222,13 +217,6 @@ static inline void gpiochip_unlock_as_irq(struct gpio_chip *chip, WARN_ON(1); } -static inline int irq_to_gpio(unsigned irq) -{ - /* irq can never have been returned from gpio_to_irq() */ - WARN_ON(1); - return -EINVAL; -} - static inline int gpiochip_add_pin_range(struct gpio_chip *chip, const char *pinctl_name, unsigned int gpio_offset, unsigned int pin_offset, From patchwork Tue Feb 16 15:40:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 102767 Delivered-To: patch@linaro.org Received: by 10.112.43.199 with SMTP id y7csp1738353lbl; Tue, 16 Feb 2016 07:42:47 -0800 (PST) X-Received: by 10.66.218.225 with SMTP id pj1mr31552046pac.83.1455637366916; Tue, 16 Feb 2016 07:42:46 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n79si12670254pfi.149.2016.02.16.07.42.46; Tue, 16 Feb 2016 07:42:46 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932995AbcBPPmp (ORCPT + 30 others); Tue, 16 Feb 2016 10:42:45 -0500 Received: from mout.kundenserver.de ([212.227.126.133]:61813 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932638AbcBPPl6 (ORCPT ); Tue, 16 Feb 2016 10:41:58 -0500 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue003) with ESMTPA (Nemesis) id 0Lpis6-1a1c8V1D9y-00fO76; Tue, 16 Feb 2016 16:41:29 +0100 From: Arnd Bergmann To: Linus Walleij Cc: linux-arm-kernel@lists.infradead.org, Arnd Bergmann , Russell King , Bjorn Helgaas , Alexandre Courbot , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Lars-Peter Clausen , Ralf Baechle , linux-mips@linux-mips.org Subject: [PATCH v2 4/5] gpio: ep93xx: remove private irq_to_gpio function Date: Tue, 16 Feb 2016 16:40:37 +0100 Message-Id: <1455637261-2920972-4-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1455637261-2920972-1-git-send-email-arnd@arndb.de> References: <455637086-2794174-1-git-send-email-arnd@arndb.de> <1455637261-2920972-1-git-send-email-arnd@arndb.de> X-Provags-ID: V03:K0:j9cyZI0vRxWKbLcNM0OuDEZkwDwLKPWFjYn6eTNbF2sa+PRfHO1 KyEVbzz2jKzisg/tmyv/VJoiL2oYVemdsH2cMRNC6l3dYPBsvGyL5GA/uK4gzGJ306ym3VU sPgONX5QJQ9wvBxqYhP3y9/nq/FJ3FbU7tF4LeG2z6wrXIfNDgFm9LOqbaqR83srqcaqwhD kk/A84+jeNmH0Detue0UA== X-UI-Out-Filterresults: notjunk:1; V01:K0:m+GRaYezSaE=:qASBZG7Rgy8opG1PGhBZpd cSUfbzzoXB/rVb3BN3nanwlSqxIDXuFOWUfOg/WHE7SbAMj8bj4ympVH9IxSogIHCcnU165sq UQryuLY7u59qWM2pTQ6Rlb9rnoeVuVKyo3pcw5AlBQjYIZxpXJayfpyGCucvQ/8Y3PZYoomiG LQ/FgkYwf8oKfZwPTKO8ZlwMFw3gnG9UHwsFDNktI09KnSSAS8ciKYL0/+Qx6La+P7xl8HXuh RvwNnkCF8mNCjd4c2jKHlA3aGO2PUxSsXN9R9c0trPZahGnhVjYKe7U0/5EZz5Cp2yvE8zsUL 56ILbcK38+8fHHjhAX+s2LDdTyyqUxjcaV3manrSAiTs1vx3n2nvBsqdQ5TxCiZQ/mQXQJGb3 Yd9pTeQpSE+4yOXA3REttkO1YroEnH6uAz9SNp9Q8+TXRj37+ayuhlIyxzWdSsnfgDjj+brIc F27QeFeGZAbrfra4cb6eRzgy1Zx+NMHGf8hIV7tQsq5ir6tC6rvchLcVdEISB/YuU9AbYobYD e4l8WfkUiqvynocX2u+Hk70miHz+jqmOwu5Rn79cA1M87hGFO3XvtlglxA3Tje2w9RUgnHvLp pzik4Zftftu7Q7WbWAuQydQ1vHk95E1ClxSBTEghYOsiTYKwoSGB7x0SA4FSwNN658JAs8OPC GyMjzaCTL1smanb2V6KK0dCEfETEUsGt7MPgxknh3rxP+WuNKqQjhi5MGCoBBK5JyOq0= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The ep93xx goes through its own back-and-forth dance every time it wants to know the gpio number for an irq line, when it really just hardcodes a fixed offset in ep93xx_gpio_to_irq(). This removes the pointless macro and replaces the conversion inside of the driver with simple add/subtract operations, using an explicit macro. Signed-off-by: Arnd Bergmann --- drivers/gpio/gpio-ep93xx.c | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-) -- 2.7.0 diff --git a/drivers/gpio/gpio-ep93xx.c b/drivers/gpio/gpio-ep93xx.c index 20e5846bda28..cd83d30e8ff7 100644 --- a/drivers/gpio/gpio-ep93xx.c +++ b/drivers/gpio/gpio-ep93xx.c @@ -18,12 +18,8 @@ #include #include #include -#include -/* FIXME: this is here for gpio_to_irq() - get rid of this! */ #include -#define irq_to_gpio(irq) ((irq) - gpio_to_irq(0)) - void __iomem *ep93xx_gpio_base; /* FIXME: put this into irq_data */ #define EP93XX_GPIO_REG(x) (ep93xx_gpio_base + (x)) @@ -35,6 +31,7 @@ void __iomem *ep93xx_gpio_base; /* FIXME: put this into irq_data */ #define EP93XX_GPIO_LINE_MAX 63 /* maximum value for irq capable line identifiers */ +#define EP93XX_GPIO_IRQ_BASE 64 #define EP93XX_GPIO_LINE_MAX_IRQ 23 @@ -77,7 +74,7 @@ static void ep93xx_gpio_update_int_params(unsigned port) static void ep93xx_gpio_int_debounce(unsigned int irq, bool enable) { - int line = irq_to_gpio(irq); + int line = irq - EP93XX_GPIO_IRQ_BASE; int port = line >> 3; int port_mask = 1 << (line & 7); @@ -98,7 +95,7 @@ static void ep93xx_gpio_ab_irq_handler(struct irq_desc *desc) status = readb(EP93XX_GPIO_A_INT_STATUS); for (i = 0; i < 8; i++) { if (status & (1 << i)) { - int gpio_irq = gpio_to_irq(0) + i; + int gpio_irq = EP93XX_GPIO_IRQ_BASE + i; generic_handle_irq(gpio_irq); } } @@ -106,7 +103,7 @@ static void ep93xx_gpio_ab_irq_handler(struct irq_desc *desc) status = readb(EP93XX_GPIO_B_INT_STATUS); for (i = 0; i < 8; i++) { if (status & (1 << i)) { - int gpio_irq = gpio_to_irq(8) + i; + int gpio_irq = EP93XX_GPIO_IRQ_BASE + 8 + i; generic_handle_irq(gpio_irq); } } @@ -121,14 +118,14 @@ static void ep93xx_gpio_f_irq_handler(struct irq_desc *desc) */ unsigned int irq = irq_desc_get_irq(desc); int port_f_idx = ((irq + 1) & 7) ^ 4; /* {19..22,47..50} -> {0..7} */ - int gpio_irq = gpio_to_irq(16) + port_f_idx; + int gpio_irq = EP93XX_GPIO_IRQ_BASE + 16 + port_f_idx; generic_handle_irq(gpio_irq); } static void ep93xx_gpio_irq_ack(struct irq_data *d) { - int line = irq_to_gpio(d->irq); + int line = d->irq - EP93XX_GPIO_IRQ_BASE; int port = line >> 3; int port_mask = 1 << (line & 7); @@ -142,7 +139,7 @@ static void ep93xx_gpio_irq_ack(struct irq_data *d) static void ep93xx_gpio_irq_mask_ack(struct irq_data *d) { - int line = irq_to_gpio(d->irq); + int line = d->irq - EP93XX_GPIO_IRQ_BASE; int port = line >> 3; int port_mask = 1 << (line & 7); @@ -157,7 +154,7 @@ static void ep93xx_gpio_irq_mask_ack(struct irq_data *d) static void ep93xx_gpio_irq_mask(struct irq_data *d) { - int line = irq_to_gpio(d->irq); + int line = d->irq - EP93XX_GPIO_IRQ_BASE; int port = line >> 3; gpio_int_unmasked[port] &= ~(1 << (line & 7)); @@ -166,7 +163,7 @@ static void ep93xx_gpio_irq_mask(struct irq_data *d) static void ep93xx_gpio_irq_unmask(struct irq_data *d) { - int line = irq_to_gpio(d->irq); + int line = d->irq - EP93XX_GPIO_IRQ_BASE; int port = line >> 3; gpio_int_unmasked[port] |= 1 << (line & 7); @@ -180,7 +177,7 @@ static void ep93xx_gpio_irq_unmask(struct irq_data *d) */ static int ep93xx_gpio_irq_type(struct irq_data *d, unsigned int type) { - const int gpio = irq_to_gpio(d->irq); + const int gpio = d->irq - EP93XX_GPIO_IRQ_BASE; const int port = gpio >> 3; const int port_mask = 1 << (gpio & 7); irq_flow_handler_t handler; @@ -241,14 +238,14 @@ static struct irq_chip ep93xx_gpio_irq_chip = { static void ep93xx_gpio_init_irq(struct platform_device *pdev) { - int gpio_irq; + int gpio; int i; - for (gpio_irq = gpio_to_irq(0); - gpio_irq <= gpio_to_irq(EP93XX_GPIO_LINE_MAX_IRQ); ++gpio_irq) { - irq_set_chip_and_handler(gpio_irq, &ep93xx_gpio_irq_chip, + for (gpio = 0; gpio <= EP93XX_GPIO_LINE_MAX_IRQ; ++gpio) { + irq_set_chip_and_handler(EP93XX_GPIO_IRQ_BASE + gpio, + &ep93xx_gpio_irq_chip, handle_level_irq); - irq_clear_status_flags(gpio_irq, IRQ_NOREQUEST); + irq_clear_status_flags(EP93XX_GPIO_IRQ_BASE + gpio, IRQ_NOREQUEST); } irq_set_chained_handler(platform_get_irq(pdev, 0), @@ -294,7 +291,7 @@ static int ep93xx_gpio_set_debounce(struct gpio_chip *chip, unsigned offset, unsigned debounce) { int gpio = chip->base + offset; - int irq = gpio_to_irq(gpio); + int irq = EP93XX_GPIO_IRQ_BASE + gpio; if (irq < 0) return -EINVAL; @@ -316,7 +313,7 @@ static int ep93xx_gpio_to_irq(struct gpio_chip *chip, unsigned offset) if (gpio > EP93XX_GPIO_LINE_MAX_IRQ) return -EINVAL; - return 64 + gpio; + return EP93XX_GPIO_IRQ_BASE + gpio; } static int ep93xx_gpio_add_bank(struct gpio_chip *gc, struct device *dev, From patchwork Tue Feb 16 15:40:38 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 102768 Delivered-To: patch@linaro.org Received: by 10.112.43.199 with SMTP id y7csp1738160lbl; Tue, 16 Feb 2016 07:42:24 -0800 (PST) X-Received: by 10.66.102.65 with SMTP id fm1mr31978147pab.36.1455637344788; Tue, 16 Feb 2016 07:42:24 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m70si51902836pfj.147.2016.02.16.07.42.24; Tue, 16 Feb 2016 07:42:24 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755347AbcBPPmU (ORCPT + 30 others); Tue, 16 Feb 2016 10:42:20 -0500 Received: from mout.kundenserver.de ([212.227.126.135]:64216 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932791AbcBPPmA (ORCPT ); Tue, 16 Feb 2016 10:42:00 -0500 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue003) with ESMTPA (Nemesis) id 0Lvfyq-1ZvXbL3W6W-017XtC; Tue, 16 Feb 2016 16:41:32 +0100 From: Arnd Bergmann To: Linus Walleij Cc: linux-arm-kernel@lists.infradead.org, Arnd Bergmann , Russell King , Bjorn Helgaas , Alexandre Courbot , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Lars-Peter Clausen , Ralf Baechle , linux-mips@linux-mips.org, linux-arch@vger.kernel.org Subject: [PATCH v2 5/5] gpio: allow setting ARCH_NR_GPIOS from Kconfig Date: Tue, 16 Feb 2016 16:40:38 +0100 Message-Id: <1455637261-2920972-5-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1455637261-2920972-1-git-send-email-arnd@arndb.de> References: <455637086-2794174-1-git-send-email-arnd@arndb.de> <1455637261-2920972-1-git-send-email-arnd@arndb.de> X-Provags-ID: V03:K0:e9I4n9sy6PyfgfkQLus4LmFKwzxjGnLahn87Oh+4EEz/dEqZzmI LtnORHyhCGaFgmUaH5Ihrjgy7613+uzJecPpIVM2X+Xx8EcpoO9BD5nEgbnXW4tr0ewq7UK m5WTq6i2c2QuL9MfeyxJgpViae6H/T7kxu9Yu45wrUbtMwByfdIyIBjULFfEfyEVxlW4VXf DiYm2g/2zC+4bpKMDAVMg== X-UI-Out-Filterresults: notjunk:1; V01:K0:t6Cj3QeaQKw=:I+oXVxtRdcp0uPYz95qpLK G5wlMx5OOjmurCFCNs8JulEdslbXS6tP+F8HYlbpf9c2B8v7vHJvBDyz8rm3TMzEfufqtR63T 25d+E3pDQYFchwhhdxtgfSZBG7klAZLQawXA9l39z0WUTwpRWtBTOyMyx3zlpZEXKbALutpGP Mw22GxLl6ZEXVP6YW0oZGGnGYuMTEYzVjdZBr7UCExWmvtVyJMOZDMO4psfHcRCackMtWz7rZ B08HEXwKfH4n83Hnjtft/zjqR3nzekQO96+0UEks/qqznwF8rASWSDI0uLDMEcqcZHLCpgpZD kbTkZgnNnGX4wpaK8oq3ZO+tC7uYHOdr7OUrsVdsnebR+WSyrQ9nSZp0S4mhTDMwUebEbvPYr 2aWELeMj/dTrVCxaPRYFey48jJfJLdW531WHbGfwJIRcvwC8ukL7e7rZTKqTCl2Twtld+/mE6 eR3y3Rfy41YxwCGxdbJnjekPuJXF92sfRRhsI0CWil4YW+LqoFWuQGoStsrqlPfmMgbAKSRq5 jF/cwF+46TJABq72sMAoDidh0kk2tJZ2stCCSnwCrEEwysAwUDPBC0ldPQl+Ug01JNMiBhinS e6K8gmcLcmv5iQ8Z6ZKVBTwnIKMNuuBtiTKTeI1g8nZQDz2Ea8pkrSKAOPxMikAC5p7QFqeOI Mm+/hGhfN9B4ibsir0HPgBCCKP6MqzsBVcpI+SR34bWDoqQC2r3pt1NCqxdx1O1pVn9M= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The ARM version of asm/gpio.h basically just contains the same definitions as the gpiolib version, with the exception of ARCH_NR_GPIOS. This adds the option for overriding the constant through Kconfig to the architecture-independent header, so we can remove the ARM specific file later. Signed-off-by: Arnd Bergmann --- include/asm-generic/gpio.h | 4 ++++ 1 file changed, 4 insertions(+) -- 2.7.0 diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h index 40ec1433f05d..8ca627dcea11 100644 --- a/include/asm-generic/gpio.h +++ b/include/asm-generic/gpio.h @@ -26,8 +26,12 @@ */ #ifndef ARCH_NR_GPIOS +#if defined(CONFIG_ARCH_NR_GPIO) && CONFIG_ARCH_NR_GPIO > 0 +#define ARCH_NR_GPIOS CONFIG_ARCH_NR_GPIO +#else #define ARCH_NR_GPIOS 512 #endif +#endif /* * "valid" GPIO numbers are nonnegative and may be passed to