Skip to content

Commit 465c436

Browse files
krzksre
authored andcommitted
power_supply: 88pm860x_charger: Use power_supply_*() API for accessing function attrs
Replace direct calls to power supply function attributes with wrappers. Wrappers provide safe access in case of unregistering the power supply (e.g. by removing the driver). Replace: - get_property -> power_supply_get_property - set_property -> power_supply_set_property Signed-off-by: Krzysztof Kozlowski <[email protected]> Acked-by: Jonghwa Lee <[email protected]> Acked-by: Pavel Machek <[email protected]> Reviewed-by: Bartlomiej Zolnierkiewicz <[email protected]> Reviewed-by: Sebastian Reichel <[email protected]> Signed-off-by: Sebastian Reichel <[email protected]>
1 parent ee8f334 commit 465c436

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

drivers/power/88pm860x_charger.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -296,12 +296,13 @@ static int set_charging_fsm(struct pm860x_charger_info *info)
296296
psy = power_supply_get_by_name(pm860x_supplied_to[0]);
297297
if (!psy)
298298
return -EINVAL;
299-
ret = psy->get_property(psy, POWER_SUPPLY_PROP_VOLTAGE_NOW, &data);
299+
ret = power_supply_get_property(psy, POWER_SUPPLY_PROP_VOLTAGE_NOW,
300+
&data);
300301
if (ret)
301302
return ret;
302303
vbatt = data.intval / 1000;
303304

304-
ret = psy->get_property(psy, POWER_SUPPLY_PROP_PRESENT, &data);
305+
ret = power_supply_get_property(psy, POWER_SUPPLY_PROP_PRESENT, &data);
305306
if (ret)
306307
return ret;
307308

@@ -430,7 +431,7 @@ static irqreturn_t pm860x_temp_handler(int irq, void *data)
430431
psy = power_supply_get_by_name(pm860x_supplied_to[0]);
431432
if (!psy)
432433
goto out;
433-
ret = psy->get_property(psy, POWER_SUPPLY_PROP_TEMP, &temp);
434+
ret = power_supply_get_property(psy, POWER_SUPPLY_PROP_TEMP, &temp);
434435
if (ret)
435436
goto out;
436437
value = temp.intval / 10;
@@ -485,7 +486,8 @@ static irqreturn_t pm860x_done_handler(int irq, void *data)
485486
psy = power_supply_get_by_name(pm860x_supplied_to[0]);
486487
if (!psy)
487488
goto out;
488-
ret = psy->get_property(psy, POWER_SUPPLY_PROP_VOLTAGE_NOW, &val);
489+
ret = power_supply_get_property(psy, POWER_SUPPLY_PROP_VOLTAGE_NOW,
490+
&val);
489491
if (ret)
490492
goto out;
491493
vbatt = val.intval / 1000;
@@ -500,7 +502,8 @@ static irqreturn_t pm860x_done_handler(int irq, void *data)
500502
if (ret < 0)
501503
goto out;
502504
if (vbatt > CHARGE_THRESHOLD && ret & STATUS2_CHG)
503-
psy->set_property(psy, POWER_SUPPLY_PROP_CHARGE_FULL, &val);
505+
power_supply_set_property(psy, POWER_SUPPLY_PROP_CHARGE_FULL,
506+
&val);
504507

505508
out:
506509
mutex_unlock(&info->lock);

0 commit comments

Comments
 (0)