Commit b9f5b48c08bd692182056741cfe3df55a77ac4b8

Con Kolivas 2013-02-09T19:50:07

Provide a noop thread_init for drivers that don't support it.

diff --git a/cgminer.c b/cgminer.c
index 6443427..41bbcab 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -5386,7 +5386,7 @@ void *miner_thread(void *userdata)
 
 	gettimeofday(&getwork_start, NULL);
 
-	if (drv->thread_init && !drv->thread_init(mythr)) {
+	if (!drv->thread_init(mythr)) {
 		dev_error(cgpu, REASON_THREAD_FAIL_INIT);
 		goto out;
 	}
@@ -6394,6 +6394,11 @@ static uint64_t noop_can_limit_work(struct thr_info __maybe_unused *thr)
 	return 0xffffffff;
 }
 
+static bool noop_thread_init(struct thr_info __maybe_unused *thr)
+{
+	return true;
+}
+
 /* Fill missing driver api functions with noops */
 void fill_device_api(struct cgpu_info *cgpu)
 {
@@ -6411,6 +6416,8 @@ void fill_device_api(struct cgpu_info *cgpu)
 		drv->thread_prepare = &noop_thread_prepare;
 	if (!drv->can_limit_work)
 		drv->can_limit_work = &noop_can_limit_work;
+	if (!drv->thread_init)
+		drv->thread_init = &noop_thread_init;
 }
 
 void enable_device(struct cgpu_info *cgpu)