linux-doc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 0/2] gpiolib: get rid of devm_gpio_request()
@ 2025-05-31 21:21 Andy Shevchenko
  2025-05-31 21:21 ` [PATCH v1 1/2] usb: gadget: pxa25x_udc: Switch to use devm_gpio_request_one() Andy Shevchenko
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Andy Shevchenko @ 2025-05-31 21:21 UTC (permalink / raw)
  To: Andy Shevchenko, Bartosz Golaszewski, linux-doc, linux-kernel,
	linux-gpio, linux-arm-kernel, linux-usb
  Cc: Jonathan Corbet, Linus Walleij, Bartosz Golaszewski, Daniel Mack,
	Haojian Zhuang, Robert Jarzmik, Greg Kroah-Hartman

devm_gpio_request() is used by a single driver. Replace it there and
kill the legacy API. Assumed to be routed via GPIO tree.

Andy Shevchenko (2):
  usb: gadget: pxa25x_udc: Switch to use devm_gpio_request_one()
  gpiolib: Remove unused devm_gpio_request()

 .../driver-api/driver-model/devres.rst        |  1 -
 drivers/gpio/gpiolib-legacy.c                 | 38 -------------------
 drivers/usb/gadget/udc/pxa25x_udc.c           |  5 +--
 include/linux/gpio.h                          |  8 ----
 4 files changed, 2 insertions(+), 50 deletions(-)

-- 
2.47.2


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v1 1/2] usb: gadget: pxa25x_udc: Switch to use devm_gpio_request_one()
  2025-05-31 21:21 [PATCH v1 0/2] gpiolib: get rid of devm_gpio_request() Andy Shevchenko
@ 2025-05-31 21:21 ` Andy Shevchenko
  2025-06-01  7:37   ` Greg Kroah-Hartman
  2025-05-31 21:21 ` [PATCH v1 2/2] gpiolib: Remove unused devm_gpio_request() Andy Shevchenko
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 6+ messages in thread
From: Andy Shevchenko @ 2025-05-31 21:21 UTC (permalink / raw)
  To: Andy Shevchenko, Bartosz Golaszewski, linux-doc, linux-kernel,
	linux-gpio, linux-arm-kernel, linux-usb
  Cc: Jonathan Corbet, Linus Walleij, Bartosz Golaszewski, Daniel Mack,
	Haojian Zhuang, Robert Jarzmik, Greg Kroah-Hartman

devm_gpio_request() is going to be removed. This driver is only user of that
API. Convert it to use different API.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/usb/gadget/udc/pxa25x_udc.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/gadget/udc/pxa25x_udc.c b/drivers/usb/gadget/udc/pxa25x_udc.c
index 24eb1ae78e45..366abdab095c 100644
--- a/drivers/usb/gadget/udc/pxa25x_udc.c
+++ b/drivers/usb/gadget/udc/pxa25x_udc.c
@@ -2348,15 +2348,14 @@ static int pxa25x_udc_probe(struct platform_device *pdev)
 	dev->transceiver = devm_usb_get_phy(&pdev->dev, USB_PHY_TYPE_USB2);
 
 	if (gpio_is_valid(dev->mach->gpio_pullup)) {
-		retval = devm_gpio_request(&pdev->dev, dev->mach->gpio_pullup,
-					   "pca25x_udc GPIO PULLUP");
+		retval = devm_gpio_request_one(&pdev->dev, dev->mach->gpio_pullup,
+					       GPIOF_OUT_INIT_LOW, "pca25x_udc GPIO PULLUP");
 		if (retval) {
 			dev_dbg(&pdev->dev,
 				"can't get pullup gpio %d, err: %d\n",
 				dev->mach->gpio_pullup, retval);
 			goto err;
 		}
-		gpio_direction_output(dev->mach->gpio_pullup, 0);
 	}
 
 	timer_setup(&dev->timer, udc_watchdog, 0);
-- 
2.47.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v1 2/2] gpiolib: Remove unused devm_gpio_request()
  2025-05-31 21:21 [PATCH v1 0/2] gpiolib: get rid of devm_gpio_request() Andy Shevchenko
  2025-05-31 21:21 ` [PATCH v1 1/2] usb: gadget: pxa25x_udc: Switch to use devm_gpio_request_one() Andy Shevchenko
@ 2025-05-31 21:21 ` Andy Shevchenko
  2025-06-05 13:33 ` [PATCH v1 0/2] gpiolib: get rid of devm_gpio_request() Linus Walleij
  2025-06-10  8:11 ` Bartosz Golaszewski
  3 siblings, 0 replies; 6+ messages in thread
