Browse Source

Merge commit 'c62b985' into update_avalon_20130524

Luke Dashjr 13 years ago
parent
commit
1e89b3f078
1 changed files with 3 additions and 2 deletions
  1. 3 2
      driver-avalon.c

+ 3 - 2
driver-avalon.c

@@ -903,7 +903,7 @@ static int64_t avalon_scanhash(struct thr_info *thr)
 			info->no_matching_work++;
 			result_wrong++;
 
-			if (result_wrong >= avalon_get_work_count)
+			if (unlikely(result_wrong >= avalon_get_work_count))
 				break;
 
 			if (opt_debug) {
@@ -924,7 +924,8 @@ static int64_t avalon_scanhash(struct thr_info *thr)
 			       elapsed.tv_sec, elapsed.tv_usec);
 		}
 	}
-	if (result_wrong >= avalon_get_work_count || hash_count == 0) {
+	if (unlikely(result_wrong >= avalon_get_work_count ||
+	    (hash_count == 0 && ret != AVA_GETS_RESTART))) {
 		/* This means FPGA controller gave all wrong results, so
 		 * try to reset the Avalon */
 		do_avalon_close(thr);