Commit 18710b14d2285c5fee04091ede20a47bee90eb38

Con Kolivas 2013-05-25T15:18:31

Check for avalon_wait_write before sending reset command.

diff --git a/driver-avalon.c b/driver-avalon.c
index 1196702..d0c05af 100644
--- a/driver-avalon.c
+++ b/driver-avalon.c
@@ -400,11 +400,6 @@ static void avalon_idle(struct cgpu_info *avalon, int fd)
 	struct avalon_info *info = avalon->device_data;
 	int i;
 
-	if (!avalon_wait_write(fd)) {
-		applog(LOG_WARNING, "Avalon not ready for writes in avalon_idle");
-		return;
-	}
-
 	for (i = 0; i < info->miner_count; i++) {
 		struct avalon_task at;
 		int ret;
@@ -433,6 +428,11 @@ static int avalon_reset(struct cgpu_info *avalon, int fd)
 	int ret, i = 0;
 	struct timespec p;
 
+	if (!avalon_wait_write(fd)) {
+		applog(LOG_WARNING, "Avalon not ready for writes in avalon_reset");
+		return 1;
+	}
+
 	/* Reset once, then send command to go idle */
 	ret = avalon_write(fd, "ad", 2);
 	if (unlikely(ret == AVA_SEND_ERROR))