From: Andy Shevchenko @ 2025-05-31 21:21 UTC (permalink / raw)
  To: Andy Shevchenko, Bartosz Golaszewski, linux-doc, linux-kernel,
	linux-gpio, linux-arm-kernel, linux-usb
  Cc: Jonathan Corbet, Linus Walleij, Bartosz Golaszewski, Daniel Mack,
	Haojian Zhuang, Robert Jarzmik, Greg Kroah-Hartman

No users.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 .../driver-api/driver-model/devres.rst        |  1 -
 drivers/gpio/gpiolib-legacy.c                 | 38 -------------------
 include/linux/gpio.h                          |  8 ----
 3 files changed, 47 deletions(-)

diff --git a/Documentation/driver-api/driver-model/devres.rst b/Documentation/driver-api/driver-model/devres.rst
index 3d56f94ac2ee..2b36ebde9cec 100644
--- a/Documentation/driver-api/driver-model/devres.rst
+++ b/Documentation/driver-api/driver-model/devres.rst
@@ -275,7 +275,6 @@ GPIO
   devm_gpiod_put()
   devm_gpiod_unhinge()
   devm_gpiochip_add_data()
-  devm_gpio_request()
   devm_gpio_request_one()
 
 I2C
diff --git a/drivers/gpio/gpiolib-legacy.c b/drivers/gpio/gpiolib-legacy.c
index aeae6df8bec9..3bc93ccadb5b 100644
--- a/drivers/gpio/gpiolib-legacy.c
+++ b/drivers/gpio/gpiolib-legacy.c
@@ -85,44 +85,6 @@ static void devm_gpio_release(struct device *dev, void *res)
 	gpio_free(*gpio);
 }
 
