[PATCH 10/11] regulator: drop struct regulator_dev::supply_name

Sascha Hauer s.hauer at pengutronix.de
Wed Sep 20 03:33:15 PDT 2023


The supply name can be set in struct regulator_desc, no need to have
it in struct regulator_dev also, so drop it there.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 drivers/regulator/bcm2835.c | 2 +-
 drivers/regulator/core.c    | 8 +++-----
 include/regulator.h         | 4 +---
 3 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/drivers/regulator/bcm2835.c b/drivers/regulator/bcm2835.c
index 34e0429dfd..fa9fc47207 100644
--- a/drivers/regulator/bcm2835.c
+++ b/drivers/regulator/bcm2835.c
@@ -122,7 +122,7 @@ static int regulator_bcm2835_probe(struct device *dev)
 		rb->rdev.desc = &rb->rdesc;
 		rb->rdev.dev = dev;
 
-		ret = dev_regulator_register(&rb->rdev, rb->devname, NULL);
+		ret = dev_regulator_register(&rb->rdev, rb->devname);
 		if (ret)
 			return ret;
 	}
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 00a2aefce7..7fe264a133 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -409,7 +409,7 @@ static struct regulator_dev *of_regulator_get(struct device *dev,
 }
 #endif
 
-int dev_regulator_register(struct regulator_dev *rdev, const char * name, const char* supply)
+int dev_regulator_register(struct regulator_dev *rdev, const char *name)
 {
 	int ret;
 
@@ -417,8 +417,6 @@ int dev_regulator_register(struct regulator_dev *rdev, const char * name, const
 	if (ret)
 		return ret;
 
-	rdev->supply_name = supply;
-
 	return 0;
 }
 
@@ -437,8 +435,8 @@ static struct regulator_dev *dev_regulator_get(struct device *dev,
 				continue;
 			match += 2;
 		}
-		if (rdev->supply_name) {
-			if (!supply || strcmp(rdev->supply_name, supply))
+		if (rdev->desc->supply_name) {
+			if (!supply || strcmp(rdev->desc->supply_name, supply))
 				continue;
 			match += 1;
 		}
diff --git a/include/regulator.h b/include/regulator.h
index d02ea8ffd0..c5b405dfcd 100644
--- a/include/regulator.h
+++ b/include/regulator.h
@@ -92,7 +92,6 @@ struct regulator_dev {
 	int enable_time_us;
 	int min_uv;
 	int max_uv;
-	const char *supply_name;
 	struct list_head consumer_list;
 	const struct regulator_desc *desc;
 	struct regmap *regmap;
@@ -154,8 +153,7 @@ static inline int of_regulator_register(struct regulator_dev *rd,
 	return -ENOSYS;
 }
 #endif
-int dev_regulator_register(struct regulator_dev *rd, const char * name,
-			   const char* supply);
+int dev_regulator_register(struct regulator_dev *rd, const char *name);
 
 void regulators_print(void);
 
-- 
2.39.2




More information about the barebox mailing list