Commit 18d1a9d71227e2186b96f35ccdcdbbc74ff911ee

Con Kolivas 2013-11-14T11:35:47

Remove the buffer from bitfury info since it is only used on one pass in the bf1 device.

diff --git a/driver-bitfury.c b/driver-bitfury.c
index 9d77ded..993ec7d 100644
--- a/driver-bitfury.c
+++ b/driver-bitfury.c
@@ -276,11 +276,11 @@ static int64_t bf1_scan(struct thr_info *thr, struct cgpu_info *bitfury,
 			struct bitfury_info *info)
 {
 	int amount, i, aged = 0, total = 0, ms_diff;
+	char readbuf[512], buf[45];
 	struct work *work, *tmp;
 	struct timeval tv_now;
 	double nonce_rate;
 	int64_t ret = 0;
-	char buf[45];
 
 	work = get_queue_work(thr, bitfury, thr->id);
 	if (unlikely(thr->work_restart)) {
@@ -298,7 +298,7 @@ static int64_t bf1_scan(struct thr_info *thr, struct cgpu_info *bitfury,
 	cgtime(&tv_now);
 	ms_diff = 600 - ms_tdiff(&tv_now, &info->tv_start);
 	if (ms_diff > 0) {
-		usb_read_timeout_cancellable(bitfury, info->buf, 512, &amount, ms_diff,
+		usb_read_timeout_cancellable(bitfury, readbuf, 512, &amount, ms_diff,
 					     C_BF1_GETRES);
 		total += amount;
 	}
@@ -310,11 +310,11 @@ static int64_t bf1_scan(struct thr_info *thr, struct cgpu_info *bitfury,
 	/* If a work restart was sent, just empty the buffer. */
 	if (unlikely(ms_diff < 10 || thr->work_restart))
 		ms_diff = 10;
-	usb_read_once_timeout_cancellable(bitfury, info->buf + total, BF1MSGSIZE,
+	usb_read_once_timeout_cancellable(bitfury, readbuf + total, BF1MSGSIZE,
 					  &amount, ms_diff, C_BF1_GETRES);
 	total += amount;
 	while (amount) {
-		usb_read_once_timeout(bitfury, info->buf + total, 512, &amount, 10,
+		usb_read_once_timeout(bitfury, readbuf + total, 512, &amount, 10,
 				      C_BF1_GETRES);
 		total += amount;
 	};
@@ -339,7 +339,7 @@ out:
 		uint32_t nonce;
 
 		/* Ignore state & switched data in results for now. */
-		memcpy(&nonce, info->buf + i + 3, 4);
+		memcpy(&nonce, readbuf + i + 3, 4);
 		nonce = decnonce(nonce);
 
 		rd_lock(&bitfury->qlock);
diff --git a/driver-bitfury.h b/driver-bitfury.h
index 7ab6908..dc16e50 100644
--- a/driver-bitfury.h
+++ b/driver-bitfury.h
@@ -16,14 +16,15 @@
 struct bitfury_info {
 	struct cgpu_info *base_cgpu;
 	enum sub_ident ident;
-	uint8_t version;
-	char product[8];
-	uint32_t serial;
-	char buf[512];
 	int nonces;
 	int total_nonces;
 	double saved_nonces;
 	int cycles;
+
+	/* BF1 specific data */
+	uint8_t version;
+	char product[8];
+	uint32_t serial;
 	struct timeval tv_start;
 };