[PATCH] regulator: devres: Remove unused devm_regulator_bulk_register_supply_alias

linux@treblig.org posted 1 patch 1 year, 3 months ago
.../driver-api/driver-model/devres.rst        |  1 -
drivers/regulator/devres.c                    | 74 -------------------
include/linux/regulator/consumer.h            |  6 --
3 files changed, 81 deletions(-)
[PATCH] regulator: devres: Remove unused devm_regulator_bulk_register_supply_alias
Posted by linux@treblig.org 1 year, 3 months ago
From: "Dr. David Alan Gilbert" <linux@treblig.org>

devm_regulator_bulk_register_supply_alias() has been unused since 2014's
commit d137be00ee01 ("mfd: core: Don't use devres functions before device
is added")

Remove it, and the static helpers only it used.

Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
---
 .../driver-api/driver-model/devres.rst        |  1 -
 drivers/regulator/devres.c                    | 74 -------------------
 include/linux/regulator/consumer.h            |  6 --
 3 files changed, 81 deletions(-)

diff --git a/Documentation/driver-api/driver-model/devres.rst b/Documentation/driver-api/driver-model/devres.rst
index 5f2ee8d717b1..a1995a16febf 100644
--- a/Documentation/driver-api/driver-model/devres.rst
+++ b/Documentation/driver-api/driver-model/devres.rst
@@ -426,7 +426,6 @@ PWM
   devm_fwnode_pwm_get()
 
 REGULATOR
-  devm_regulator_bulk_register_supply_alias()
   devm_regulator_bulk_get()
   devm_regulator_bulk_get_const()
   devm_regulator_bulk_get_enable()
diff --git a/drivers/regulator/devres.c b/drivers/regulator/devres.c
index 1b893cdd1aad..6d6ddeb62f57 100644
--- a/drivers/regulator/devres.c
+++ b/drivers/regulator/devres.c
@@ -491,15 +491,6 @@ struct regulator_supply_alias_match {
 	const char *id;
 };
 
-static int devm_regulator_match_supply_alias(struct device *dev, void *res,
-					     void *data)
-{
-	struct regulator_supply_alias_match *match = res;
-	struct regulator_supply_alias_match *target = data;
-
-	return match->dev == target->dev && strcmp(match->id, target->id) == 0;
-}
-
 static void devm_regulator_destroy_supply_alias(struct device *dev, void *res)
 {
 	struct regulator_supply_alias_match *match = res;
@@ -548,71 +539,6 @@ int devm_regulator_register_supply_alias(struct device *dev, const char *id,
 }
 EXPORT_SYMBOL_GPL(devm_regulator_register_supply_alias);
 
-static void devm_regulator_unregister_supply_alias(struct device *dev,
-						   const char *id)
-{
-	struct regulator_supply_alias_match match;
-	int rc;
-
-	match.dev = dev;
-	match.id = id;
-
-	rc = devres_release(dev, devm_regulator_destroy_supply_alias,
-			    devm_regulator_match_supply_alias, &match);
-	if (rc != 0)
-		WARN_ON(rc);
-}
-
-/**
- * devm_regulator_bulk_register_supply_alias - Managed register
- * multiple aliases
- *
- * @dev:       device to supply
- * @id:        list of supply names or regulator IDs
- * @alias_dev: device that should be used to lookup the supply
- * @alias_id:  list of supply names or regulator IDs that should be used to
- *             lookup the supply
- * @num_id:    number of aliases to register
- *
- * @return 0 on success, a negative error number on failure.
- *
- * This helper function allows drivers to register several supply
- * aliases in one operation, the aliases will be automatically
- * unregisters when the source device is unbound.  If any of the
- * aliases cannot be registered any aliases that were registered
- * will be removed before returning to the caller.
- */
-int devm_regulator_bulk_register_supply_alias(struct device *dev,
-					      const char *const *id,
-					      struct device *alias_dev,
-					      const char *const *alias_id,
-					      int num_id)
-{
-	int i;
-	int ret;
-
-	for (i = 0; i < num_id; ++i) {
-		ret = devm_regulator_register_supply_alias(dev, id[i],
-							   alias_dev,
-							   alias_id[i]);
-		if (ret < 0)
-			goto err;
-	}
-
-	return 0;
-
-err:
-	dev_err(dev,
-		"Failed to create supply alias %s,%s -> %s,%s\n",
-		id[i], dev_name(dev), alias_id[i], dev_name(alias_dev));
-
-	while (--i >= 0)
-		devm_regulator_unregister_supply_alias(dev, id[i]);
-
-	return ret;
-}
-EXPORT_SYMBOL_GPL(devm_regulator_bulk_register_supply_alias);
-
 struct regulator_notifier_match {
 	struct regulator *regulator;
 	struct notifier_block *nb;
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
index b9ce521910a0..adaacd7676b6 100644
--- a/include/linux/regulator/consumer.h
+++ b/include/linux/regulator/consumer.h
@@ -185,12 +185,6 @@ int devm_regulator_register_supply_alias(struct device *dev, const char *id,
 					 struct device *alias_dev,
 					 const char *alias_id);
 
-int devm_regulator_bulk_register_supply_alias(struct device *dev,
-					      const char *const *id,
-					      struct device *alias_dev,
-					      const char *const *alias_id,
-					      int num_id);
-
 /* regulator output control and status */
 int __must_check regulator_enable(struct regulator *regulator);
 int regulator_disable(struct regulator *regulator);
-- 
2.47.0
Re: [PATCH] regulator: devres: Remove unused devm_regulator_bulk_register_supply_alias
Posted by Dr. David Alan Gilbert 1 year, 2 months ago
* linux@treblig.org (linux@treblig.org) wrote:
> From: "Dr. David Alan Gilbert" <linux@treblig.org>
> 
> devm_regulator_bulk_register_supply_alias() has been unused since 2014's
> commit d137be00ee01 ("mfd: core: Don't use devres functions before device
> is added")
> 
> Remove it, and the static helpers only it used.
> 
> Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>

Ping.

Thanks,

Dave

> ---
>  .../driver-api/driver-model/devres.rst        |  1 -
>  drivers/regulator/devres.c                    | 74 -------------------
>  include/linux/regulator/consumer.h            |  6 --
>  3 files changed, 81 deletions(-)
> 
> diff --git a/Documentation/driver-api/driver-model/devres.rst b/Documentation/driver-api/driver-model/devres.rst
> index 5f2ee8d717b1..a1995a16febf 100644
> --- a/Documentation/driver-api/driver-model/devres.rst
> +++ b/Documentation/driver-api/driver-model/devres.rst
> @@ -426,7 +426,6 @@ PWM
>    devm_fwnode_pwm_get()
>  
>  REGULATOR
> -  devm_regulator_bulk_register_supply_alias()
>    devm_regulator_bulk_get()
>    devm_regulator_bulk_get_const()
>    devm_regulator_bulk_get_enable()
> diff --git a/drivers/regulator/devres.c b/drivers/regulator/devres.c
> index 1b893cdd1aad..6d6ddeb62f57 100644
> --- a/drivers/regulator/devres.c
> +++ b/drivers/regulator/devres.c
> @@ -491,15 +491,6 @@ struct regulator_supply_alias_match {
>  	const char *id;
>  };
>  
> -static int devm_regulator_match_supply_alias(struct device *dev, void *res,
> -					     void *data)
> -{
> -	struct regulator_supply_alias_match *match = res;
> -	struct regulator_supply_alias_match *target = data;
> -
> -	return match->dev == target->dev && strcmp(match->id, target->id) == 0;
> -}
> -
>  static void devm_regulator_destroy_supply_alias(struct device *dev, void *res)
>  {
>  	struct regulator_supply_alias_match *match = res;
> @@ -548,71 +539,6 @@ int devm_regulator_register_supply_alias(struct device *dev, const char *id,
>  }
>  EXPORT_SYMBOL_GPL(devm_regulator_register_supply_alias);
>  
> -static void devm_regulator_unregister_supply_alias(struct device *dev,
> -						   const char *id)
> -{
> -	struct regulator_supply_alias_match match;
> -	int rc;
> -
> -	match.dev = dev;
> -	match.id = id;
> -
> -	rc = devres_release(dev, devm_regulator_destroy_supply_alias,
> -			    devm_regulator_match_supply_alias, &match);
> -	if (rc != 0)
> -		WARN_ON(rc);
> -}
> -
> -/**
> - * devm_regulator_bulk_register_supply_alias - Managed register
> - * multiple aliases
> - *
> - * @dev:       device to supply
> - * @id:        list of supply names or regulator IDs
> - * @alias_dev: device that should be used to lookup the supply
> - * @alias_id:  list of supply names or regulator IDs that should be used to
> - *             lookup the supply
> - * @num_id:    number of aliases to register
> - *
> - * @return 0 on success, a negative error number on failure.
> - *
> - * This helper function allows drivers to register several supply
> - * aliases in one operation, the aliases will be automatically
> - * unregisters when the source device is unbound.  If any of the
> - * aliases cannot be registered any aliases that were registered
> - * will be removed before returning to the caller.
> - */
> -int devm_regulator_bulk_register_supply_alias(struct device *dev,
> -					      const char *const *id,
> -					      struct device *alias_dev,
> -					      const char *const *alias_id,
> -					      int num_id)
> -{
> -	int i;
> -	int ret;
> -
> -	for (i = 0; i < num_id; ++i) {
> -		ret = devm_regulator_register_supply_alias(dev, id[i],
> -							   alias_dev,
> -							   alias_id[i]);
> -		if (ret < 0)
> -			goto err;
> -	}
> -
> -	return 0;
> -
> -err:
> -	dev_err(dev,
> -		"Failed to create supply alias %s,%s -> %s,%s\n",
> -		id[i], dev_name(dev), alias_id[i], dev_name(alias_dev));
> -
> -	while (--i >= 0)
> -		devm_regulator_unregister_supply_alias(dev, id[i]);
> -
> -	return ret;
> -}
> -EXPORT_SYMBOL_GPL(devm_regulator_bulk_register_supply_alias);
> -
>  struct regulator_notifier_match {
>  	struct regulator *regulator;
>  	struct notifier_block *nb;
> diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
> index b9ce521910a0..adaacd7676b6 100644
> --- a/include/linux/regulator/consumer.h
> +++ b/include/linux/regulator/consumer.h
> @@ -185,12 +185,6 @@ int devm_regulator_register_supply_alias(struct device *dev, const char *id,
>  					 struct device *alias_dev,
>  					 const char *alias_id);
>  
> -int devm_regulator_bulk_register_supply_alias(struct device *dev,
> -					      const char *const *id,
> -					      struct device *alias_dev,
> -					      const char *const *alias_id,
> -					      int num_id);
> -
>  /* regulator output control and status */
>  int __must_check regulator_enable(struct regulator *regulator);
>  int regulator_disable(struct regulator *regulator);
> -- 
> 2.47.0
> 
-- 
 -----Open up your eyes, open up your mind, open up your code -------   
/ Dr. David Alan Gilbert    |       Running GNU/Linux       | Happy  \ 
\        dave @ treblig.org |                               | In Hex /
 \ _________________________|_____ http://www.treblig.org   |_______/
Re: [PATCH] regulator: devres: Remove unused devm_regulator_bulk_register_supply_alias
Posted by Mark Brown 1 year, 2 months ago
On Thu, Nov 28, 2024 at 04:13:41PM +0000, Dr. David Alan Gilbert wrote:
> * linux@treblig.org (linux@treblig.org) wrote:
> > From: "Dr. David Alan Gilbert" <linux@treblig.org>
> > 
> > devm_regulator_bulk_register_supply_alias() has been unused since 2014's
> > commit d137be00ee01 ("mfd: core: Don't use devres functions before device
> > is added")
> > 
> > Remove it, and the static helpers only it used.
> > 
> > Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>

> Ping.

Please don't send content free pings and please allow a reasonable time
for review.  People get busy, go on holiday, attend conferences and so 
on so unless there is some reason for urgency (like critical bug fixes)
please allow at least a couple of weeks for review.  If there have been
review comments then people may be waiting for those to be addressed.

Sending content free pings adds to the mail volume (if they are seen at
all) which is often the problem and since they can't be reviewed
directly if something has gone wrong you'll have to resend the patches
anyway, so sending again is generally a better approach though there are
some other maintainers who like them - if in doubt look at how patches
for the subsystem are normally handled.