Browse Source

bitmain: Use the hottest reading for device temperature

Luke Dashjr 10 years ago
parent
commit
299e2f711a
2 changed files with 6 additions and 12 deletions
  1. 6 10
      driver-bitmain.c
  2. 0 2
      driver-bitmain.h

+ 6 - 10
driver-bitmain.c

@@ -792,11 +792,11 @@ static void bitmain_inc_nvw(struct bitmain_info *info, struct thr_info *thr)
 	info->no_matching_work++;
 }
 
-static inline void record_temp_fan(struct bitmain_info *info, struct bitmain_rxstatus_data *bm, float *temp_avg)
+static inline void record_temp_fan(struct bitmain_info *info, struct bitmain_rxstatus_data *bm, float *temp)
 {
 	int i = 0;
 	int maxfan = 0, maxtemp = 0;
-	*temp_avg = 0;
+	int temp_avg = 0;
 
 	info->fan_num = bm->fan_num;
 	for(i = 0; i < bm->fan_num; i++) {
@@ -813,7 +813,7 @@ static inline void record_temp_fan(struct bitmain_info *info, struct bitmain_rxs
 			bm->temp[i] &= 0x7f;
 			info->temp[i] = 0 - ((~bm->temp[i] & 0x7f) + 1);
 		}*/
-		*temp_avg += info->temp[i];
+		temp_avg += info->temp[i];
 
 		if(info->temp[i] > info->temp_max) {
 			info->temp_max = info->temp[i];
@@ -823,15 +823,11 @@ static inline void record_temp_fan(struct bitmain_info *info, struct bitmain_rxs
 	}
 
 	if(bm->temp_num > 0) {
-		*temp_avg = *temp_avg / bm->temp_num;
-		info->temp_avg = *temp_avg;
+		temp_avg /= bm->temp_num;
+		info->temp_avg = temp_avg;
 	}
 
-	// inc_dev_status
-	mutex_lock(&stats_lock);
-	info->g_max_fan = maxfan;
-	info->g_max_temp = maxtemp;
-	mutex_unlock(&stats_lock);
+	*temp = maxtemp;
 }
 
 static void bitmain_update_temps(struct cgpu_info *bitmain, struct bitmain_info *info,

+ 0 - 2
driver-bitmain.h

@@ -286,8 +286,6 @@ struct bitmain_info {
 	bool optimal;
 	
 	char g_miner_version[256];
-	int g_max_fan;
-	int g_max_temp;
 };
 
 #define BITMAIN_READ_SIZE 12