Use the share_work_tdiff function in the driver watchdogs.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
diff --git a/driver-bitfury.c b/driver-bitfury.c
index 65aab5b..1d50e42 100644
--- a/driver-bitfury.c
+++ b/driver-bitfury.c
@@ -943,9 +943,9 @@ static int64_t bitfury_scanwork(struct thr_info *thr)
struct bitfury_info *info = bitfury->device_data;
int64_t ret = -1;
- if (unlikely(last_getwork - bitfury->last_device_valid_work > 60)) {
+ if (unlikely(share_work_tdiff(bitfury) > 60)) {
if (info->failing) {
- if (last_getwork - bitfury->last_device_valid_work > 120) {
+ if (share_work_tdiff(bitfury) > 120) {
applog(LOG_ERR, "%s %d: Device failed to respond to restart",
bitfury->drv->name, bitfury->device_id);
return ret;
diff --git a/driver-hashfast.c b/driver-hashfast.c
index fad5275..af655ef 100644
--- a/driver-hashfast.c
+++ b/driver-hashfast.c
@@ -1316,7 +1316,7 @@ static int64_t hfa_scanwork(struct thr_info *thr)
* the current expected hashrate. */
fail_time = 25.0 * (double)hashfast->drv->max_diff * 0xffffffffull /
(double)(info->base_clock * 1000000) / hfa_basejobs(info);
- if (unlikely(last_getwork - hashfast->last_device_valid_work > fail_time)) {
+ if (unlikely(share_work_tdiff(hashfast) > fail_time)) {
applog(LOG_WARNING, "%s %d: No valid hashes for over %.0f seconds, attempting to reset",
hashfast->drv->name, hashfast->device_id, fail_time);
if (info->hash_clock_rate > HFA_CLOCK_DEFAULT) {
diff --git a/driver-icarus.c b/driver-icarus.c
index 1c0846e..9f78886 100644
--- a/driver-icarus.c
+++ b/driver-icarus.c
@@ -1283,9 +1283,9 @@ static int64_t icarus_scanwork(struct thr_info *thr)
uint32_t values;
int64_t hash_count_range;
- if (unlikely(last_getwork - icarus->last_device_valid_work > info->fail_time)) {
+ if (unlikely(share_work_tdiff(icarus) > info->fail_time)) {
if (info->failing) {
- if (last_getwork - icarus->last_device_valid_work > info->fail_time + 60) {
+ if (share_work_tdiff(icarus) > info->fail_time + 60) {
applog(LOG_ERR, "%s %d: Device failed to respond to restart",
icarus->drv->name, icarus->device_id);
return -1;