Merge branch 'master' of github.com:ckolivas/cgminer
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 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
diff --git a/api.c b/api.c
index 07f6c39..302196d 100644
--- a/api.c
+++ b/api.c
@@ -1625,10 +1625,14 @@ uint64_t api_trylock(void *lock, const char *file, const char *func, const int l
LOCKINFO *info;
uint64_t id;
+ locklock();
+
info = findlock(lock, CGLOCK_UNKNOWN, file, func, linenum);
id = lock_id++;
addgettry(info, id, file, func, linenum, false);
+ lockunlock();
+
return id;
}
diff --git a/driver-bab.c b/driver-bab.c
index 545e8bb..7db3df1 100644
--- a/driver-bab.c
+++ b/driver-bab.c
@@ -17,7 +17,8 @@
#include "sha2.h"
/*
- * Tested on RPi running Raspbian with BlackArrow BitFury V1 16 chip GPIO board
+ * Tested on RPi running both Raspbian and Arch
+ * with BlackArrow BitFury V1 16 chip GPIO board
*/
#ifndef LINUX
diff --git a/driver-klondike.c b/driver-klondike.c
index 2446202..3a740ec 100644
--- a/driver-klondike.c
+++ b/driver-klondike.c
@@ -1129,26 +1129,28 @@ static void klondike_flush_work(struct cgpu_info *klncgpu)
KLINE kline;
int slaves, dev;
- wr_lock(&(klninfo->stat_lock));
- klninfo->block_seq++;
- slaves = klninfo->status[0].kline.ws.slavecount;
- wr_unlock(&(klninfo->stat_lock));
+ if (klninfo->initialised) {
+ wr_lock(&(klninfo->stat_lock));
+ klninfo->block_seq++;
+ slaves = klninfo->status[0].kline.ws.slavecount;
+ wr_unlock(&(klninfo->stat_lock));
- applog(LOG_DEBUG, "%s%i: flushing work",
- klncgpu->drv->name, klncgpu->device_id);
- zero_kline(&kline);
- kline.hd.cmd = KLN_CMD_ABORT;
- for (dev = 0; dev <= slaves; dev++) {
- kline.hd.dev = dev;
- kitem = SendCmdGetReply(klncgpu, &kline, KSENDHD(0));
- if (kitem != NULL) {
- wr_lock(&(klninfo->stat_lock));
- memcpy((void *)&(klninfo->status[dev]),
- kitem,
- sizeof(klninfo->status[dev]));
- klninfo->jobque[dev].flushed = true;
- wr_unlock(&(klninfo->stat_lock));
- kitem = release_kitem(klncgpu, kitem);
+ applog(LOG_DEBUG, "%s%i: flushing work",
+ klncgpu->drv->name, klncgpu->device_id);
+ zero_kline(&kline);
+ kline.hd.cmd = KLN_CMD_ABORT;
+ for (dev = 0; dev <= slaves; dev++) {
+ kline.hd.dev = dev;
+ kitem = SendCmdGetReply(klncgpu, &kline, KSENDHD(0));
+ if (kitem != NULL) {
+ wr_lock(&(klninfo->stat_lock));
+ memcpy((void *)&(klninfo->status[dev]),
+ kitem,
+ sizeof(klninfo->status[dev]));
+ klninfo->jobque[dev].flushed = true;
+ wr_unlock(&(klninfo->stat_lock));
+ kitem = release_kitem(klncgpu, kitem);
+ }
}
}
}