lkml.org 
[lkml]   [2022]   [Nov]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] drivers: undo simplify POWER_SUPPLY_PROP_ONLINE
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(-)

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)
--
2.29.2.windows.2
\
 
 \ /
  Last update: 2022-11-14 15:28    [W:0.032 / U:0.064 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site