* [PATCH v1 1/7] ARM: pxa: spitz: Open code gpio_request_one()
2026-07-15 18:46 [PATCH v1 0/7] gpiolib: kill gpio_request_one() Andy Shevchenko
@ 2026-07-15 18:46 ` Andy Shevchenko
2026-07-15 18:46 ` [PATCH v1 2/7] media: em28xx: Split em28xx_pctv_290e_set_lna_gpio() helper Andy Shevchenko
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Andy Shevchenko @ 2026-07-15 18:46 UTC (permalink / raw)
To: Andy Shevchenko, Bradford Love, linux-gpio, linux-doc,
linux-kernel, linux-arm-kernel, linux-mips, linux-media
Cc: Linus Walleij, Bartosz Golaszewski, Jonathan Corbet, Shuah Khan,
Daniel Mack, Haojian Zhuang, Robert Jarzmik, Russell King,
Hauke Mehrtens, Rafał Miłecki, Thomas Bogendoerfer,
Mauro Carvalho Chehab
Open code the gpio_request_one() call to be able to kill that API
in the follow changes.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
arch/arm/mach-pxa/spitz_pm.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/arm/mach-pxa/spitz_pm.c b/arch/arm/mach-pxa/spitz_pm.c
index 03b4b347f11a..f46a3fb7e07c 100644
--- a/arch/arm/mach-pxa/spitz_pm.c
+++ b/arch/arm/mach-pxa/spitz_pm.c
@@ -108,7 +108,8 @@ static void spitz_presuspend(void)
PGSR2 |= GPIO_bit(SPITZ_GPIO_KEY_STROBE0);
pxa2xx_mfp_config(&gpio18_config, 1);
- gpio_request_one(18, GPIOF_OUT_INIT_HIGH, "Unknown");
+ gpio_request(18, "Unknown");
+ gpio_direction_output(18, 1);
gpio_free(18);
PRER = GPIO_bit(SPITZ_GPIO_KEY_INT);
--
2.50.1
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH v1 2/7] media: em28xx: Split em28xx_pctv_290e_set_lna_gpio() helper
2026-07-15 18:46 [PATCH v1 0/7] gpiolib: kill gpio_request_one() Andy Shevchenko
2026-07-15 18:46 ` [PATCH v1 1/7] ARM: pxa: spitz: Open code gpio_request_one() Andy Shevchenko
@ 2026-07-15 18:46 ` Andy Shevchenko
2026-07-15 18:46 ` [PATCH v1 3/7] media: em28xx: Open code gpio_request_one() Andy Shevchenko
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Andy Shevchenko @ 2026-07-15 18:46 UTC (permalink / raw)
To: Andy Shevchenko, Bradford Love, linux-gpio, linux-doc,
linux-kernel, linux-arm-kernel, linux-mips, linux-media
Cc: Linus Walleij, Bartosz Golaszewski, Jonathan Corbet, Shuah Khan,
Daniel Mack, Haojian Zhuang, Robert Jarzmik, Russell King,
Hauke Mehrtens, Rafał Miłecki, Thomas Bogendoerfer,
Mauro Carvalho Chehab
Split em28xx_pctv_290e_set_lna_gpio() helper in order to deduplicate
the GPIO request and setting.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/media/usb/em28xx/em28xx-dvb.c | 31 ++++++++++++---------------
1 file changed, 14 insertions(+), 17 deletions(-)
diff --git a/drivers/media/usb/em28xx/em28xx-dvb.c b/drivers/media/usb/em28xx/em28xx-dvb.c
index 8482fc4045ea..ef148a27c94d 100644
--- a/drivers/media/usb/em28xx/em28xx-dvb.c
+++ b/drivers/media/usb/em28xx/em28xx-dvb.c
@@ -737,17 +737,14 @@ static void pctv_520e_init(struct em28xx *dev)
regs[i].r, regs[i].len);
};
-static int em28xx_pctv_290e_set_lna(struct dvb_frontend *fe)
+static int em28xx_pctv_290e_set_lna_gpio(struct em28xx *dev, u32 lna)
{
- struct dtv_frontend_properties *c = &fe->dtv_property_cache;
- struct em28xx_i2c_bus *i2c_bus = fe->dvb->priv;
- struct em28xx *dev = i2c_bus->dev;
#ifdef CONFIG_GPIOLIB_LEGACY
struct em28xx_dvb *dvb = dev->dvb;
int ret;
unsigned long flags;
- if (c->lna == 1)
+ if (lna == 1)
flags = GPIOF_OUT_INIT_HIGH; /* enable LNA */
else
flags = GPIOF_OUT_INIT_LOW; /* disable LNA */
@@ -761,11 +758,20 @@ static int em28xx_pctv_290e_set_lna(struct dvb_frontend *fe)
return ret;
#else
dev_warn(&dev->intf->dev, "%s: LNA control is disabled (lna=%u)\n",
- KBUILD_MODNAME, c->lna);
+ KBUILD_MODNAME, lna);
return 0;
#endif
}
+static int em28xx_pctv_290e_set_lna(struct dvb_frontend *fe)
+{
+ struct dtv_frontend_properties *c = &fe->dtv_property_cache;
+ struct em28xx_i2c_bus *i2c_bus = fe->dvb->priv;
+ struct em28xx *dev = i2c_bus->dev;
+
+ return em28xx_pctv_290e_set_lna_gpio(dev, c->lna);
+}
+
static int em28xx_pctv_292e_set_lna(struct dvb_frontend *fe)
{
struct dtv_frontend_properties *c = &fe->dtv_property_cache;
@@ -1920,19 +1926,10 @@ static int em28xx_dvb_init(struct em28xx *dev)
goto out_free;
}
-#ifdef CONFIG_GPIOLIB_LEGACY
/* enable LNA for DVB-T, DVB-T2 and DVB-C */
- result = gpio_request_one(dvb->lna_gpio,
- GPIOF_OUT_INIT_LOW, NULL);
- if (result)
- dev_err(&dev->intf->dev,
- "gpio request failed %d\n",
- result);
- else
- gpio_free(dvb->lna_gpio);
+ em28xx_pctv_290e_set_lna_gpio(dev, 0);
- result = 0; /* continue even set LNA fails */
-#endif
+ /* continue even set LNA fails */
dvb->fe[0]->ops.set_lna = em28xx_pctv_290e_set_lna;
}
--
2.50.1
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH v1 3/7] media: em28xx: Open code gpio_request_one()
2026-07-15 18:46 [PATCH v1 0/7] gpiolib: kill gpio_request_one() Andy Shevchenko
2026-07-15 18:46 ` [PATCH v1 1/7] ARM: pxa: spitz: Open code gpio_request_one() Andy Shevchenko
2026-07-15 18:46 ` [PATCH v1 2/7] media: em28xx: Split em28xx_pctv_290e_set_lna_gpio() helper Andy Shevchenko
@ 2026-07-15 18:46 ` Andy Shevchenko
2026-07-15 18:46 ` [PATCH v1 4/7] MIPS: BCM47XX: " Andy Shevchenko
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Andy Shevchenko @ 2026-07-15 18:46 UTC (permalink / raw)
To: Andy Shevchenko, Bradford Love, linux-gpio, linux-doc,
linux-kernel, linux-arm-kernel, linux-mips, linux-media
Cc: Linus Walleij, Bartosz Golaszewski, Jonathan Corbet, Shuah Khan,
Daniel Mack, Haojian Zhuang, Robert Jarzmik, Russell King,
Hauke Mehrtens, Rafał Miłecki, Thomas Bogendoerfer,
Mauro Carvalho Chehab
Open code the gpio_request_one() call to be able to kill that API
in the follow changes.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/media/usb/em28xx/em28xx-dvb.c | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
diff --git a/drivers/media/usb/em28xx/em28xx-dvb.c b/drivers/media/usb/em28xx/em28xx-dvb.c
index ef148a27c94d..d7f8dcf27900 100644
--- a/drivers/media/usb/em28xx/em28xx-dvb.c
+++ b/drivers/media/usb/em28xx/em28xx-dvb.c
@@ -742,18 +742,14 @@ static int em28xx_pctv_290e_set_lna_gpio(struct em28xx *dev, u32 lna)
#ifdef CONFIG_GPIOLIB_LEGACY
struct em28xx_dvb *dvb = dev->dvb;
int ret;
- unsigned long flags;
- if (lna == 1)
- flags = GPIOF_OUT_INIT_HIGH; /* enable LNA */
- else
- flags = GPIOF_OUT_INIT_LOW; /* disable LNA */
-
- ret = gpio_request_one(dvb->lna_gpio, flags, NULL);
- if (ret)
+ ret = gpio_request(dvb->lna_gpio, NULL);
+ if (ret) {
dev_err(&dev->intf->dev, "gpio request failed %d\n", ret);
- else
+ } else {
+ gpio_direction_output(dvb->lna_gpio, !!(lna == 1));
gpio_free(dvb->lna_gpio);
+ }
return ret;
#else
--
2.50.1
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH v1 4/7] MIPS: BCM47XX: Open code gpio_request_one()
2026-07-15 18:46 [PATCH v1 0/7] gpiolib: kill gpio_request_one() Andy Shevchenko
` (2 preceding siblings ...)
2026-07-15 18:46 ` [PATCH v1 3/7] media: em28xx: Open code gpio_request_one() Andy Shevchenko
@ 2026-07-15 18:46 ` Andy Shevchenko
2026-07-15 18:46 ` [PATCH v1 5/7] MIPS: BCM63XX: Remove one time use ephy_reset_gpio_flags Andy Shevchenko
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Andy Shevchenko @ 2026-07-15 18:46 UTC (permalink / raw)
To: Andy Shevchenko, Bradford Love, linux-gpio, linux-doc,
linux-kernel, linux-arm-kernel, linux-mips, linux-media
Cc: Linus Walleij, Bartosz Golaszewski, Jonathan Corbet, Shuah Khan,
Daniel Mack, Haojian Zhuang, Robert Jarzmik, Russell King,
Hauke Mehrtens, Rafał Miłecki, Thomas Bogendoerfer,
Mauro Carvalho Chehab
Open code the gpio_request_one() call to be able to kill that API
in the follow changes.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
arch/mips/bcm47xx/workarounds.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/arch/mips/bcm47xx/workarounds.c b/arch/mips/bcm47xx/workarounds.c
index 745c6228eb2c..9148d2c219d1 100644
--- a/arch/mips/bcm47xx/workarounds.c
+++ b/arch/mips/bcm47xx/workarounds.c
@@ -9,11 +9,13 @@ static void __init bcm47xx_workarounds_enable_usb_power(int usb_power)
{
int err;
- err = gpio_request_one(usb_power, GPIOF_OUT_INIT_HIGH, "usb_power");
- if (err)
+ err = gpio_request(usb_power, "usb_power");
+ if (err) {
pr_err("Failed to request USB power gpio: %d\n", err);
- else
+ } else {
+ gpio_direction_output(usb_power, 1);
gpio_free(usb_power);
+ }
}
void __init bcm47xx_workarounds(void)
--
2.50.1
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH v1 5/7] MIPS: BCM63XX: Remove one time use ephy_reset_gpio_flags
2026-07-15 18:46 [PATCH v1 0/7] gpiolib: kill gpio_request_one() Andy Shevchenko
` (3 preceding siblings ...)
2026-07-15 18:46 ` [PATCH v1 4/7] MIPS: BCM47XX: " Andy Shevchenko
@ 2026-07-15 18:46 ` Andy Shevchenko
2026-07-15 18:46 ` [PATCH v1 6/7] MIPS: BCM63XX: Open code gpio_request_one() Andy Shevchenko
2026-07-15 18:46 ` [PATCH v1 7/7] gpiolib: Get rid of not used anymore gpio_request_one() Andy Shevchenko
6 siblings, 0 replies; 8+ messages in thread
From: Andy Shevchenko @ 2026-07-15 18:46 UTC (permalink / raw)
To: Andy Shevchenko, Bradford Love, linux-gpio, linux-doc,
linux-kernel, linux-arm-kernel, linux-mips, linux-media
Cc: Linus Walleij, Bartosz Golaszewski, Jonathan Corbet, Shuah Khan,
Daniel Mack, Haojian Zhuang, Robert Jarzmik, Russell King,
Hauke Mehrtens, Rafał Miłecki, Thomas Bogendoerfer,
Mauro Carvalho Chehab
ephy_reset_gpio_flags exists solely to supply polarity to the reset GPIO.
But in practice it's kept all the same and currently only a single user
present. Drop the member and use hard coded GPIO flags instead.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
arch/mips/bcm63xx/boards/board_bcm963xx.c | 7 +++----
arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h | 3 ---
2 files changed, 3 insertions(+), 7 deletions(-)
diff --git a/arch/mips/bcm63xx/boards/board_bcm963xx.c b/arch/mips/bcm63xx/boards/board_bcm963xx.c
index c5617b889b1c..57e916c06792 100644
--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
@@ -42,7 +42,7 @@ static struct board_info __initdata board_cvg834g = {
.expected_cpu_id = 0x3368,
.ephy_reset_gpio = 36,
- .ephy_reset_gpio_flags = GPIOF_OUT_INIT_HIGH,
+
.has_pci = 1,
.has_uart0 = 1,
.has_uart1 = 1,
@@ -903,9 +903,8 @@ int __init board_register_devices(void)
platform_device_register(&bcm63xx_gpio_leds);
- if (board.ephy_reset_gpio && board.ephy_reset_gpio_flags)
- gpio_request_one(board.ephy_reset_gpio,
- board.ephy_reset_gpio_flags, "ephy-reset");
+ if (board.ephy_reset_gpio)
+ gpio_request_one(board.ephy_reset_gpio, GPIOF_OUT_INIT_HIGH, "ephy-reset");
return 0;
}
diff --git a/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h b/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
index 830f53f28e3f..018a56cbc328 100644
--- a/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
+++ b/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
@@ -46,9 +46,6 @@ struct board_info {
/* External PHY reset GPIO */
unsigned int ephy_reset_gpio;
-
- /* External PHY reset GPIO flags from gpio.h */
- unsigned long ephy_reset_gpio_flags;
};
#endif /* ! BOARD_BCM963XX_H_ */
--
2.50.1
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH v1 6/7] MIPS: BCM63XX: Open code gpio_request_one()
2026-07-15 18:46 [PATCH v1 0/7] gpiolib: kill gpio_request_one() Andy Shevchenko
` (4 preceding siblings ...)
2026-07-15 18:46 ` [PATCH v1 5/7] MIPS: BCM63XX: Remove one time use ephy_reset_gpio_flags Andy Shevchenko
@ 2026-07-15 18:46 ` Andy Shevchenko
2026-07-15 18:46 ` [PATCH v1 7/7] gpiolib: Get rid of not used anymore gpio_request_one() Andy Shevchenko
6 siblings, 0 replies; 8+ messages in thread
From: Andy Shevchenko @ 2026-07-15 18:46 UTC (permalink / raw)
To: Andy Shevchenko, Bradford Love, linux-gpio, linux-doc,
linux-kernel, linux-arm-kernel, linux-mips, linux-media
Cc: Linus Walleij, Bartosz Golaszewski, Jonathan Corbet, Shuah Khan,
Daniel Mack, Haojian Zhuang, Robert Jarzmik, Russell King,
Hauke Mehrtens, Rafał Miłecki, Thomas Bogendoerfer,
Mauro Carvalho Chehab
Open code the gpio_request_one() call to be able to kill that API
in the follow changes.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
arch/mips/bcm63xx/boards/board_bcm963xx.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/arch/mips/bcm63xx/boards/board_bcm963xx.c b/arch/mips/bcm63xx/boards/board_bcm963xx.c
index 57e916c06792..993341604439 100644
--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
@@ -903,8 +903,11 @@ int __init board_register_devices(void)
platform_device_register(&bcm63xx_gpio_leds);
- if (board.ephy_reset_gpio)
- gpio_request_one(board.ephy_reset_gpio, GPIOF_OUT_INIT_HIGH, "ephy-reset");
+ if (board.ephy_reset_gpio) {
+ gpio_request(board.ephy_reset_gpio, "ephy-reset");
+ gpio_direction_output(board.ephy_reset_gpio, 1);
+ gpio_free(board.ephy_reset_gpio);
+ }
return 0;
}
--
2.50.1
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH v1 7/7] gpiolib: Get rid of not used anymore gpio_request_one()
2026-07-15 18:46 [PATCH v1 0/7] gpiolib: kill gpio_request_one() Andy Shevchenko
` (5 preceding siblings ...)
2026-07-15 18:46 ` [PATCH v1 6/7] MIPS: BCM63XX: Open code gpio_request_one() Andy Shevchenko
@ 2026-07-15 18:46 ` Andy Shevchenko
6 siblings, 0 replies; 8+ messages in thread
From: Andy Shevchenko @ 2026-07-15 18:46 UTC (permalink / raw)
To: Andy Shevchenko, Bradford Love, linux-gpio, linux-doc,
linux-kernel, linux-arm-kernel, linux-mips, linux-media
Cc: Linus Walleij, Bartosz Golaszewski, Jonathan Corbet, Shuah Khan,
Daniel Mack, Haojian Zhuang, Robert Jarzmik, Russell King,
Hauke Mehrtens, Rafał Miłecki, Thomas Bogendoerfer,
Mauro Carvalho Chehab
No more users.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
Documentation/driver-api/gpio/consumer.rst | 2 +-
drivers/gpio/gpiolib-legacy.c | 31 ----------------------
include/linux/gpio/legacy.h | 8 ------
3 files changed, 1 insertion(+), 40 deletions(-)
diff --git a/Documentation/driver-api/gpio/consumer.rst b/Documentation/driver-api/gpio/consumer.rst
index bb3366047fad..03edd9472f07 100644
--- a/Documentation/driver-api/gpio/consumer.rst
+++ b/Documentation/driver-api/gpio/consumer.rst
@@ -463,7 +463,7 @@ and vice-versa::
The GPIO number returned by desc_to_gpio() can safely be used as a parameter of
the gpio\_*() functions for as long as the GPIO descriptor `desc` is not freed.
All the same, a GPIO number passed to gpio_to_desc() must first be properly
-acquired using e.g. gpio_request_one(), and the returned GPIO descriptor is only
+acquired using e.g. gpio_request(), and the returned GPIO descriptor is only
considered valid until that GPIO number is released using gpio_free().
Freeing a GPIO obtained by one API with the other API is forbidden and an
diff --git a/drivers/gpio/gpiolib-legacy.c b/drivers/gpio/gpiolib-legacy.c
index ef3f2ef30cf2..c2b04605b203 100644
--- a/drivers/gpio/gpiolib-legacy.c
+++ b/drivers/gpio/gpiolib-legacy.c
@@ -21,37 +21,6 @@ void gpio_free(unsigned gpio)
}
EXPORT_SYMBOL_GPL(gpio_free);
-/**
- * gpio_request_one - request a single GPIO with initial configuration
- * @gpio: the GPIO number
- * @flags: GPIO configuration as specified by GPIOF_*
- * @label: a literal description string of this GPIO
- *
- * **DEPRECATED** This function is deprecated and must not be used in new code.
- *
- * Returns:
- * 0 on success, or negative errno on failure.
- */
-int gpio_request_one(unsigned gpio, unsigned long flags, const char *label)
-{
- int err;
-
- err = gpio_request(gpio, label);
- if (err)
- return err;
-
- if (flags & GPIOF_IN)
- err = gpio_direction_input(gpio);
- else
- err = gpio_direction_output(gpio, !!(flags & GPIOF_OUT_INIT_HIGH));
-
- if (err)
- gpio_free(gpio);
-
- return err;
-}
-EXPORT_SYMBOL_GPL(gpio_request_one);
-
/*
* **DEPRECATED** This function is deprecated and must not be used in new code.
*/
diff --git a/include/linux/gpio/legacy.h b/include/linux/gpio/legacy.h
index 557ef635935e..d4273162ed13 100644
--- a/include/linux/gpio/legacy.h
+++ b/include/linux/gpio/legacy.h
@@ -82,8 +82,6 @@ static inline int gpio_to_irq(unsigned gpio)
return gpiod_to_irq(gpio_to_desc(gpio));
}
-int gpio_request_one(unsigned gpio, unsigned long flags, const char *label);
-
int devm_gpio_request_one(struct device *dev, unsigned gpio,
unsigned long flags, const char *label);
@@ -104,12 +102,6 @@ static inline int gpio_request(unsigned gpio, const char *label)
return -ENOSYS;
}
-static inline int gpio_request_one(unsigned gpio,
- unsigned long flags, const char *label)
-{
- return -ENOSYS;
-}
-
static inline void gpio_free(unsigned gpio)
{
might_sleep();
--
2.50.1
^ permalink raw reply related [flat|nested] 8+ messages in thread