Fix record_temp_fan function in avalon driver. Patch by Xiangfu <xiangfu@openmobilefree.net>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
diff --git a/driver-avalon.c b/driver-avalon.c
index 4de52d5..b263d0a 100644
--- a/driver-avalon.c
+++ b/driver-avalon.c
@@ -721,8 +721,6 @@ static void do_avalon_close(struct thr_info *thr)
static inline void record_temp_fan(struct avalon_info *info, struct avalon_result *ar, float *temp_avg)
{
- int max;
-
info->fan0 = ar->fan0 * AVALON_FAN_FACTOR;
info->fan1 = ar->fan1 * AVALON_FAN_FACTOR;
info->fan2 = ar->fan2 * AVALON_FAN_FACTOR;
@@ -745,22 +743,12 @@ static inline void record_temp_fan(struct avalon_info *info, struct avalon_resul
*temp_avg = info->temp2;
- max = info->temp_max;
- if (info->temp0 > max)
- max = info->temp0;
- if (info->temp1 > max)
- max = info->temp1;
- if (info->temp2 > max)
- max = info->temp2;
- if (max >= 100) { /* FIXME: fix the root cause on fpga controller firmware */
- if (opt_debug) {
- applog(LOG_DEBUG, "Avalon: temp_max: %d", max);
- hexdump((uint8_t *)ar, AVALON_READ_SIZE);
- }
- return;
- }
-
- info->temp_max = max;
+ if (info->temp0 > info->temp_max)
+ info->temp_max = info->temp0;
+ if (info->temp1 > info->temp_max)
+ info->temp_max = info->temp1;
+ if (info->temp2 > info->temp_max)
+ info->temp_max = info->temp2;
}
static inline void adjust_fan(struct avalon_info *info)