gpiolib: get rid of devm_gpio_request()
Subsystems (5)
PATCH 1/2 usb: gadget: pxa25x_udc: Switch to use devm_gpio_request_one()
In reply to Andy Shevchenkodevm_gpio_request() is going to be removed. This driver is only user of that API. Convert it to use different API.
--- drivers/usb/gadget/udc/pxa25x_udc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/usb/gadget/udc/pxa25x_udc.c +2 -3
@@ -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 );
Signature · 1 line
2.47.2
cover gpiolib: get rid of devm_gpio_request()
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(-)
Signature · 1 line
2.47.2
PATCH 2/2 gpiolib: Remove unused devm_gpio_request()
No users.
--- .../driver-api/driver-model/devres.rst | 1 - drivers/gpio/gpiolib-legacy.c | 38 ------------------- include/linux/gpio.h | 8 ---- 3 files changed, 47 deletions(-)
Documentation/driver-api/driver-model/devres.rst +0 -1
@@ -275,7 +275,6 @@ GPIO devm_gpiod_put() devm_gpiod_unhinge() devm_gpiochip_add_data() - devm_gpio_request() devm_gpio_request_one() I2C
drivers/gpio/gpiolib-legacy.c +0 -38
@@ -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
include/linux/gpio.h +0 -8
@@ -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) {
Signature · 1 line
2.47.2
Re: [PATCH v1 1/2] usb: gadget: pxa25x_udc: Switch to use devm_gpio_request_one()
In reply to Andy ShevchenkoQuoted 7 lines · Andy Shevchenko
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 <[email protected]>--- drivers/usb/gadget/udc/pxa25x_udc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
Quoted 2 lines · Andy Shevchenko
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!
Yours,
Linus Walleij
Bartosz Golaszewski
AppliedFrom: Bartosz Golaszewski <[email protected]>
Quoted 8 lines · Andy Shevchenko
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 usedevm_gpio_request_one()
gpiolib: Remove unuseddevm_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,
Signature · 1 line
Bartosz Golaszewski <[email protected]>