Commit d09f360e6a56a2b982ac3436aa94382c7a8c5a68

Kano 2014-03-06T00:40:51

Ant - get more work if roll limit is reached

diff --git a/driver-bitmain.c b/driver-bitmain.c
index e1a1d99..67ae300 100644
--- a/driver-bitmain.c
+++ b/driver-bitmain.c
@@ -1414,9 +1414,11 @@ static bool bitmain_fill(struct cgpu_info *bitmain)
 		queuednum = bitmain->queued;
 		applog(LOG_DEBUG, "BTM: Work task queued(%d) fifo space(%d) needsend(%d)",
 				  queuednum, info->fifo_space, neednum);
-		if (queuednum < neednum) {
+		while (queuednum < neednum) {
 			work = get_queued(bitmain);
-			if (work) {
+			if (!work)
+				break;
+			else {
 				roll_limit = work->drv_rolllimit;
 				roll = 0;
 				while (queuednum < neednum && roll <= roll_limit) {
@@ -1471,11 +1473,11 @@ static bool bitmain_fill(struct cgpu_info *bitmain)
 		info->send_full_space += sendnum;
 		if (bitmain->queued < 0)
 			bitmain->queued = 0;
-		if (bitmain->work_array + sendnum > BITMAIN_ARRAY_SIZE) {
+		if (bitmain->work_array + sendnum > BITMAIN_ARRAY_SIZE)
 			bitmain->work_array = bitmain->work_array + sendnum-BITMAIN_ARRAY_SIZE;
-		} else {
+		else
 			bitmain->work_array += sendnum;
-		}
+
 		applog(LOG_DEBUG, "BTM: Send work array %d", bitmain->work_array);
 		if (sendlen > 0) {
 			info->fifo_space -= sendcount;