public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drivers: undo simplify POWER_SUPPLY_PROP_ONLINE
@ 2022-11-14 14:10 Elijah Conners
  2022-11-14 23:22 ` kernel test robot
  0 siblings, 1 reply; 2+ messages in thread
From: Elijah Conners @ 2022-11-14 14:10 UTC (permalink / raw)
  To: linux-kernel, linux-pm; +Cc: mszyprowski

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-11-14 23:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-14 14:10 [PATCH] drivers: undo simplify POWER_SUPPLY_PROP_ONLINE Elijah Conners
2022-11-14 23:22 ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox