Skip to contentSkip to conversation

power: supply: qcom_battmgr: return charge threshold write errors

PATCH Applied Hungyu Lin 2 participants 2 messages Nov 13 – Nov 15

Subsystems (3)
lore
Share & tools
lore

Hungyu Lin

author
#0 lore raw

PATCH 1/1 power: supply: qcom_battmgr: return charge threshold write errors

Both charge threshold setters return success even when qcom_battmgr_set_charge_control() fails. If the PMIC GLINK transport returns an error or the firmware does not reply in time, the sysfs write still reports that it consumed the input while the cached thresholds retain their previous values.

Return the request status from both setters so userspace can detect the failed write.

Fixes cc3e883a0625 ("power: supply: qcom_battmgr: Add charge control support")
---
 drivers/power/supply/qcom_battmgr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/power/supply/qcom_battmgr.c +2 -2
index 636d6f6acecc..f14d731e0283 100644
@@ -704,7 +704,7 @@ static int qcom_battmgr_set_charge_start_threshold(struct qcom_battmgr *battmgr,
 		battmgr->info.charge_ctrl_end = target_soc;
 	}
 
-	return 0;
+	return ret;
 }
 
 static int qcom_battmgr_set_charge_end_threshold(struct qcom_battmgr *battmgr, int end_soc)
@@ -725,7 +725,7 @@ static int qcom_battmgr_set_charge_end_threshold(struct qcom_battmgr *battmgr, i
 		battmgr->info.charge_ctrl_end = end_soc;
 	}
 
-	return 0;
+	return ret;
 }
 
 static int qcom_battmgr_charge_control_thresholds_init(struct qcom_battmgr *battmgr)

base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4

#1 lore raw
Quoted 10 lines · Hungyu Lin

Both charge threshold setters return success even when qcom_battmgr_set_charge_control() fails. If the PMIC GLINK transport returns an error or the firmware does not reply in time, the sysfs write still reports that it consumed the input while the cached thresholds retain their previous values.

Return the request status from both setters so userspace can detect the failed write.

[...]

Applied, thanks!

[1/1] power: supply: qcom_battmgr: return charge threshold write errors

      commit: ffce9bb777f28733e981928fb19f2d13be40b6b9

Best regards,

Signature · 1 line
Sebastian Reichel <[email protected]>