From patchwork Mon Feb 15 15:46:28 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 102783 Delivered-To: patch@linaro.org Received: by 10.112.43.199 with SMTP id y7csp1142243lbl; Mon, 15 Feb 2016 07:47:51 -0800 (PST) X-Received: by 10.67.3.163 with SMTP id bx3mr23998474pad.97.1455551271603; Mon, 15 Feb 2016 07:47:51 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y8si11248414pas.240.2016.02.15.07.47.51; Mon, 15 Feb 2016 07:47:51 -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 S1752245AbcBOPrt (ORCPT + 30 others); Mon, 15 Feb 2016 10:47:49 -0500 Received: from mout.kundenserver.de ([212.227.126.135]:56306 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751586AbcBOPrr (ORCPT ); Mon, 15 Feb 2016 10:47:47 -0500 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue002) with ESMTPA (Nemesis) id 0M6JFz-1ZlCjn0IN1-00yRTc; Mon, 15 Feb 2016 16:47:16 +0100 From: Arnd Bergmann To: Linus Walleij , Alexandre Courbot Cc: linux-arm-kernel@lists.infradead.org, Arnd Bergmann , Russell King , Bjorn Helgaas , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Ralf Baechle , Paul Burton , linux-mips@linux-mips.org Subject: [PATCH 1/4] gpio: remove broken irq_to_gpio() interface Date: Mon, 15 Feb 2016 16:46:28 +0100 Message-Id: <1455551208-2825510-2-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1455551208-2825510-1-git-send-email-arnd@arndb.de> References: <20160202194831.10827.63244.stgit@bhelgaas-glaptop2.roam.corp.google.com> <1455551208-2825510-1-git-send-email-arnd@arndb.de> X-Provags-ID: V03:K0:4yiXAIC+kozwy3fbtOfqbIRVx92K/Fo3wKpdLS39Mwd4ZimsG8m eUGwOXDKe7/UcxFsQIrVI9TG4UlFc9DCNQRYL5G6RG+2qlU2Qqn9cN1P5EWvaDZ00H7fd5C uE+6r1X7dJBgPVsxwTaVeeELvNZT51Yy5v3ff6Op034jvOZR8pZ5DgPrpUG/HOu4zVSeHcc Cvcv0M5ynfpTromRTjGOg== X-UI-Out-Filterresults: notjunk:1; V01:K0:RdfwHsebjOY=:LrJBybT6dOAQVNHYTgjvx7 cexgeaRO7ycx5jeBP3255tWAZJF3eyy3EBe0ilGeHt8wc9EnIm4+7EIiWgi8u9FKFhmnDi/Kf YHD0E07ye4wirH2wbJyviDR1JeSMte41Hn4YYNYqKgIwJRbI699lMWmPieJy9Cqy87KZt6oBU nw+kMXkCvB3dRRzvZM9PycmLqHRgTJAhtK+O0Q8XHfb3OeN7+UsADaXZhakYuw4iEa1v2hyVm Hfw26GBKfzUzteG6Szpbv0WXZ8JXhYlkFQ4qLBZpYWAsBZXkmS30htyCMePABGt1LPchHt50h mb/5L3R1+wztT8xxIEM/B19dnyRM/hNkGBNknKHSIeoNxpwzpA/sRHpEtpOi9JCeao1IL1WFh Zhx5DRivnKF2713FVm8N0PcFbQTD2AZcEXK38W4SjLbINhntDXbC7RnFM5pKgeMryjQLkEcGF iGEHD9xBQr1FqJyZl93lt0ITwCTrDndblIs2MLTl+6rzTFWiftKNTzELGHFBeqHBGQXUaJ6no wpcozjeQ6rrO0r1I0ZrWH4YDGXYmHX2w8Fy5jecORs0UXbjlUcLEmpXU2nNEJAWf14NEYNYJH a9mna60TulXCQzgVcgZ/fkGlzMp8n4aokirFKn22y80wogVrUk3Pw8YQ2KP0Z6rPCZ50GVTAJ hrtTNBcpYAJnWi22ghnYB7dAS9m145lYLdgr5I2tp5iuWR9a7B2sA3dSAgyQEV3BxWrg= 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. Apparently one new user has shown up in arch/mips, so this patch moves the broken definition to where it is used, ensuring that we get new users but not changing the current behavior on jz4740. Signed-off-by: Arnd Bergmann --- arch/mips/jz4740/gpio.c | 7 +++++++ include/linux/gpio.h | 12 ------------ 2 files changed, 7 insertions(+), 12 deletions(-) -- 2.7.0 diff --git a/arch/mips/jz4740/gpio.c b/arch/mips/jz4740/gpio.c index 8c6d76c9b2d6..e9bb43714892 100644 --- a/arch/mips/jz4740/gpio.c +++ b/arch/mips/jz4740/gpio.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -270,6 +271,12 @@ uint32_t jz_gpio_port_get_value(int port, uint32_t mask) } EXPORT_SYMBOL(jz_gpio_port_get_value); +static inline __deprecated int irq_to_gpio(unsigned int irq) +{ + /* this has clearly not worked for a long time */ + return -EINVAL; +} + #define IRQ_TO_BIT(irq) BIT(irq_to_gpio(irq) & 0x1f) static void jz_gpio_check_trigger_both(struct jz_gpio_chip *chip, unsigned int irq) 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 Mon Feb 15 15:46:29 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 102782 Delivered-To: patch@linaro.org Received: by 10.112.43.199 with SMTP id y7csp1142299lbl; Mon, 15 Feb 2016 07:47:59 -0800 (PST) X-Received: by 10.67.6.72 with SMTP id cs8mr23789744pad.138.1455551278933; Mon, 15 Feb 2016 07:47:58 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e12si44024353pap.197.2016.02.15.07.47.58; Mon, 15 Feb 2016 07:47:58 -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 S1752299AbcBOPrz (ORCPT + 30 others); Mon, 15 Feb 2016 10:47:55 -0500 Received: from mout.kundenserver.de ([212.227.126.187]:58330 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752249AbcBOPrw (ORCPT ); Mon, 15 Feb 2016 10:47:52 -0500 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue002) with ESMTPA (Nemesis) id 0MMbDq-1adaRI3cq6-008GEP; Mon, 15 Feb 2016 16:47: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 Subject: [PATCH 2/4] gpio: ks8695: remove irq_to_gpio function Date: Mon, 15 Feb 2016 16:46:29 +0100 Message-Id: <1455551208-2825510-3-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1455551208-2825510-1-git-send-email-arnd@arndb.de> References: <20160202194831.10827.63244.stgit@bhelgaas-glaptop2.roam.corp.google.com> <1455551208-2825510-1-git-send-email-arnd@arndb.de> X-Provags-ID: V03:K0:57ep3KUDiX/gZ24wnWpklsCTou+6wqIdHI/neJTADQpf0+glKzd zHs2hf9eFTvkI4ZD9HNu4pSuzoamE7w1wAtItk3CxtB5ohOA2YaZAW/jYJWcmRHuHkfrgIW ehoEuNmQyQturOJQX23T7YM8ajNibqfsI/WLZKYtUOd8wcndXXv1wipJVxOiDsMgv18+DRc NRVpXOL8i64hGfBCraxgA== X-UI-Out-Filterresults: notjunk:1; V01:K0:MsWO3qJiMbk=:wgVqiq1yBluP5iEKG1P98T Enn5m+ghqNcwntqOcBG0SIwXYGogOnxHJNFxNe0Ini8NQ7LkA+re/opBb8bah0t0FNdFN3B0X P85Sz+k3YyaHOg97YJT7Fi+Un9++Htjmo2M7fI1LB48uzWSPtAxLsL6nMnK2xz2ekY46z0sQd sYoIxjUppCQHXjk2JRYKgvM8+j3bkxRl/RxkDW0fxFezuLeI6LA0n33EgV3Owahj3nFR0J2j4 /f1B8l7XbvwuMtJJfPGANm23YJE7UNTB6R+Y+fzCIVCySmjAqlpdtWQ6Q8pOXhq+OKfYJvMVe xWuK+sTav/HnI4c0m2+nNVFj7fMT1XqGVB43Pjtd/qqPQT5NAuLoVWnnPpLQn3jvWZhbOEXaO lYITNW7mTwmJG0AHX586SPzuCX/c3PTUA2M5LF8cWXwASmPYdtteeaIwP97tx8v3JzfW/IWLV Y8snw/UzPvVGPYdmdg7onkSPGBy8vhgYHpJVQjB+4U1tbAZ3NbN0jgOKZXJgh1L+d8ysLUFYg Ac/5lc5uF/waLdRcRHFe9yNpZxpXMSGd7V9pySmavRJxBxUFQPbjHY70u/qF+jx4mrYiPmbcv aKBu36mKbFiLw84r2+SPQNQXl5+/rYc8Qi1rk86ufFf5zXXgiiBFH5QQSIA1blnpvzAMJi+Pr wsHryk89AtZvcO5E0f0JxR2bN05caAo1lJY5G+sQsl7fnjgsjTrd0xqE1APexfs0wphg= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The ks8695 gpio driver has its own copy of the irq_to_gpio() function. This is completely unused in the mainline kernel after we converted all remaining users several years ago, so we can remove the definition as well. Signed-off-by: Arnd Bergmann --- drivers/gpio/gpio-ks8695.c | 12 ------------ 1 file changed, 12 deletions(-) -- 2.7.0 diff --git a/drivers/gpio/gpio-ks8695.c b/drivers/gpio/gpio-ks8695.c index 9f86ed9c753b..179723d02f55 100644 --- a/drivers/gpio/gpio-ks8695.c +++ b/drivers/gpio/gpio-ks8695.c @@ -205,18 +205,6 @@ static int ks8695_gpio_to_irq(struct gpio_chip *gc, unsigned int pin) return gpio_irq[pin]; } -/* - * Map IRQ number to GPIO line. - */ -int irq_to_gpio(unsigned int irq) -{ - if ((irq < KS8695_IRQ_EXTERN0) || (irq > KS8695_IRQ_EXTERN3)) - return -EINVAL; - - return (irq - KS8695_IRQ_EXTERN0); -} -EXPORT_SYMBOL(irq_to_gpio); - /* GPIOLIB interface */ static struct gpio_chip ks8695_gpio_chip = { From patchwork Mon Feb 15 15:46:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 102781 Delivered-To: patch@linaro.org Received: by 10.112.43.199 with SMTP id y7csp1142375lbl; Mon, 15 Feb 2016 07:48:07 -0800 (PST) X-Received: by 10.98.8.200 with SMTP id 69mr24936656pfi.39.1455551287803; Mon, 15 Feb 2016 07:48:07 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e3si44075642pas.149.2016.02.15.07.48.07; Mon, 15 Feb 2016 07:48:07 -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 S1752334AbcBOPsC (ORCPT + 30 others); Mon, 15 Feb 2016 10:48:02 -0500 Received: from mout.kundenserver.de ([212.227.126.130]:56983 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752300AbcBOPr4 (ORCPT ); Mon, 15 Feb 2016 10:47:56 -0500 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue002) with ESMTPA (Nemesis) id 0MH9BC-1aj2Uv3OWg-00Dn3x; Mon, 15 Feb 2016 16:47:27 +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 Subject: [PATCH 3/4] gpio: ep93xx: remove private irq_to_gpio function Date: Mon, 15 Feb 2016 16:46:30 +0100 Message-Id: <1455551208-2825510-4-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1455551208-2825510-1-git-send-email-arnd@arndb.de> References: <20160202194831.10827.63244.stgit@bhelgaas-glaptop2.roam.corp.google.com> <1455551208-2825510-1-git-send-email-arnd@arndb.de> X-Provags-ID: V03:K0:GHe8QSrcI1EmfM24Th5WYjUnEjsUxGYvOCCTrNSTYTWq2Paw5gb UytmNbVms9w5p9ntK9ftJwL5UGfHmc86gNhy25f1bVKoM9rEAxKLLZWx2reHyBDpaN72SyS m6OyMwld+ZYf8Tfp+2IRIlCEpsr3oRyJnSRabLgVOA18pKbQzaglakO2xoaTVMvYKPsy9KR flOG0d4Y/6noJ3TATldOA== X-UI-Out-Filterresults: notjunk:1; V01:K0:PntlPy42DDY=:lmVRbP31baSSq7+ay1N7BG zdv/qTs+x64JFu/NsHTgznMQzUFu97SrWaXcfFc/iBEYzHOaew9wDlITyeQ/O6SGdDAINE1Jj zlGV3FrKijYEtrfnfWSC9yxHc8AiYdRT1wPM/E4h+9iKIV3Po8bH6HAPW8S0srRPw84foM/UK 3IJCFKY1n1Te3ug3vBE7PBJuwU+x6DvMVhnnfjPWzT6XZ9JP0TzRe+XLrwa9uzPEAy3HiRATu IZVbRLjC3eZvGWMkkj6/61MLx/EiIqWGtkmHoBeL7IiWOCeHlEKDeC6jMQ/i63T4mOxdX8XpJ MDkQ6X/xBNalrJBYeBp9OPNeYt9k0KeF/PkA8mFxCyFDXgOpeiRZQqoJcAGlj4DuK+Qsnt/4R g8q2FuVlH292CODVbuqcosAD2NdEEXUmYYy1648jFJqf6C7YboniJtcHvK15pVDCL4VkomHAl btocmdtezzCwtjW9d7yDQcDtcq+YQv7z5j/1XN9kP9/I5fR98UmQM3webVyuRaGCUKv+dq1Ep yO3CJMdJGXcJusMu7aEkqROr0DaTXySHJsAJjqGJPpxY9aBTRmhyV5k4KxuTX7VyfreNnVQhl qLZpuU9r97OiQc+sATvRrEp1ERUgkoxUSlTfUds/AG4yNV1EZQFtTpavhHs+pAR36RNZYKw1t 1sXKGdXGxDYFTQ7n6C6OhUp2A1W+aaDa0iFoeUG37tx5q4X5yMVuo6qAPx5FY3qqfKRQ= 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 Mon Feb 15 15:46:31 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 102780 Delivered-To: patch@linaro.org Received: by 10.112.43.199 with SMTP id y7csp1142536lbl; Mon, 15 Feb 2016 07:48:27 -0800 (PST) X-Received: by 10.66.63.67 with SMTP id e3mr23665203pas.141.1455551307826; Mon, 15 Feb 2016 07:48:27 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id kw7si29517465pab.74.2016.02.15.07.48.27; Mon, 15 Feb 2016 07:48:27 -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 S1752460AbcBOPsY (ORCPT + 30 others); Mon, 15 Feb 2016 10:48:24 -0500 Received: from mout.kundenserver.de ([212.227.126.131]:63690 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752400AbcBOPsV (ORCPT ); Mon, 15 Feb 2016 10:48:21 -0500 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue002) with ESMTPA (Nemesis) id 0Lst7y-1ZprZ92QdW-012cSf; Mon, 15 Feb 2016 16:47:49 +0100 From: Arnd Bergmann To: Linus Walleij , Russell King 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, linux-arch@vger.kernel.org Subject: [PATCH 4/4] ARM: remove asm/gpio.h Date: Mon, 15 Feb 2016 16:46:31 +0100 Message-Id: <1455551208-2825510-5-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1455551208-2825510-1-git-send-email-arnd@arndb.de> References: <20160202194831.10827.63244.stgit@bhelgaas-glaptop2.roam.corp.google.com> <1455551208-2825510-1-git-send-email-arnd@arndb.de> X-Provags-ID: V03:K0:FHAaXw0GrACqHV1trk+vjzrToeNpKZGpydevbObAKFN9Ynakazm q+3RRyEUPjEgzj+3oBIdyI4SzgK1b1BJdDlYaqFh1PWvOu2UHV5QU2DslBmEAsfZBijY2eI mcdMHVDT+ZBNOpo4zOJHFYWFGJr2bGqZvjm6EhiqLRgJfKBFG06hly9JKswLzVeQTFX4vAk CHY6SyiqdnIJpm2tidFsA== X-UI-Out-Filterresults: notjunk:1; V01:K0:8y6EeCKOpiU=:8uLZMDykrYc96rM0FPgmIl lP3HpiVD9zISLV4gfzY7mEF6gmj1FBxqd/bjyJ0MZEA+rSaAHOhzRSXXKBm1uUHlrY6X9KJSG Fp5SRCdN+nnB3eCkbLnYrNHw4VL2EddHBEs+it+7WrR3F0TaW3FCc0C22Fx6ZegpQgnStGB07 M2voFQ2aKXzWXXOjwYzhsuQjKVezORDYOyfTZFW7rHoqcEtAoVJAaWDT9LqSYRcMkj/ORP6iP SiehyHPt526RsK7vUQp2t0hPsrSZ1sXnQccnOC1sivWHKRFF86JdHON/vQvgXSz+Nhjg18Giy 5ceXtuqOinau97rWe+pFV2YeHKUHvGwEWD8ODr760/mlPZBkHf9Ujd1gHzM9zRqxBIRmH2eK7 0anhmj+iuG9d48od7pJwD9yH8EwGda0qh9x7B2Li3RNbin0cx/bXphqvD5QfjY/z6DjmUcwcB 5X5t0E1L1v6D1SlBOtwe85MY+AB9OiwOsUfTdOirbo3EpQtTaNCykAySkhOG5K09xZVDd+XpJ lpisaJNEu1ueBlkFVvt2+xDxQKjWiJh/cgxXM1wpOWFCzzO0nxa9TBbxq6qMqS5AizD69PL7D cMdNKL+ZJi9+XtzAZ5pp2CIlxGBoIk7Ao4SC4ryrOD44BJf1ese1pUmUd4lw7rXu467M+4h3X RGW8qHyLNiGkJVTNa1pyQAKPQmkBzFWg2hBn+hz5QTJcP+muiqRTdWwkIqfPXYqwoQac= 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, and removes the ARM version at the same time. This patch depends on a series done by Bjorn Helgaas, and the patch removing irq_to_gpio(). Signed-off-by: Arnd Bergmann --- arch/arm/Kconfig | 1 - arch/arm/include/asm/gpio.h | 25 ------------------------- include/asm-generic/gpio.h | 4 ++++ 3 files changed, 4 insertions(+), 26 deletions(-) delete mode 100644 arch/arm/include/asm/gpio.h -- 2.7.0 diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 0366ad63e2ed..27aefbe43eea 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -5,7 +5,6 @@ config ARM select ARCH_HAS_DEVMEM_IS_ALLOWED select ARCH_HAS_ELF_RANDOMIZE select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST - select ARCH_HAVE_CUSTOM_GPIO_H select ARCH_HAS_GCOV_PROFILE_ALL select ARCH_MIGHT_HAVE_PC_PARPORT select ARCH_SUPPORTS_ATOMIC_RMW diff --git a/arch/arm/include/asm/gpio.h b/arch/arm/include/asm/gpio.h deleted file mode 100644 index 504dcddebfcc..000000000000 --- a/arch/arm/include/asm/gpio.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef _ARCH_ARM_GPIO_H -#define _ARCH_ARM_GPIO_H - -#if CONFIG_ARCH_NR_GPIO > 0 -#define ARCH_NR_GPIOS CONFIG_ARCH_NR_GPIO -#endif - -/* Note: this may rely upon the value of ARCH_NR_GPIOS set in mach/gpio.h */ -#include - -/* The trivial gpiolib dispatchers */ -#define gpio_get_value __gpio_get_value -#define gpio_set_value __gpio_set_value -#define gpio_cansleep __gpio_cansleep - -/* - * Provide a default gpio_to_irq() which should satisfy every case. - * However, some platforms want to do this differently, so allow them - * to override it. - */ -#ifndef gpio_to_irq -#define gpio_to_irq __gpio_to_irq -#endif - -#endif /* _ARCH_ARM_GPIO_H */ diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h index 40ec1433f05d..2d04b321db13 100644 --- a/include/asm-generic/gpio.h +++ b/include/asm-generic/gpio.h @@ -26,8 +26,12 @@ */ #ifndef ARCH_NR_GPIOS +#ifdef CONFIG_ARCH_NR_GPIO +#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