Skip to contentSkip to conversation

spitz pm: adjust messages

PATCH Pavel Machek 3 participants 4 messages May 21, 2011 – May 26, 2011

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Charger error is something that should be reported to the syslog; do it. If temperature reading fails, we do not want to charge the battery, anyway.

arch/arm/mach-pxa/sharpsl_pm.c +6 -2
index 785880f..513588c 100644
@@ -317,6 +302,8 @@ static void sharpsl_charge_off(void)
 
 static void sharpsl_charge_error(void)
 {
+	dev_warn(sharpsl_pm.dev, "Charger Error\n");
+
 	sharpsl_pm_led(SHARPSL_LED_ERROR);
 	sharpsl_pm.machinfo->charge(0);
 	sharpsl_pm.charge_mode = CHRG_ERROR;
@@ -513,8 +500,10 @@ static int sharpsl_check_battery_temp(void)
 	val = get_select_val(buff);
 
 	dev_dbg(sharpsl_pm.dev, "Temperature: %d\n", val);
-	if (val > sharpsl_pm.machinfo->charge_on_temp) {
-		printk(KERN_WARNING "Not charging: temperature out of limits.\n");
+	/* FIXME: this should catch battery read errors, but we should
+	   probably avoid charging in <0C temperatures, too. */
+	if ((val < 0) || (val > sharpsl_pm.machinfo->charge_on_temp)) {
+		dev_warn(sharpsl_pm.dev, "Not charging: temperature %d out of limits.\n", val);
 		return -1;
 	}
 
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Acked-by
#1 lore raw
Quoted 21 lines · Pavel Machek

Charger error is something that should be reported to the syslog; do it. If temperature reading fails, we do not want to charge the battery, anyway.

(quoted diff) +0 -0

b/arch/arm/mach-pxa/sharpsl_pm.c index 785880f..513588c 100644

arch/arm/mach-pxa/sharpsl_pm.c +2 -0
@@ -317,6 +302,8 @@ static void sharpsl_charge_off(void)
 
 static void sharpsl_charge_error(void)
 {
+	dev_warn(sharpsl_pm.dev, "Charger Error\n");
+
 	sharpsl_pm_led(SHARPSL_LED_ERROR);
 	sharpsl_pm.machinfo->charge(0);
 	sharpsl_pm.charge_mode = CHRG_ERROR;
@@ -513,8 +500,10 @@ static int sharpsl_check_battery_temp(void)
 	val = get_select_val(buff);

arch/arm/mach-pxa/sharpsl_pm.c static int sharpsl_check_battery_temp(void) · line 508

Quoted 10 lines
arch/arm/mach-pxa/sharpsl_pm.c +4 -2
 
 	dev_dbg(sharpsl_pm.dev, "Temperature: %d\n", val);
-	if (val > sharpsl_pm.machinfo->charge_on_temp) {
-		printk(KERN_WARNING "Not charging: temperature out of limits.\n");
+	/* FIXME: this should catch battery read errors, but we should
+	   probably avoid charging in <0C temperatures, too. */
+	if ((val < 0) || (val > sharpsl_pm.machinfo->charge_on_temp)) {
+		dev_warn(sharpsl_pm.dev, "Not charging: temperature %d out of
 limits.\n", val); return -1;
 	}
#2 lore raw
In reply to Pavel Machek

Hello.

Quoted 10 lines · Pavel Machek

Charger error is something that should be reported to the syslog; do it. If temperature reading fails, we do not want to charge the battery, anyway.

arch/arm/mach-pxa/sharpsl_pm.c +0 -0
index 785880f..513588c 100644

[...]

arch/arm/mach-pxa/sharpsl_pm.c static int sharpsl_check_battery_temp(void) · line 504

Quoted 8 lines
arch/arm/mach-pxa/sharpsl_pm.c +2 -2
@@ -513,8 +500,10 @@ static int sharpsl_check_battery_temp(void)
  	val = get_select_val(buff);
 
  	dev_dbg(sharpsl_pm.dev, "Temperature: %d\n", val);
-	if (val>  sharpsl_pm.machinfo->charge_on_temp) {
-		printk(KERN_WARNING "Not charging: temperature out of limits.\n");
+	/* FIXME: this should catch battery read errors, but we should
+	   probably avoid charging in<0C temperatures, too. */

The preferred style of the multi-line comments is this:

/*
* bla
* bla
*/

WBR, Sergei

#3 lore raw
In reply to Pavel Machek

Eric, it should probably be you merging this and surrounding patches... Any comments? Merge?
Pavel

Quoted 40 lines · Pavel Machek

Charger error is something that should be reported to the syslog; do it. If temperature reading fails, we do not want to charge the battery, anyway.

arch/arm/mach-pxa/sharpsl_pm.c +6 -2
index 785880f..513588c 100644
@@ -317,6 +302,8 @@ static void sharpsl_charge_off(void)
 
 static void sharpsl_charge_error(void)
 {
+	dev_warn(sharpsl_pm.dev, "Charger Error\n");
+
 	sharpsl_pm_led(SHARPSL_LED_ERROR);
 	sharpsl_pm.machinfo->charge(0);
 	sharpsl_pm.charge_mode = CHRG_ERROR;
@@ -513,8 +500,10 @@ static int sharpsl_check_battery_temp(void)
 	val = get_select_val(buff);
 
 	dev_dbg(sharpsl_pm.dev, "Temperature: %d\n", val);
-	if (val > sharpsl_pm.machinfo->charge_on_temp) {
-		printk(KERN_WARNING "Not charging: temperature out of limits.\n");
+	/* FIXME: this should catch battery read errors, but we should
+	   probably avoid charging in <0C temperatures, too. */
+	if ((val < 0) || (val > sharpsl_pm.machinfo->charge_on_temp)) {
+		dev_warn(sharpsl_pm.dev, "Not charging: temperature %d out of limits.\n", val);
 		return -1;
 	}
 
Signature · 7 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html