Skip to content

Commit 644e952

Browse files
committed
Merge tag 'for-v6.1-rc' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply
Pull power supply fixes from Sebastian Reichel: - rk817: Two error handling fixes - ip5xxx: fix inter overflow in current calculation - ab8500: fix thermal zone probing * tag 'for-v6.1-rc' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply: power: supply: ab8500: Defer thermal zone probe power: supply: ip5xxx: Fix integer overflow in current_now calculation power: supply: rk817: Change rk817_chg_cur_to_reg to int power: supply: rk817: check correct variable
2 parents 990f320 + 767e684 commit 644e952

File tree

3 files changed

+15
-10
lines changed

3 files changed

+15
-10
lines changed

drivers/power/supply/ab8500_btemp.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -725,7 +725,14 @@ static int ab8500_btemp_probe(struct platform_device *pdev)
725725
/* Get thermal zone and ADC */
726726
di->tz = thermal_zone_get_zone_by_name("battery-thermal");
727727
if (IS_ERR(di->tz)) {
728-
return dev_err_probe(dev, PTR_ERR(di->tz),
728+
ret = PTR_ERR(di->tz);
729+
/*
730+
* This usually just means we are probing before the thermal
731+
* zone, so just defer.
732+
*/
733+
if (ret == -ENODEV)
734+
ret = -EPROBE_DEFER;
735+
return dev_err_probe(dev, ret,
729736
"failed to get battery thermal zone\n");
730737
}
731738
di->bat_ctrl = devm_iio_channel_get(dev, "bat_ctrl");

drivers/power/supply/ip5xxx_power.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ static int ip5xxx_battery_get_property(struct power_supply *psy,
352352
ret = ip5xxx_battery_read_adc(ip5xxx, IP5XXX_BATIADC_DAT0,
353353
IP5XXX_BATIADC_DAT1, &raw);
354354

355-
val->intval = DIV_ROUND_CLOSEST(raw * 745985, 1000);
355+
val->intval = DIV_ROUND_CLOSEST(raw * 149197, 200);
356356
return 0;
357357

358358
case POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT:

drivers/power/supply/rk817_charger.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ struct rk817_charger {
121121
#define ADC_TO_CHARGE_UAH(adc_value, res_div) \
122122
(adc_value / 3600 * 172 / res_div)
123123

124-
static u8 rk817_chg_cur_to_reg(u32 chg_cur_ma)
124+
static int rk817_chg_cur_to_reg(u32 chg_cur_ma)
125125
{
126126
if (chg_cur_ma >= 3500)
127127
return CHG_3_5A;
@@ -864,8 +864,8 @@ static int rk817_battery_init(struct rk817_charger *charger,
864864
{
865865
struct rk808 *rk808 = charger->rk808;
866866
u32 tmp, max_chg_vol_mv, max_chg_cur_ma;
867-
u8 max_chg_vol_reg, chg_term_i_reg, max_chg_cur_reg;
868-
int ret, chg_term_ma;
867+
u8 max_chg_vol_reg, chg_term_i_reg;
868+
int ret, chg_term_ma, max_chg_cur_reg;
869869
u8 bulk_reg[2];
870870

871871
/* Get initial plug state */
@@ -1116,14 +1116,12 @@ static int rk817_charger_probe(struct platform_device *pdev)
11161116

11171117
charger->bat_ps = devm_power_supply_register(&pdev->dev,
11181118
&rk817_bat_desc, &pscfg);
1119-
1120-
charger->chg_ps = devm_power_supply_register(&pdev->dev,
1121-
&rk817_chg_desc, &pscfg);
1122-
1123-
if (IS_ERR(charger->chg_ps))
1119+
if (IS_ERR(charger->bat_ps))
11241120
return dev_err_probe(dev, -EINVAL,
11251121
"Battery failed to probe\n");
11261122

1123+
charger->chg_ps = devm_power_supply_register(&pdev->dev,
1124+
&rk817_chg_desc, &pscfg);
11271125
if (IS_ERR(charger->chg_ps))
11281126
return dev_err_probe(dev, -EINVAL,
11291127
"Charger failed to probe\n");

0 commit comments

Comments
 (0)