From 210537198c56a372064638b1200d4a2be0cfebbc Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Sat, 9 Feb 2013 19:52:00 +1100 Subject: [PATCH] Provide a noop prepare_work for drivers that don't support it. --- cgminer.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cgminer.c b/cgminer.c index 41bbcab3..8d997d01 100644 --- a/cgminer.c +++ b/cgminer.c @@ -5406,7 +5406,7 @@ void *miner_thread(void *userdata) gettimeofday(&tv_workstart, NULL); work->blk.nonce = 0; cgpu->max_hashes = 0; - if (drv->prepare_work && !drv->prepare_work(mythr, work)) { + if (!drv->prepare_work(mythr, work)) { applog(LOG_ERR, "work prepare failed, exiting " "mining thread %d", thr_id); break; @@ -6399,6 +6399,11 @@ static bool noop_thread_init(struct thr_info __maybe_unused *thr) return true; } +static bool noop_prepare_work(struct thr_info __maybe_unused *thr, struct work __maybe_unused *work) +{ + return true; +} + /* Fill missing driver api functions with noops */ void fill_device_api(struct cgpu_info *cgpu) { @@ -6418,6 +6423,8 @@ void fill_device_api(struct cgpu_info *cgpu) drv->can_limit_work = &noop_can_limit_work; if (!drv->thread_init) drv->thread_init = &noop_thread_init; + if (!drv->prepare_work) + drv->prepare_work = &noop_prepare_work; } void enable_device(struct cgpu_info *cgpu)