Commit 5b22f092d9358cf4c4cac48957af7be0fff2b7de

Con Kolivas 2013-02-09T19:36:38

Provide a noop thread_prepare function for drivers that don't use thread_prepare.

diff --git a/cgminer.c b/cgminer.c
index acf3880..4b33a43 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -6384,6 +6384,11 @@ static bool noop_get_stats(struct cgpu_info __maybe_unused *cgpu)
 	return true;
 }
 
+static bool noop_thread_prepare(struct thr_info __maybe_unused *thr)
+{
+	return true;
+}
+
 /* Fill missing driver api functions with noops */
 void fill_device_api(struct cgpu_info *cgpu)
 {
@@ -6397,6 +6402,8 @@ void fill_device_api(struct cgpu_info *cgpu)
 		drv->get_statline = &noop_get_statline;
 	if (!drv->get_stats)
 		drv->get_stats = &noop_get_stats;
+	if (!drv->thread_prepare)
+		drv->thread_prepare = &noop_thread_prepare;
 }
 
 void enable_device(struct cgpu_info *cgpu)
@@ -6905,7 +6912,7 @@ begin_bench:
 				tq_push(thr->q, &ping);
 			}
 
-			if (cgpu->drv->thread_prepare && !cgpu->drv->thread_prepare(thr))
+			if (!cgpu->drv->thread_prepare(thr))
 				continue;
 
 			thread_reportout(thr);