Message ID | 184767a4f60.d9a0c3da334147.3171681720569322283@elijahpepe.com |
---|---|
State | New |
Headers | show |
Series | drivers: undo simplify POWER_SUPPLY_PROP_ONLINE | expand |
diff --git a/drivers/power/supply/max17040_battery.c b/drivers/power/supply/max17040_battery.c index a9aef1e8b186..5284f2bf735c 100644 --- a/drivers/power/supply/max17040_battery.c +++ b/drivers/power/supply/max17040_battery.c @@ -217,7 +217,8 @@ static int max17040_get_version(struct max17040_chip *chip) static int max17040_get_online(struct max17040_chip *chip) { - return 1; + return chip->pdata && chip->pdata->battery_online ? + chip->pdata->battery_online() : 1; } static int max17040_get_of_data(struct max17040_chip *chip)
Per the work done by arturo182, the value of max17040() with LiPo batteries will always be 1, even if it's not connected. This is ambiguous and setting the return value to 1 presents complications for anyone working with LiPo batteries, and does not result in significant overhead. Signed-off-by: Elijah Conners <business@elijahpepe.com> --- drivers/power/supply/max17040_battery.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)