Commit 230fb418 authored by Thomas Weißschuh's avatar Thomas Weißschuh Committed by Sebastian Reichel
Browse files

power: supply: apm_power: use power_supply_for_each_psy()



Simplify the callbacks by removing the need to convert a 'struct device'
into a 'struct power_supply'.

Signed-off-by: default avatarThomas Weißschuh <linux@weissschuh.net>
Link: https://lore.kernel.org/r/20241210-power-supply-dev_to_psy-v2-5-9d8c9d24cfe4@weissschuh.net


Signed-off-by: default avatarSebastian Reichel <sebastian.reichel@collabora.com>
parent 87f57faa
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -42,11 +42,11 @@ struct find_bat_param {
	int max_energy;
};

static int __find_main_battery(struct device *dev, void *data)
static int __find_main_battery(struct power_supply *psy, void *data)
{
	struct find_bat_param *bp = (struct find_bat_param *)data;

	bp->bat = dev_get_drvdata(dev);
	bp->bat = psy;

	if (bp->bat->desc->use_for_apm) {
		/* nice, we explicitly asked to report this battery. */
@@ -79,7 +79,7 @@ static void find_main_battery(void)
	main_battery = NULL;
	bp.main = main_battery;

	error = power_supply_for_each_device(&bp, __find_main_battery);
	error = power_supply_for_each_psy(&bp, __find_main_battery);
	if (error) {
		main_battery = bp.main;
		return;