linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] power: supply: bq27xxx: Return the value instead of -ENODATA
@ 2021-03-31 13:51 Hermes Zhang
  2021-03-31 14:02 ` Pali Rohár
  0 siblings, 1 reply; 4+ messages in thread
From: Hermes Zhang @ 2021-03-31 13:51 UTC (permalink / raw)
  To: lars, Pali Rohár, Sebastian Reichel
  Cc: kernel, Hermes Zhang, linux-pm, linux-kernel

From: Hermes Zhang <chenhuiz@axis.com>

It might be better to return value (e.g. 65535) instead of an error
(e.g. No data available) for the time property.

Normally a common function will handle the read string and parse to
integer for all the properties, but will have problem when read the
time property because need to handle the NODATA error as non-error.
So it will make simple for application which indicate success when
read a number, otherwise as an error to handle.

Signed-off-by: Hermes Zhang <chenhuiz@axis.com>
---
 drivers/power/supply/bq27xxx_battery.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c
index 4c4a7b1c64c5..b75e54aa8ada 100644
--- a/drivers/power/supply/bq27xxx_battery.c
+++ b/drivers/power/supply/bq27xxx_battery.c
@@ -1655,9 +1655,6 @@ static int bq27xxx_battery_read_time(struct bq27xxx_device_info *di, u8 reg)
 		return tval;
 	}
 
-	if (tval == 65535)
-		return -ENODATA;
-
 	return tval * 60;
 }
 
-- 
2.20.1


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

end of thread, other threads:[~2021-04-01  8:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-31 13:51 [PATCH] power: supply: bq27xxx: Return the value instead of -ENODATA Hermes Zhang
2021-03-31 14:02 ` Pali Rohár
2021-04-01  1:51   ` Hermes Zhang
2021-04-01  8:50     ` Pali Rohár

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).