Skip to contentSkip to conversation

hwmon: (max16065) Fix current calculation

PATCH In review Guenter Roeck 2 participants 3 messages Aug 28, 2011 – Aug 29, 2011 Hardware monitoring

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hwmon: (max16065) Fix current calculation

Current calculation is completely wrong. Add missing brackets to fix it.

---
Candidate for stable (2.6.39+).

 drivers/hwmon/max16065.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/hwmon/max16065.c +1 -1
index d94a24f..dd2d7b9 100644
@@ -124,7 +124,7 @@ static inline int MV_TO_LIMIT(int mv, int range)
 
 static inline int ADC_TO_CURR(int adc, int gain)
 {
-	return adc * 1400000 / gain * 255;
+	return adc * 1400000 / (gain * 255);
 }
 
 /*
Signature · 7 lines
1.7.3.1


_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Acked-by on v1 1/1
#1 lore raw
Quoted 14 lines · Guenter Roeck

Current calculation is completely wrong. Add missing brackets to fix it.

---
Candidate for stable (2.6.39+).

 drivers/hwmon/max16065.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/hwmon/max16065.c +0 -0
index d94a24f..dd2d7b9 100644

drivers/hwmon/max16065.c static inline int MV_TO_LIMIT(int mv, int range) · line 130

Quoted 8 lines
drivers/hwmon/max16065.c +1 -1
@@ -124,7 +124,7 @@ static inline int MV_TO_LIMIT(int mv, int range)
 
 static inline int ADC_TO_CURR(int adc, int gain)
 {
-	return adc * 1400000 / gain * 255;
+	return adc * 1400000 / (gain * 255);
 }
 
 /*

Good catch.

Signature · 6 lines
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
#2 lore raw
In reply to Guenter Roeck
Quoted 22 lines · Jean Delvare
Quoted 21 lines · Guenter Roeck

Current calculation is completely wrong. Add missing brackets to fix it.

---
Candidate for stable (2.6.39+).

 drivers/hwmon/max16065.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/hwmon/max16065.c +1 -1
index d94a24f..dd2d7b9 100644
@@ -124,7 +124,7 @@ static inline int MV_TO_LIMIT(int mv, int range)
 
 static inline int ADC_TO_CURR(int adc, int gain)
 {
-	return adc * 1400000 / gain * 255;
+	return adc * 1400000 / (gain * 255);
 }
 
Quoted 6 lines

drivers/hwmon/max16065.c static inline int MV_TO_LIMIT(int mv, int range) · line 130

Quoted 1 line
drivers/hwmon/max16065.c +0 -0
 /*

Good catch.

I'd call it embarrassing not to have caught it earlier ...

Thanks a lot for the review!

Guenter

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors