mirror of
https://github.com/torvalds/linux.git
synced 2026-05-31 10:33:41 +02:00
power: supply: use max() to improve code
Use max() to reduce the code in cw_battery_get_property() and improve its readability. Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
This commit is contained in:
parent
15a84d15a6
commit
d48d4e4f14
|
|
@ -506,10 +506,7 @@ static int cw_battery_get_property(struct power_supply *psy,
|
|||
|
||||
case POWER_SUPPLY_PROP_CHARGE_FULL:
|
||||
case POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN:
|
||||
if (cw_bat->battery->charge_full_design_uah > 0)
|
||||
val->intval = cw_bat->battery->charge_full_design_uah;
|
||||
else
|
||||
val->intval = 0;
|
||||
val->intval = max(cw_bat->battery->charge_full_design_uah, 0);
|
||||
break;
|
||||
|
||||
case POWER_SUPPLY_PROP_CHARGE_NOW:
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user