gpiolib: acpi: Remove never used devm_acpi_dev_remove_driver_gpios()
PATCH 1/2 gpiolib: acpi: Remove never used devm_acpi_dev_remove_driver_gpios()
Remove never used devm_acpi_dev_remove_driver_gpios().
--- drivers/gpio/gpiolib-acpi.c | 6 ------ include/linux/gpio/consumer.h | 2 -- 2 files changed, 8 deletions(-)
drivers/gpio/gpiolib-acpi.c +0 -6
@@ -604,12 +604,6 @@ int devm_acpi_dev_add_driver_gpios(struct device *dev, }EXPORT_SYMBOL_GPL (devm_acpi_dev_add_driver_gpios); -void devm_acpi_dev_remove_driver_gpios (struct device *dev) -{ -WARN_ON (devres_release (dev, devm_acpi_dev_release_driver_gpios,NULL ,NULL )); -} -EXPORT_SYMBOL_GPL (devm_acpi_dev_remove_driver_gpios); - static bool acpi_get_driver_gpio_data(struct acpi_device *adev, const char *name, int index, struct fwnode_reference_args *args,
include/linux/gpio/consumer.h +0 -2
@@ -690,7 +690,6 @@ void acpi_dev_remove_driver_gpios(struct acpi_device *adev);int devm_acpi_dev_add_driver_gpios (struct device *dev,const struct acpi_gpio_mapping *gpios); -void devm_acpi_dev_remove_driver_gpios (struct device *dev);struct gpio_desc *acpi_get_and_request_gpiod (char *path,int pin,char *label);
@@ -708,7 +707,6 @@ static inline int devm_acpi_dev_add_driver_gpios(struct device *dev, {return -ENXIO ; } -static inline void devm_acpi_dev_remove_driver_gpios (struct device *dev) {}#endif /* CONFIG_GPIOLIB && CONFIG_ACPI */
Signature · 1 line
2.33.0
PATCH 2/2 gpiolib: acpi: shrink devm_acpi_dev_add_driver_gpios()
If all we want to manage is a single pointer, there's no need to manually allocate and add a new devres. We can simply use devm_add_action_or_reset() and shrink the code by a good bit.
--- drivers/gpio/gpiolib-acpi.c | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-)
drivers/gpio/gpiolib-acpi.c +7 -13
@@ -579,28 +579,22 @@ void acpi_dev_remove_driver_gpios(struct acpi_device *adev) }EXPORT_SYMBOL_GPL (acpi_dev_remove_driver_gpios); -static void devm_acpi_dev_release_driver_gpios (struct device *dev,void *res) +static void acpi_dev_release_driver_gpios (void *adev) { -acpi_dev_remove_driver_gpios (ACPI_COMPANION (dev)); +acpi_dev_remove_driver_gpios (adev); }int devm_acpi_dev_add_driver_gpios (struct device *dev,const struct acpi_gpio_mapping *gpios) { -void *res; +struct acpi_device *adev =ACPI_COMPANION (dev);int ret; - res =devres_alloc (devm_acpi_dev_release_driver_gpios,0 ,GFP_KERNEL ); -if (!res) -return -ENOMEM ; - - ret =acpi_dev_add_driver_gpios (ACPI_COMPANION (dev), gpios); -if (ret) { -devres_free (res); + ret =acpi_dev_add_driver_gpios (adev, gpios); +if (ret)return ret; - } -devres_add (dev, res); -return 0 ; + +return devm_add_action_or_reset (dev, acpi_dev_release_driver_gpios, adev); }EXPORT_SYMBOL_GPL (devm_acpi_dev_add_driver_gpios);
Signature · 1 line
2.33.0
Re: [PATCH v1 2/2] gpiolib: acpi: shrink devm_acpi_dev_add_driver_gpios()
Quoted 5 lines · Andy Shevchenko
If all we want to manage is a single pointer, there's no need to manually allocate and add a new devres. We can simply use
devm_add_action_or_reset()and shrink the code by a good bit.Signed-off-by Andy Shevchenko <[email protected]>
Quoted 3 lines · Andy Shevchenko
Remove never used
devm_acpi_dev_remove_driver_gpios().Signed-off-by Andy Shevchenko <[email protected]>
Quoted 6 lines · Mika Westerberg
Quoted 3 lines · Andy Shevchenko
Remove never used
devm_acpi_dev_remove_driver_gpios().Signed-off-by Andy Shevchenko <[email protected]>Reviewed-by Mika Westerberg <[email protected]>
Pushed to my review and testing queue, thanks!
Signature · 2 lines
With Best Regards, Andy Shevchenko