Browse Source

klondike fix bracket tabs indenting

nfactor-troky
Kano 11 years ago committed by Con Kolivas
parent
commit
e8d49bc0bb
  1. 23
      driver-klondike.c

23
driver-klondike.c

@ -147,7 +147,7 @@ static char *SendCmdGetReply(struct cgpu_info *klncgpu, char Cmd, int device, in
chkreply = 0; chkreply = 0;
if (chkreply == klninfo->nextreply) if (chkreply == klninfo->nextreply)
break; break;
} }
if (chkreply == klninfo->nextreply) if (chkreply == klninfo->nextreply)
continue; continue;
*(klninfo->replies + chkreply*REPLY_BUFSIZE) = '!'; // mark to prevent re-use *(klninfo->replies + chkreply*REPLY_BUFSIZE) = '!'; // mark to prevent re-use
@ -173,7 +173,7 @@ static bool klondike_get_stats(struct cgpu_info *klncgpu)
char *reply = SendCmdGetReply(klncgpu, 'S', dev, 0, NULL); char *reply = SendCmdGetReply(klncgpu, 'S', dev, 0, NULL);
if (reply != NULL) if (reply != NULL)
klninfo->status[dev] = *(WORKSTATUS *)(reply+2); klninfo->status[dev] = *(WORKSTATUS *)(reply+2);
} }
wr_unlock(&(klninfo->stat_lock)); wr_unlock(&(klninfo->stat_lock));
// todo: detect slavecount change and realloc space // todo: detect slavecount change and realloc space
@ -204,7 +204,7 @@ static bool klondike_init(struct cgpu_info *klncgpu)
klninfo->cfg = calloc(slaves+1, sizeof(WORKCFG)); klninfo->cfg = calloc(slaves+1, sizeof(WORKCFG));
if (unlikely(!klninfo->cfg)) if (unlikely(!klninfo->cfg))
quit(1, "Failed to calloc cfg array in klondke_get_stats"); quit(1, "Failed to calloc cfg array in klondke_get_stats");
} }
WORKCFG cfgset = { 0,0,0,0,0 }; // zero init triggers read back only WORKCFG cfgset = { 0,0,0,0,0 }; // zero init triggers read back only
double temp1, temp2; double temp1, temp2;
@ -227,8 +227,8 @@ static bool klondike_init(struct cgpu_info *klncgpu)
cvtKlnToC(klninfo->cfg[dev].temptarget), cvtKlnToC(klninfo->cfg[dev].temptarget),
cvtKlnToC(klninfo->cfg[dev].tempcritical), cvtKlnToC(klninfo->cfg[dev].tempcritical),
(int)100*klninfo->cfg[dev].fantarget/256); (int)100*klninfo->cfg[dev].fantarget/256);
}
} }
}
klondike_get_stats(klncgpu); klondike_get_stats(klncgpu);
for (dev = 0; dev <= slaves; dev++) { for (dev = 0; dev <= slaves; dev++) {
klninfo->devinfo[dev].rangesize = ((uint64_t)1<<32) / klninfo->status[dev].chipcount; klninfo->devinfo[dev].rangesize = ((uint64_t)1<<32) / klninfo->status[dev].chipcount;
@ -285,7 +285,7 @@ static bool klondike_detect_one(struct libusb_device *dev, struct usb_find_devic
break; break;
applog(LOG_DEBUG, "Klondike cgpu added"); applog(LOG_DEBUG, "Klondike cgpu added");
return true; return true;
} }
} }
usb_uninit(klncgpu); usb_uninit(klncgpu);
} }
@ -325,8 +325,8 @@ static void klondike_check_nonce(struct cgpu_info *klncgpu, WORKRESULT *result)
applog(LOG_DEBUG, "Klondike chip stats %d, %08x, %d, %d", result->device, result->nonce, klninfo->devinfo[result->device].rangesize, klninfo->status[result->device].chipcount); applog(LOG_DEBUG, "Klondike chip stats %d, %08x, %d, %d", result->device, result->nonce, klninfo->devinfo[result->device].rangesize, klninfo->status[result->device].chipcount);
klninfo->devinfo[result->device].chipstats[(result->nonce / klninfo->devinfo[result->device].rangesize) + (ok ? 0 : klninfo->status[result->device].chipcount)]++; klninfo->devinfo[result->device].chipstats[(result->nonce / klninfo->devinfo[result->device].rangesize) + (ok ? 0 : klninfo->status[result->device].chipcount)]++;
return; return;
}
} }
}
applog(LOG_ERR, "%s%i:%d unknown work (%02x:%08x) - ignored", applog(LOG_ERR, "%s%i:%d unknown work (%02x:%08x) - ignored",
klncgpu->drv->name, klncgpu->device_id, result->device, result->workid, result->nonce); klncgpu->drv->name, klncgpu->device_id, result->device, result->workid, result->nonce);
@ -452,10 +452,10 @@ static bool klondike_send_work(struct cgpu_info *klncgpu, int dev, struct work *
work->subid = dev*256 + data.workid; work->subid = dev*256 + data.workid;
if (opt_log_level <= LOG_DEBUG) { if (opt_log_level <= LOG_DEBUG) {
char *hexdata = bin2hex(&data.workid, sizeof(data)-3); char *hexdata = bin2hex(&data.workid, sizeof(data)-3);
applog(LOG_DEBUG, "WORKDATA: %s", hexdata); applog(LOG_DEBUG, "WORKDATA: %s", hexdata);
free(hexdata); free(hexdata);
} }
applog(LOG_DEBUG, "Klondike sending work (%d:%02x)", dev, data.workid); applog(LOG_DEBUG, "Klondike sending work (%d:%02x)", dev, data.workid);
char *reply = SendCmdGetReply(klncgpu, 'W', dev, sizeof(data)-3, &data.workid); char *reply = SendCmdGetReply(klncgpu, 'W', dev, sizeof(data)-3, &data.workid);
@ -518,7 +518,6 @@ static int64_t klondike_scanwork(struct thr_info *thr)
newhashcount += (newhashdev << 32) / klninfo->status[dev].maxcount; newhashcount += (newhashdev << 32) / klninfo->status[dev].maxcount;
// todo: check stats for critical conditions // todo: check stats for critical conditions
} }
rd_unlock(&(klninfo->stat_lock)); rd_unlock(&(klninfo->stat_lock));
} }
@ -541,7 +540,7 @@ static void get_klondike_statline_before(char *buf, size_t siz, struct cgpu_info
if (klninfo->status[dev].temp < temp) if (klninfo->status[dev].temp < temp)
temp = klninfo->status[dev].temp; temp = klninfo->status[dev].temp;
fan += klninfo->cfg[dev].fantarget; fan += klninfo->cfg[dev].fantarget;
} }
fan /= klninfo->status->slavecount+1; fan /= klninfo->status->slavecount+1;
rd_unlock(&(klninfo->stat_lock)); rd_unlock(&(klninfo->stat_lock));

Loading…
Cancel
Save