|
@@ -422,7 +422,7 @@ static void bitforce_clear_buffer(struct cgpu_info *bitforce)
|
|
|
mutex_lock(mutexp);
|
|
mutex_lock(mutexp);
|
|
|
|
|
|
|
|
fdDev = bitforce->device->device_fd;
|
|
fdDev = bitforce->device->device_fd;
|
|
|
- if (fdDev)
|
|
|
|
|
|
|
+ if (fdDev != -1)
|
|
|
{
|
|
{
|
|
|
applog(LOG_DEBUG, "%"PRIpreprv": Clearing read buffer", bitforce->proc_repr);
|
|
applog(LOG_DEBUG, "%"PRIpreprv": Clearing read buffer", bitforce->proc_repr);
|
|
|
__bitforce_clear_buffer(fdDev);
|
|
__bitforce_clear_buffer(fdDev);
|
|
@@ -452,10 +452,10 @@ void bitforce_reinit(struct cgpu_info *bitforce)
|
|
|
|
|
|
|
|
applog(LOG_WARNING, "%"PRIpreprv": Re-initialising", bitforce->proc_repr);
|
|
applog(LOG_WARNING, "%"PRIpreprv": Re-initialising", bitforce->proc_repr);
|
|
|
|
|
|
|
|
- if (fdDev) {
|
|
|
|
|
|
|
+ if (fdDev != -1) {
|
|
|
BFclose(fdDev);
|
|
BFclose(fdDev);
|
|
|
cgsleep_ms(5000);
|
|
cgsleep_ms(5000);
|
|
|
- *p_fdDev = 0;
|
|
|
|
|
|
|
+ *p_fdDev = -1;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
fdDev = BFopen(devpath);
|
|
fdDev = BFopen(devpath);
|
|
@@ -524,7 +524,7 @@ static void bitforce_flash_led(struct cgpu_info *bitforce)
|
|
|
pthread_mutex_t *mutexp = &bitforce->device->device_mutex;
|
|
pthread_mutex_t *mutexp = &bitforce->device->device_mutex;
|
|
|
int fdDev = bitforce->device->device_fd;
|
|
int fdDev = bitforce->device->device_fd;
|
|
|
|
|
|
|
|
- if (!fdDev)
|
|
|
|
|
|
|
+ if (fdDev == -1)
|
|
|
return;
|
|
return;
|
|
|
|
|
|
|
|
/* Do not try to flash the led if we're polling for a result to
|
|
/* Do not try to flash the led if we're polling for a result to
|
|
@@ -582,7 +582,7 @@ static bool bitforce_get_temp(struct cgpu_info *bitforce)
|
|
|
char *s;
|
|
char *s;
|
|
|
struct cgpu_info *chip_cgpu;
|
|
struct cgpu_info *chip_cgpu;
|
|
|
|
|
|
|
|
- if (!fdDev)
|
|
|
|
|
|
|
+ if (fdDev == -1)
|
|
|
return false;
|
|
return false;
|
|
|
|
|
|
|
|
/* Do not try to get the temperature if we're polling for a result to
|
|
/* Do not try to get the temperature if we're polling for a result to
|
|
@@ -737,7 +737,7 @@ bool bitforce_job_prepare(struct thr_info *thr, struct work *work, __maybe_unuse
|
|
|
pthread_mutex_t *mutexp = &bitforce->device->device_mutex;
|
|
pthread_mutex_t *mutexp = &bitforce->device->device_mutex;
|
|
|
char pdevbuf[0x100];
|
|
char pdevbuf[0x100];
|
|
|
|
|
|
|
|
- if (unlikely(!fdDev))
|
|
|
|
|
|
|
+ if (unlikely(fdDev == -1))
|
|
|
return false;
|
|
return false;
|
|
|
|
|
|
|
|
mutex_lock(mutexp);
|
|
mutex_lock(mutexp);
|
|
@@ -847,7 +847,7 @@ void bitforce_job_start(struct thr_info *thr)
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if (!fdDev)
|
|
|
|
|
|
|
+ if (fdDev == -1)
|
|
|
goto commerr;
|
|
goto commerr;
|
|
|
re_send:
|
|
re_send:
|
|
|
mutex_lock(mutexp);
|
|
mutex_lock(mutexp);
|
|
@@ -973,7 +973,7 @@ void bitforce_job_get_results(struct thr_info *thr, struct work *work)
|
|
|
bitforce->wait_ms = tv_to_ms(elapsed);
|
|
bitforce->wait_ms = tv_to_ms(elapsed);
|
|
|
bitforce->polling = true;
|
|
bitforce->polling = true;
|
|
|
|
|
|
|
|
- if (!fdDev)
|
|
|
|
|
|
|
+ if (fdDev == -1)
|
|
|
goto commerr;
|
|
goto commerr;
|
|
|
|
|
|
|
|
stale = stale_work(work, true);
|
|
stale = stale_work(work, true);
|
|
@@ -1267,7 +1267,7 @@ static void bitforce_shutdown(struct thr_info *thr)
|
|
|
int *p_fdDev = &bitforce->device->device_fd;
|
|
int *p_fdDev = &bitforce->device->device_fd;
|
|
|
|
|
|
|
|
BFclose(*p_fdDev);
|
|
BFclose(*p_fdDev);
|
|
|
- *p_fdDev = 0;
|
|
|
|
|
|
|
+ *p_fdDev = -1;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
static void biforce_thread_enable(struct thr_info *thr)
|
|
static void biforce_thread_enable(struct thr_info *thr)
|
|
@@ -1635,7 +1635,7 @@ bool bitforce_send_queue(struct thr_info *thr)
|
|
|
int fd = bitforce->device->device_fd;
|
|
int fd = bitforce->device->device_fd;
|
|
|
struct work *work;
|
|
struct work *work;
|
|
|
|
|
|
|
|
- if (unlikely(!(fd && data->ready_to_queue)))
|
|
|
|
|
|
|
+ if (unlikely(!(fd != -1 && data->ready_to_queue)))
|
|
|
return false;
|
|
return false;
|
|
|
|
|
|
|
|
char buf[0x100];
|
|
char buf[0x100];
|
|
@@ -1733,7 +1733,7 @@ bool bitforce_queue_do_results(struct thr_info *thr)
|
|
|
struct thr_info *chip_thr;
|
|
struct thr_info *chip_thr;
|
|
|
int counts[data->parallel];
|
|
int counts[data->parallel];
|
|
|
|
|
|
|
|
- if (unlikely(!fd))
|
|
|
|
|
|
|
+ if (unlikely(fd == -1))
|
|
|
return false;
|
|
return false;
|
|
|
|
|
|
|
|
again:
|
|
again:
|