mirror of
https://github.com/GOSTSec/sgminer
synced 2025-02-02 10:04:33 +00:00
Make avalon_wait_write a bool function and check its return value.
This commit is contained in:
parent
290666a124
commit
674539bddc
@ -380,13 +380,17 @@ static void avalon_clear_readbuf(int fd)
|
|||||||
|
|
||||||
/* Wait until the avalon says it's ready to receive a write, or 2 seconds has
|
/* Wait until the avalon says it's ready to receive a write, or 2 seconds has
|
||||||
* elapsed, whichever comes first. The status is updated by the ftdi device
|
* elapsed, whichever comes first. The status is updated by the ftdi device
|
||||||
* every 40ms. */
|
* every 40ms. Returns true if the avalon is ready. */
|
||||||
static void avalon_wait_write(int fd)
|
static bool avalon_wait_write(int fd)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
bool ret;
|
||||||
|
|
||||||
while (avalon_buffer_full(fd) && i++ < 40)
|
do {
|
||||||
nmsleep(50);
|
ret = avalon_buffer_full(fd);
|
||||||
|
} while (ret == true && i++ < 40);
|
||||||
|
|
||||||
|
return !ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void avalon_idle(struct cgpu_info *avalon, int fd)
|
static void avalon_idle(struct cgpu_info *avalon, int fd)
|
||||||
@ -394,7 +398,10 @@ static void avalon_idle(struct cgpu_info *avalon, int fd)
|
|||||||
struct avalon_info *info = avalon->device_data;
|
struct avalon_info *info = avalon->device_data;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
avalon_wait_write(fd);
|
if (!avalon_wait_write(fd)) {
|
||||||
|
applog(LOG_WARNING, "Avalon not ready for writes in avalon_idle");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < info->miner_count; i++) {
|
for (i = 0; i < info->miner_count; i++) {
|
||||||
struct avalon_task at;
|
struct avalon_task at;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user