diff mbox series

[08/14] power: supply: core: use dev_to_psy()

Message ID 20241208-power-supply-dev_to_psy-v1-8-f95de9117558@weissschuh.net (mailing list archive)
State Handled Elsewhere, archived
Headers show
Series power: supply: intruduce and use power_supply_for_each_psy() and dev_to_psy() | expand

Commit Message

Thomas Weißschuh Dec. 8, 2024, 1:02 p.m. UTC
Use the new, explicit accessor to go from a 'struct device' to its
'struct power_supply'.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
 drivers/power/supply/power_supply_core.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/drivers/power/supply/power_supply_core.c b/drivers/power/supply/power_supply_core.c
index 0cdccfd585cb49b623027a3edaf2958777d2be8a..1db27afb7017c4428aa90372f7b9de03223671cf 100644
--- a/drivers/power/supply/power_supply_core.c
+++ b/drivers/power/supply/power_supply_core.c
@@ -123,7 +123,7 @@  struct psy_for_each_psy_cb_data {
 static int psy_for_each_psy_cb(struct device *dev, void *data)
 {
 	struct psy_for_each_psy_cb_data *cb_data = data;
-	struct power_supply *psy = dev_get_drvdata(dev);
+	struct power_supply *psy = dev_to_psy(dev);
 
 	return cb_data->fn(psy, cb_data->data);
 }
@@ -456,7 +456,7 @@  EXPORT_SYMBOL_GPL(power_supply_set_battery_charged);
 static int power_supply_match_device_by_name(struct device *dev, const void *data)
 {
 	const char *name = data;
-	struct power_supply *psy = dev_get_drvdata(dev);
+	struct power_supply *psy = dev_to_psy(dev);
 
 	return strcmp(psy->desc->name, name) == 0;
 }
@@ -479,7 +479,7 @@  struct power_supply *power_supply_get_by_name(const char *name)
 					       power_supply_match_device_by_name);
 
 	if (dev) {
-		psy = dev_get_drvdata(dev);
+		psy = dev_to_psy(dev);
 		atomic_inc(&psy->use_cnt);
 	}
 
@@ -536,7 +536,7 @@  struct power_supply *power_supply_get_by_phandle(struct device_node *np,
 	of_node_put(power_supply_np);
 
 	if (dev) {
-		psy = dev_get_drvdata(dev);
+		psy = dev_to_psy(dev);
 		atomic_inc(&psy->use_cnt);
 	}