From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6A1FBC433F5 for ; Fri, 5 Nov 2021 13:23:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 51F676112D for ; Fri, 5 Nov 2021 13:23:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232656AbhKEN0h (ORCPT ); Fri, 5 Nov 2021 09:26:37 -0400 Received: from mga09.intel.com ([134.134.136.24]:31247 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232258AbhKEN0h (ORCPT ); Fri, 5 Nov 2021 09:26:37 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10158"; a="231739591" X-IronPort-AV: E=Sophos;i="5.87,211,1631602800"; d="scan'208";a="231739591" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Nov 2021 06:23:57 -0700 X-IronPort-AV: E=Sophos;i="5.87,211,1631602800"; d="scan'208";a="562026535" Received: from smile.fi.intel.com ([10.237.72.184]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Nov 2021 06:23:53 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.95) (envelope-from ) id 1mizBx-003nhY-0i; Fri, 05 Nov 2021 15:23:37 +0200 Date: Fri, 5 Nov 2021 15:23:36 +0200 From: Andy Shevchenko To: Arnd Bergmann Cc: linux-gpio@vger.kernel.org, Bartosz Golaszewski , Linus Walleij , linux-m68k@lists.linux-m68k.org, geert@linux-m68k.org, gerg@linux-m68k.org, linux@armlinux.org.uk, linux-arm-kernel@lists.infradead.org, linux-sh@vger.kernel.org, dalias@libc.org, ysato@users.sourceforge.jp, Arnd Bergmann , Fu Wei , Alex Shi , Hu Haowen , linux-doc-tw-discuss@lists.sourceforge.net, Jonathan Corbet , Drew Fustini , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [RFC 1/3] gpiolib: remove irq_to_gpio() definition Message-ID: References: <20211105130338.241100-1-arnd@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211105130338.241100-1-arnd@kernel.org> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-doc@vger.kernel.org On Fri, Nov 05, 2021 at 02:03:03PM +0100, Arnd Bergmann wrote: > From: Arnd Bergmann > > All implementations other than coldfire have returned an error since > the avr32 and blackfin architectures got removed, and the last user in > driver code was removed in 2016, so just remove this old interface. > > The only reference is now in the Chinese documentation, which should be > changed to remove this reference as well. FWIW, Reviewed-by: Andy Shevchenko Thanks, Arnd, for cleaning this up! > Cc: Fu Wei > Cc: Alex Shi > Cc: Hu Haowen > Cc: linux-doc-tw-discuss@lists.sourceforge.net > Signed-off-by: Arnd Bergmann > --- > Documentation/driver-api/gpio/legacy.rst | 20 +++++--------------- > arch/m68k/include/asm/gpio.h | 7 ------- > arch/sh/include/asm/gpio.h | 5 ----- > include/linux/gpio.h | 12 ------------ > 4 files changed, 5 insertions(+), 39 deletions(-) > > diff --git a/Documentation/driver-api/gpio/legacy.rst b/Documentation/driver-api/gpio/legacy.rst > index 9b12eeb89170..06c05e2d62c1 100644 > --- a/Documentation/driver-api/gpio/legacy.rst > +++ b/Documentation/driver-api/gpio/legacy.rst > @@ -382,22 +382,18 @@ GPIOs mapped to IRQs > -------------------- > GPIO numbers are unsigned integers; so are IRQ numbers. These make up > two logically distinct namespaces (GPIO 0 need not use IRQ 0). You can > -map between them using calls like:: > +map between them using:: > > /* map GPIO numbers to IRQ numbers */ > int gpio_to_irq(unsigned gpio); > > - /* map IRQ numbers to GPIO numbers (avoid using this) */ > - int irq_to_gpio(unsigned irq); > - > -Those return either the corresponding number in the other namespace, or > +This returns an irq number corresponding to the gpio number, or > else a negative errno code if the mapping can't be done. (For example, > some GPIOs can't be used as IRQs.) It is an unchecked error to use a GPIO > -number that wasn't set up as an input using gpio_direction_input(), or > -to use an IRQ number that didn't originally come from gpio_to_irq(). > +number that wasn't set up as an input using gpio_direction_input(). > > -These two mapping calls are expected to cost on the order of a single > -addition or subtraction. They're not allowed to sleep. > +The mapping call is expected to cost on the order of a single > +addition or subtraction. It is not allowed to sleep. > > Non-error values returned from gpio_to_irq() can be passed to request_irq() > or free_irq(). They will often be stored into IRQ resources for platform > @@ -405,12 +401,6 @@ devices, by the board-specific initialization code. Note that IRQ trigger > options are part of the IRQ interface, e.g. IRQF_TRIGGER_FALLING, as are > system wakeup capabilities. > > -Non-error values returned from irq_to_gpio() would most commonly be used > -with gpio_get_value(), for example to initialize or update driver state > -when the IRQ is edge-triggered. Note that some platforms don't support > -this reverse mapping, so you should avoid using it. > - > - > Emulating Open Drain Signals > ---------------------------- > Sometimes shared signals need to use "open drain" signaling, where only the > diff --git a/arch/m68k/include/asm/gpio.h b/arch/m68k/include/asm/gpio.h > index a50b27719a58..5cfc0996ba94 100644 > --- a/arch/m68k/include/asm/gpio.h > +++ b/arch/m68k/include/asm/gpio.h > @@ -66,13 +66,6 @@ static inline int gpio_to_irq(unsigned gpio) > return __gpio_to_irq(gpio); > } > > -static inline int irq_to_gpio(unsigned irq) > -{ > - return (irq >= MCFGPIO_IRQ_VECBASE && > - irq < (MCFGPIO_IRQ_VECBASE + MCFGPIO_IRQ_MAX)) ? > - irq - MCFGPIO_IRQ_VECBASE : -ENXIO; > -} > - > static inline int gpio_cansleep(unsigned gpio) > { > return gpio < MCFGPIO_PIN_MAX ? 0 : __gpio_cansleep(gpio); > diff --git a/arch/sh/include/asm/gpio.h b/arch/sh/include/asm/gpio.h > index d643250f0a0f..588c1380e4cb 100644 > --- a/arch/sh/include/asm/gpio.h > +++ b/arch/sh/include/asm/gpio.h > @@ -40,11 +40,6 @@ static inline int gpio_to_irq(unsigned gpio) > return __gpio_to_irq(gpio); > } > > -static inline int irq_to_gpio(unsigned int irq) > -{ > - return -ENOSYS; > -} > - > #endif /* CONFIG_GPIOLIB */ > > #endif /* __ASM_SH_GPIO_H */ > diff --git a/include/linux/gpio.h b/include/linux/gpio.h > index 008ad3ee56b7..d8d7daa7eb94 100644 > --- a/include/linux/gpio.h > +++ b/include/linux/gpio.h > @@ -81,11 +81,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 */ > @@ -219,13 +214,6 @@ static inline int gpio_to_irq(unsigned gpio) > return -EINVAL; > } > > -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 devm_gpio_request(struct device *dev, unsigned gpio, > const char *label) > { > -- > 2.29.2 > -- With Best Regards, Andy Shevchenko From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AC137C433EF for ; Fri, 5 Nov 2021 13:25:50 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6DD726112D for ; Fri, 5 Nov 2021 13:25:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 6DD726112D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=n60wsYRdCXQK4/lPogJcTqxQ+4cW3yCrp8kzwR0N0RQ=; b=Nn+rSJWB5cRyJP 6Kyx+oeL1kJNEZkts7fi8zIe0vszmjwdvVD/RjhYsfVDsfXKrIqK6Iju+6+3l16ul4W0sjivwa3z1 hLjFp4t8dTD7NItOsx+aP8u714J2s3oMDiDCJHxCt6a8X9KEem84EnNTTywpKswjoel+u2MWJM+Qx 4hNfKtYA3cvNtm40f0+UuxA8OqFkbq+8DcobUxdBib4zoWNyjYq6Y7Ftl9v2et3nJLM6CGUDlov/c FbYC6MH6R8DN8qC+TDt2xSRaEi7Pf4UiJJSvl5d9GXd20PEPW88cMRXoIfmiTQepFo0920DpMbQNP GMYwhFP1CsweXzAfifyQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mizCL-00BRMj-Uh; Fri, 05 Nov 2021 13:24:02 +0000 Received: from mga01.intel.com ([192.55.52.88]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mizCI-00BRLv-FJ for linux-arm-kernel@lists.infradead.org; Fri, 05 Nov 2021 13:24:00 +0000 X-IronPort-AV: E=McAfee;i="6200,9189,10158"; a="255544475" X-IronPort-AV: E=Sophos;i="5.87,211,1631602800"; d="scan'208";a="255544475" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Nov 2021 06:23:57 -0700 X-IronPort-AV: E=Sophos;i="5.87,211,1631602800"; d="scan'208";a="562026535" Received: from smile.fi.intel.com ([10.237.72.184]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Nov 2021 06:23:53 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.95) (envelope-from ) id 1mizBx-003nhY-0i; Fri, 05 Nov 2021 15:23:37 +0200 Date: Fri, 5 Nov 2021 15:23:36 +0200 From: Andy Shevchenko To: Arnd Bergmann Cc: linux-gpio@vger.kernel.org, Bartosz Golaszewski , Linus Walleij , linux-m68k@lists.linux-m68k.org, geert@linux-m68k.org, gerg@linux-m68k.org, linux@armlinux.org.uk, linux-arm-kernel@lists.infradead.org, linux-sh@vger.kernel.org, dalias@libc.org, ysato@users.sourceforge.jp, Arnd Bergmann , Fu Wei , Alex Shi , Hu Haowen , linux-doc-tw-discuss@lists.sourceforge.net, Jonathan Corbet , Drew Fustini , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [RFC 1/3] gpiolib: remove irq_to_gpio() definition Message-ID: References: <20211105130338.241100-1-arnd@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20211105130338.241100-1-arnd@kernel.org> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211105_062358_617078_62F3D53C X-CRM114-Status: GOOD ( 36.17 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Nov 05, 2021 at 02:03:03PM +0100, Arnd Bergmann wrote: > From: Arnd Bergmann > > All implementations other than coldfire have returned an error since > the avr32 and blackfin architectures got removed, and the last user in > driver code was removed in 2016, so just remove this old interface. > > The only reference is now in the Chinese documentation, which should be > changed to remove this reference as well. FWIW, Reviewed-by: Andy Shevchenko Thanks, Arnd, for cleaning this up! > Cc: Fu Wei > Cc: Alex Shi > Cc: Hu Haowen > Cc: linux-doc-tw-discuss@lists.sourceforge.net > Signed-off-by: Arnd Bergmann > --- > Documentation/driver-api/gpio/legacy.rst | 20 +++++--------------- > arch/m68k/include/asm/gpio.h | 7 ------- > arch/sh/include/asm/gpio.h | 5 ----- > include/linux/gpio.h | 12 ------------ > 4 files changed, 5 insertions(+), 39 deletions(-) > > diff --git a/Documentation/driver-api/gpio/legacy.rst b/Documentation/driver-api/gpio/legacy.rst > index 9b12eeb89170..06c05e2d62c1 100644 > --- a/Documentation/driver-api/gpio/legacy.rst > +++ b/Documentation/driver-api/gpio/legacy.rst > @@ -382,22 +382,18 @@ GPIOs mapped to IRQs > -------------------- > GPIO numbers are unsigned integers; so are IRQ numbers. These make up > two logically distinct namespaces (GPIO 0 need not use IRQ 0). You can > -map between them using calls like:: > +map between them using:: > > /* map GPIO numbers to IRQ numbers */ > int gpio_to_irq(unsigned gpio); > > - /* map IRQ numbers to GPIO numbers (avoid using this) */ > - int irq_to_gpio(unsigned irq); > - > -Those return either the corresponding number in the other namespace, or > +This returns an irq number corresponding to the gpio number, or > else a negative errno code if the mapping can't be done. (For example, > some GPIOs can't be used as IRQs.) It is an unchecked error to use a GPIO > -number that wasn't set up as an input using gpio_direction_input(), or > -to use an IRQ number that didn't originally come from gpio_to_irq(). > +number that wasn't set up as an input using gpio_direction_input(). > > -These two mapping calls are expected to cost on the order of a single > -addition or subtraction. They're not allowed to sleep. > +The mapping call is expected to cost on the order of a single > +addition or subtraction. It is not allowed to sleep. > > Non-error values returned from gpio_to_irq() can be passed to request_irq() > or free_irq(). They will often be stored into IRQ resources for platform > @@ -405,12 +401,6 @@ devices, by the board-specific initialization code. Note that IRQ trigger > options are part of the IRQ interface, e.g. IRQF_TRIGGER_FALLING, as are > system wakeup capabilities. > > -Non-error values returned from irq_to_gpio() would most commonly be used > -with gpio_get_value(), for example to initialize or update driver state > -when the IRQ is edge-triggered. Note that some platforms don't support > -this reverse mapping, so you should avoid using it. > - > - > Emulating Open Drain Signals > ---------------------------- > Sometimes shared signals need to use "open drain" signaling, where only the > diff --git a/arch/m68k/include/asm/gpio.h b/arch/m68k/include/asm/gpio.h > index a50b27719a58..5cfc0996ba94 100644 > --- a/arch/m68k/include/asm/gpio.h > +++ b/arch/m68k/include/asm/gpio.h > @@ -66,13 +66,6 @@ static inline int gpio_to_irq(unsigned gpio) > return __gpio_to_irq(gpio); > } > > -static inline int irq_to_gpio(unsigned irq) > -{ > - return (irq >= MCFGPIO_IRQ_VECBASE && > - irq < (MCFGPIO_IRQ_VECBASE + MCFGPIO_IRQ_MAX)) ? > - irq - MCFGPIO_IRQ_VECBASE : -ENXIO; > -} > - > static inline int gpio_cansleep(unsigned gpio) > { > return gpio < MCFGPIO_PIN_MAX ? 0 : __gpio_cansleep(gpio); > diff --git a/arch/sh/include/asm/gpio.h b/arch/sh/include/asm/gpio.h > index d643250f0a0f..588c1380e4cb 100644 > --- a/arch/sh/include/asm/gpio.h > +++ b/arch/sh/include/asm/gpio.h > @@ -40,11 +40,6 @@ static inline int gpio_to_irq(unsigned gpio) > return __gpio_to_irq(gpio); > } > > -static inline int irq_to_gpio(unsigned int irq) > -{ > - return -ENOSYS; > -} > - > #endif /* CONFIG_GPIOLIB */ > > #endif /* __ASM_SH_GPIO_H */ > diff --git a/include/linux/gpio.h b/include/linux/gpio.h > index 008ad3ee56b7..d8d7daa7eb94 100644 > --- a/include/linux/gpio.h > +++ b/include/linux/gpio.h > @@ -81,11 +81,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 */ > @@ -219,13 +214,6 @@ static inline int gpio_to_irq(unsigned gpio) > return -EINVAL; > } > > -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 devm_gpio_request(struct device *dev, unsigned gpio, > const char *label) > { > -- > 2.29.2 > -- With Best Regards, Andy Shevchenko _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel