lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:	Tue, 21 Aug 2012 17:06:38 +0900
From:	Chanwoo Choi <cw00.choi@...sung.com>
To:	anton.vorontsov@...aro.org
Cc:	cbouatmailru@...il.com, jenny.tc@...el.com,
	ramakrishna.pallala@...el.com, myungjoo.ham@...sung.com,
	kyungmin.park@...sung.com, linux-kernel@...r.kernel.org,
	Chanwoo Choi <cw00.choi@...sung.com>
Subject: [PATCH 1/5] charger-manager: Disable battery charging when charger
 cable is detached

This patch disable before stop chargint forcibly when charger cable
is detached and check return value of regulator_enable/disable() fucntion
to confirm correct opertion of enabling/disabling charger(regulator).

Signed-off-by: Chanwoo Choi <cw00.choi@...sung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@...sung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@...sung.com>
---
 drivers/power/charger-manager.c |   21 +++++++++++++++++++--
 1 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/drivers/power/charger-manager.c b/drivers/power/charger-manager.c
index 526e5c9..f968301 100644
--- a/drivers/power/charger-manager.c
+++ b/drivers/power/charger-manager.c
@@ -271,9 +271,26 @@ static int try_charger_enable(struct charger_manager *cm, bool enable)
 	if (enable) {
 		if (cm->emergency_stop)
 			return -EAGAIN;
-		for (i = 0 ; i < desc->num_charger_regulators ; i++)
-			regulator_enable(desc->charger_regulators[i].consumer);
+		for (i = 0 ; i < desc->num_charger_regulators ; i++) {
+			err = regulator_enable(
+				desc->charger_regulators[i].consumer);
+			if (err < 0) {
+				dev_warn(cm->dev,
+				"Cannot enable %s regulator\n",
+				desc->charger_regulators[i].regulator_name);
+			}
+		}
 	} else {
+		for (i = 0 ; i < desc->num_charger_regulators ; i++) {
+			err = regulator_disable(
+				desc->charger_regulators[i].consumer);
+			if (err < 0) {
+				dev_warn(cm->dev,
+				"Cannot disable %s regulator\n",
+				desc->charger_regulators[i].regulator_name);
+			}
+		}
+
 		/*
 		 * Abnormal battery state - Stop charging forcibly,
 		 * even if charger was enabled at the other places
-- 
1.7.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