-/**
- * devm_gpio_request - request a GPIO for a managed device
- * @dev: device to request the GPIO for
- * @gpio: GPIO to allocate
- * @label: the name of the requested GPIO
- *
- * Except for the extra @dev argument, this function takes the
- * same arguments and performs the same function as gpio_request().
- * GPIOs requested with this function will be automatically freed
- * on driver detach.
- *
- * **DEPRECATED** This function is deprecated and must not be used in new code.
- *
- * Returns:
- * 0 on success, or negative errno on failure.
- */
-int devm_gpio_request(struct device *dev, unsigned gpio, const char *label)
-{
-	unsigned *dr;
-	int rc;
-
-	dr = devres_alloc(devm_gpio_release, sizeof(unsigned), GFP_KERNEL);
-	if (!dr)
-		return -ENOMEM;
-
-	rc = gpio_request(gpio, label);
-	if (rc) {
-		devres_free(dr);
-		return rc;
-	}
-
-	*dr = gpio;
-	devres_add(dev, dr);
-
-	return 0;
-}
-EXPORT_SYMBOL_GPL(devm_gpio_request);
-
 /**
  * devm_gpio_request_one - request a single GPIO with initial setup
  * @dev: device to request for
diff --git a/include/linux/gpio.h b/include/linux/gpio.h
index d105a207eaa2..ff99ed76fdc3 100644
--- a/include/linux/gpio.h
+++ b/include/linux/gpio.h
@@ -85,7 +85,6 @@ static inline int gpio_to_irq(unsigned gpio)
 
 int gpio_request_one(unsigned gpio, unsigned long flags, const char *label);
 
-int devm_gpio_request(struct device *dev, unsigned gpio, const char *label);
 int devm_gpio_request_one(struct device *dev, unsigned gpio,
 			  unsigned long flags, const char *label);
 
@@ -163,13 +162,6 @@ static inline int gpio_to_irq(unsigned gpio)
 	return -EINVAL;
 }
 
-static inline int devm_gpio_request(struct device *dev, unsigned gpio,
-				    const char *label)
-{
-	WARN_ON(1);
-	return -EINVAL;
-}
-
 static inline int devm_gpio_request_one(struct device *dev, unsigned gpio,
 					unsigned long flags, const char *label)
 {
-- 
2.47.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v1 1/2] usb: gadget: pxa25x_udc: Switch to use devm_gpio_request_one()
  2025-05-31 21:21 ` [PATCH v1 1/2] usb: gadget: pxa25x_udc: Switch to use devm_gpio_request_one() Andy Shevchenko
@ 2025-06-01  7:37   ` Greg Kroah-Hartman
  0 siblings, 0 replies; 6+ messages in thread
From: Greg Kroah-Hartman @ 2025-06-01  7:37 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Bartosz Golaszewski, linux-doc, linux-kernel, linux-gpio,
	linux-arm-kernel, linux-usb, Jonathan Corbet, Linus Walleij,
	Bartosz Golaszewski, Daniel Mack, Haojian Zhuang, Robert Jarzmik

On Sun, Jun 01, 2025 at 12:21:38AM +0300, Andy Shevchenko wrote:
> devm_gpio_request() is going to be removed. This driver is only user of that
> API. Convert it to use different API.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/usb/gadget/udc/pxa25x_udc.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)


Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v1 0/2] gpiolib: get rid of devm_gpio_request()
  2025-05-31 21:21 [PATCH v1 0/2] gpiolib: get rid of devm_gpio_request() Andy Shevchenko
  2025-05-31 21:21 ` [PATCH v1 1/2] usb: gadget: pxa25x_udc: Switch to use devm_gpio_request_one() Andy Shevchenko
  2025-05-31 21:21 ` [PATCH v1 2/2] gpiolib: Remove unused devm_gpio_request() Andy Shevchenko
@ 2025-06-05 13:33 ` Linus Walleij
  2025-06-10  8:11 ` Bartosz Golaszewski
  3 siblings, 0 replies; 6+ messages in thread
From: Linus Walleij @ 2025-06-05 13:33 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Bartosz Golaszewski, linux-doc, linux-kernel, linux-gpio,
	linux-arm-kernel, linux-usb, Jonathan Corbet, Bartosz Golaszewski,
	Daniel Mack, Haojian Zhuang, Robert Jarzmik, Greg Kroah-Hartman

On Sat, May 31, 2025 at 11:23 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:

> devm_gpio_request() is used by a single driver. Replace it there and
> kill the legacy API. Assumed to be routed via GPIO tree.

Excellent cleanup, as always!

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v1 0/2] gpiolib: get rid of devm_gpio_request()
  2025-05-31 21:21 [PATCH v1 0/2] gpiolib: get rid of devm_gpio_request() Andy Shevchenko
                   ` (2 preceding siblings ...)
  2025-06-05 13:33 ` [PATCH v1 0/2] gpiolib: get rid of devm_gpio_request() Linus Walleij
@ 2025-06-10  8:11 ` Bartosz Golaszewski
  3 siblings, 0 replies; 6+ messages in thread
From: Bartosz Golaszewski @ 2025-06-10  8:11 UTC (permalink / raw)
  To: linux-doc, linux-kernel, linux-gpio, linux-arm-kernel, linux-usb,
	Andy Shevchenko
  Cc: Bartosz Golaszewski, Jonathan Corbet, Linus Walleij,
	Bartosz Golaszewski, Daniel Mack, Haojian Zhuang, Robert Jarzmik,
	Greg Kroah-Hartman

From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>


On Sun, 01 Jun 2025 00:21:37 +0300, Andy Shevchenko wrote:
> devm_gpio_request() is used by a single driver. Replace it there and
> kill the legacy API. Assumed to be routed via GPIO tree.
> 
> Andy Shevchenko (2):
>   usb: gadget: pxa25x_udc: Switch to use devm_gpio_request_one()
>   gpiolib: Remove unused devm_gpio_request()
> 
> [...]

Applied, thanks!

[1/2] usb: gadget: pxa25x_udc: Switch to use devm_gpio_request_one()
      https://git.kernel.org/brgl/linux/c/32f6d31dc0401e6af7c48e5e2381997b6d957d85
[2/2] gpiolib: Remove unused devm_gpio_request()
      https://git.kernel.org/brgl/linux/c/a5589313383074c48a1b3751d592a6e084ae0573

Best regards,
-- 
Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-06-10  8:12 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-31 21:21 [PATCH v1 0/2] gpiolib: get rid of devm_gpio_request() Andy Shevchenko
2025-05-31 21:21 ` [PATCH v1 1/2] usb: gadget: pxa25x_udc: Switch to use devm_gpio_request_one() Andy Shevchenko
2025-06-01  7:37   ` Greg Kroah-Hartman
2025-05-31 21:21 ` [PATCH v1 2/2] gpiolib: Remove unused devm_gpio_request() Andy Shevchenko
2025-06-05 13:33 ` [PATCH v1 0/2] gpiolib: get rid of devm_gpio_request() Linus Walleij
2025-06-10  8:11 ` Bartosz Golaszewski

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).