From: Arnd Bergmann <arnd@kernel.org>
To: linux-gpio@vger.kernel.org
Cc: Arnd Bergmann <arnd@arndb.de>,
Linus Walleij <linus.walleij@linaro.org>,
Bartosz Golaszewski <brgl@bgdev.pl>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Geert Uytterhoeven <geert+renesas@glider.be>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, Fu Wei <tekkamanninja@gmail.com>,
Alex Shi <alexs@kernel.org>, Hu Haowen <src.res@email.cn>,
linux-doc-tw-discuss@lists.sourceforge.net
Subject: [PATCH v2 1/8] gpiolib: remove irq_to_gpio() definition
Date: Tue, 9 Nov 2021 11:02:00 +0100 [thread overview]
Message-ID: <20211109100207.2474024-2-arnd@kernel.org> (raw)
In-Reply-To: <20211109100207.2474024-1-arnd@kernel.org>
From: Arnd Bergmann <arnd@arndb.de>
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.
Cc: Fu Wei <tekkamanninja@gmail.com>
Cc: Alex Shi <alexs@kernel.org>
Cc: Hu Haowen <src.res@email.cn>
Cc: linux-doc-tw-discuss@lists.sourceforge.net
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
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
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2021-11-09 10:05 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-09 10:01 [PATCH v2 0/8] gpiolib header cleanup Arnd Bergmann
2021-11-09 10:02 ` Arnd Bergmann [this message]
2021-11-09 10:02 ` [PATCH v2 2/8] gpiolib: remove empty asm/gpio.h files Arnd Bergmann
2021-11-09 10:02 ` [PATCH v2 3/8] gpiolib: coldfire: remove custom asm/gpio.h Arnd Bergmann
2021-11-09 10:02 ` [PATCH v2 4/8] gpiolib: remove asm-generic/gpio.h Arnd Bergmann
2021-11-09 10:19 ` Andy Shevchenko
2021-11-09 10:02 ` [PATCH v2 5/8] gpiolib: shrink further Arnd Bergmann
2021-11-09 10:24 ` Andy Shevchenko
2021-11-09 11:18 ` Arnd Bergmann
2021-11-09 22:17 ` Linus Walleij
2021-11-10 12:39 ` Arnd Bergmann
2021-11-09 10:02 ` [PATCH v2 6/8] gpiolib: remove legacy gpio_export Arnd Bergmann
2021-11-09 10:30 ` Andy Shevchenko
2021-11-09 10:50 ` Arnd Bergmann
2021-11-09 20:42 ` Linus Walleij
2021-11-09 22:46 ` Arnd Bergmann
2021-11-10 0:03 ` Linus Walleij
2021-11-09 20:33 ` Linus Walleij
2021-11-09 10:02 ` [PATCH v2 7/8] gpiolib: remove gpio_to_chip Arnd Bergmann
2021-11-09 10:32 ` Andy Shevchenko
2021-11-09 10:54 ` Arnd Bergmann
2021-11-09 10:02 ` [PATCH v2 8/8] gpiolib: split linux/gpio/driver.h out of linux/gpio.h Arnd Bergmann
2021-11-09 10:34 ` Andy Shevchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211109100207.2474024-2-arnd@kernel.org \
--to=arnd@kernel.org \
--cc=alexs@kernel.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=arnd@arndb.de \
--cc=brgl@bgdev.pl \
--cc=geert+renesas@glider.be \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-doc-tw-discuss@lists.sourceforge.net \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=src.res@email.cn \
--cc=tekkamanninja@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).