power: supply: ab8500: 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: Thomas Weißschuh <linux@weissschuh.net> Link: https://lore.kernel.org/r/20241210-power-supply-dev_to_psy-v2-4-9d8c9d24cfe4@weissschuh.net Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>pull/1134/merge
parent
68abaf7323
commit
87f57faa20
|
|
@ -540,10 +540,9 @@ static int ab8500_btemp_get_property(struct power_supply *psy,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int ab8500_btemp_get_ext_psy_data(struct device *dev, void *data)
|
||||
static int ab8500_btemp_get_ext_psy_data(struct power_supply *ext, void *data)
|
||||
{
|
||||
struct power_supply *psy;
|
||||
struct power_supply *ext = dev_get_drvdata(dev);
|
||||
const char **supplicants = (const char **)ext->supplied_to;
|
||||
struct ab8500_btemp *di;
|
||||
union power_supply_propval ret;
|
||||
|
|
@ -617,7 +616,7 @@ static int ab8500_btemp_get_ext_psy_data(struct device *dev, void *data)
|
|||
*/
|
||||
static void ab8500_btemp_external_power_changed(struct power_supply *psy)
|
||||
{
|
||||
power_supply_for_each_device(psy, ab8500_btemp_get_ext_psy_data);
|
||||
power_supply_for_each_psy(psy, ab8500_btemp_get_ext_psy_data);
|
||||
}
|
||||
|
||||
/* ab8500 btemp driver interrupts and their respective isr */
|
||||
|
|
|
|||
|
|
@ -844,10 +844,9 @@ static void handle_maxim_chg_curr(struct ab8500_chargalg *di)
|
|||
}
|
||||
}
|
||||
|
||||
static int ab8500_chargalg_get_ext_psy_data(struct device *dev, void *data)
|
||||
static int ab8500_chargalg_get_ext_psy_data(struct power_supply *ext, void *data)
|
||||
{
|
||||
struct power_supply *psy;
|
||||
struct power_supply *ext = dev_get_drvdata(dev);
|
||||
const char **supplicants = (const char **)ext->supplied_to;
|
||||
struct ab8500_chargalg *di;
|
||||
union power_supply_propval ret;
|
||||
|
|
@ -1231,7 +1230,7 @@ static void ab8500_chargalg_algorithm(struct ab8500_chargalg *di)
|
|||
int ret;
|
||||
|
||||
/* Collect data from all power_supply class devices */
|
||||
power_supply_for_each_device(di->chargalg_psy, ab8500_chargalg_get_ext_psy_data);
|
||||
power_supply_for_each_psy(di->chargalg_psy, ab8500_chargalg_get_ext_psy_data);
|
||||
|
||||
ab8500_chargalg_end_of_charge(di);
|
||||
ab8500_chargalg_check_temp(di);
|
||||
|
|
|
|||
|
|
@ -1894,10 +1894,9 @@ static int ab8500_charger_update_charger_current(struct ux500_charger *charger,
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int ab8500_charger_get_ext_psy_data(struct device *dev, void *data)
|
||||
static int ab8500_charger_get_ext_psy_data(struct power_supply *ext, void *data)
|
||||
{
|
||||
struct power_supply *psy;
|
||||
struct power_supply *ext = dev_get_drvdata(dev);
|
||||
const char **supplicants = (const char **)ext->supplied_to;
|
||||
struct ab8500_charger *di;
|
||||
union power_supply_propval ret;
|
||||
|
|
@ -1961,7 +1960,7 @@ static void ab8500_charger_check_vbat_work(struct work_struct *work)
|
|||
struct ab8500_charger *di = container_of(work,
|
||||
struct ab8500_charger, check_vbat_work.work);
|
||||
|
||||
power_supply_for_each_device(&di->usb_chg, ab8500_charger_get_ext_psy_data);
|
||||
power_supply_for_each_psy(&di->usb_chg, ab8500_charger_get_ext_psy_data);
|
||||
|
||||
/* First run old_vbat is 0. */
|
||||
if (di->old_vbat == 0)
|
||||
|
|
|
|||
|
|
@ -2174,10 +2174,9 @@ static int ab8500_fg_get_property(struct power_supply *psy,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int ab8500_fg_get_ext_psy_data(struct device *dev, void *data)
|
||||
static int ab8500_fg_get_ext_psy_data(struct power_supply *ext, void *data)
|
||||
{
|
||||
struct power_supply *psy;
|
||||
struct power_supply *ext = dev_get_drvdata(dev);
|
||||
const char **supplicants = (const char **)ext->supplied_to;
|
||||
struct ab8500_fg *di;
|
||||
struct power_supply_battery_info *bi;
|
||||
|
|
@ -2402,7 +2401,7 @@ out:
|
|||
*/
|
||||
static void ab8500_fg_external_power_changed(struct power_supply *psy)
|
||||
{
|
||||
power_supply_for_each_device(psy, ab8500_fg_get_ext_psy_data);
|
||||
power_supply_for_each_psy(psy, ab8500_fg_get_ext_psy_data);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue