Browse Source

distinguish between drv and it's id enum now called drv_id

nfactor-troky
Kano 12 years ago
parent
commit
7abf30b2c0
  1. 20
      api.c
  2. 8
      cgminer.c
  3. 2
      driver-bitforce.c
  4. 2
      driver-cpu.c
  5. 2
      driver-icarus.c
  6. 2
      driver-modminer.c
  7. 10
      driver-opencl.c
  8. 2
      miner.h
  9. 6
      usbutils.c

20
api.c

@ -1150,19 +1150,19 @@ static int numpgas()
for (i = 0; i < total_devices; i++) { for (i = 0; i < total_devices; i++) {
#ifdef USE_BITFORCE #ifdef USE_BITFORCE
if (devices[i]->drv->drv == DRIVER_BITFORCE) if (devices[i]->drv->drv_id == DRIVER_BITFORCE)
count++; count++;
#endif #endif
#ifdef USE_ICARUS #ifdef USE_ICARUS
if (devices[i]->drv->drv == DRIVER_ICARUS) if (devices[i]->drv->drv_id == DRIVER_ICARUS)
count++; count++;
#endif #endif
#ifdef USE_ZTEX #ifdef USE_ZTEX
if (devices[i]->drv->drv == DRIVER_ZTEX) if (devices[i]->drv->drv_id == DRIVER_ZTEX)
count++; count++;
#endif #endif
#ifdef USE_MODMINER #ifdef USE_MODMINER
if (devices[i]->drv->drv == DRIVER_MODMINER) if (devices[i]->drv->drv_id == DRIVER_MODMINER)
count++; count++;
#endif #endif
} }
@ -1176,19 +1176,19 @@ static int pgadevice(int pgaid)
for (i = 0; i < total_devices; i++) { for (i = 0; i < total_devices; i++) {
#ifdef USE_BITFORCE #ifdef USE_BITFORCE
if (devices[i]->drv->drv == DRIVER_BITFORCE) if (devices[i]->drv->drv_id == DRIVER_BITFORCE)
count++; count++;
#endif #endif
#ifdef USE_ICARUS #ifdef USE_ICARUS
if (devices[i]->drv->drv == DRIVER_ICARUS) if (devices[i]->drv->drv_id == DRIVER_ICARUS)
count++; count++;
#endif #endif
#ifdef USE_ZTEX #ifdef USE_ZTEX
if (devices[i]->drv->drv == DRIVER_ZTEX) if (devices[i]->drv->drv_id == DRIVER_ZTEX)
count++; count++;
#endif #endif
#ifdef USE_MODMINER #ifdef USE_MODMINER
if (devices[i]->drv->drv == DRIVER_MODMINER) if (devices[i]->drv->drv_id == DRIVER_MODMINER)
count++; count++;
#endif #endif
if (count == (pgaid + 1)) if (count == (pgaid + 1))
@ -1532,11 +1532,11 @@ static void pgastatus(struct io_data *io_data, int pga, bool isjson, bool precom
float temp = cgpu->temp; float temp = cgpu->temp;
#ifdef USE_ZTEX #ifdef USE_ZTEX
if (cgpu->drv->drv == DRIVER_ZTEX && cgpu->device_ztex) if (cgpu->drv->drv_id == DRIVER_ZTEX && cgpu->device_ztex)
frequency = cgpu->device_ztex->freqM1 * (cgpu->device_ztex->freqM + 1); frequency = cgpu->device_ztex->freqM1 * (cgpu->device_ztex->freqM + 1);
#endif #endif
#ifdef USE_MODMINER #ifdef USE_MODMINER
if (cgpu->drv->drv == DRIVER_MODMINER) if (cgpu->drv->drv_id == DRIVER_MODMINER)
frequency = cgpu->clock; frequency = cgpu->clock;
#endif #endif

8
cgminer.c

@ -5950,7 +5950,7 @@ static void *watchdog_thread(void __maybe_unused *userdata)
continue; continue;
#ifdef WANT_CPUMINE #ifdef WANT_CPUMINE
if (cgpu->drv->drv == DRIVER_CPU) if (cgpu->drv->drv_id == DRIVER_CPU)
continue; continue;
#endif #endif
if (cgpu->status != LIFE_WELL && (now.tv_sec - thr->last.tv_sec < WATCHDOG_SICK_TIME)) { if (cgpu->status != LIFE_WELL && (now.tv_sec - thr->last.tv_sec < WATCHDOG_SICK_TIME)) {
@ -6342,7 +6342,7 @@ void enable_curses(void) {
#ifndef WANT_CPUMINE #ifndef WANT_CPUMINE
struct device_drv cpu_drv; struct device_drv cpu_drv;
struct device_drv cpu_drv = { struct device_drv cpu_drv = {
.drv = DRIVER_CPU, .drv_id = DRIVER_CPU,
.name = "CPU", .name = "CPU",
}; };
#endif #endif
@ -6375,7 +6375,7 @@ void enable_device(struct cgpu_info *cgpu)
adj_width(mining_threads, &dev_width); adj_width(mining_threads, &dev_width);
#endif #endif
#ifdef HAVE_OPENCL #ifdef HAVE_OPENCL
if (cgpu->drv->drv == DRIVER_OPENCL) { if (cgpu->drv->drv_id == DRIVER_OPENCL) {
gpu_threads += cgpu->threads; gpu_threads += cgpu->threads;
} }
#endif #endif
@ -6680,7 +6680,7 @@ int main(int argc, char *argv[])
enable_device(devices[i]); enable_device(devices[i]);
} else if (i < total_devices) { } else if (i < total_devices) {
if (opt_removedisabled) { if (opt_removedisabled) {
if (devices[i]->drv->drv == DRIVER_CPU) if (devices[i]->drv->drv_id == DRIVER_CPU)
--opt_n_threads; --opt_n_threads;
} else { } else {
enable_device(devices[i]); enable_device(devices[i]);

2
driver-bitforce.c

@ -751,7 +751,7 @@ static struct api_data *bitforce_api_stats(struct cgpu_info *cgpu)
} }
struct device_drv bitforce_drv = { struct device_drv bitforce_drv = {
.drv = DRIVER_BITFORCE, .drv_id = DRIVER_BITFORCE,
.dname = "BitForce", .dname = "BitForce",
.name = "BFL", .name = "BFL",
.drv_detect = bitforce_detect, .drv_detect = bitforce_detect,

2
driver-cpu.c

@ -844,7 +844,7 @@ CPUSearch:
} }
struct device_drv cpu_drv = { struct device_drv cpu_drv = {
.drv = DRIVER_CPU, .drv_id = DRIVER_CPU,
.dname = "cpu", .dname = "cpu",
.name = "CPU", .name = "CPU",
.drv_detect = cpu_detect, .drv_detect = cpu_detect,

2
driver-icarus.c

@ -901,7 +901,7 @@ static void icarus_shutdown(struct thr_info *thr)
} }
struct device_drv icarus_drv = { struct device_drv icarus_drv = {
.drv = DRIVER_ICARUS, .drv_id = DRIVER_ICARUS,
.dname = "Icarus", .dname = "Icarus",
.name = "ICA", .name = "ICA",
.drv_detect = icarus_detect, .drv_detect = icarus_detect,

2
driver-modminer.c

@ -1185,7 +1185,7 @@ static char *modminer_set_device(struct cgpu_info *modminer, char *option, char
} }
struct device_drv modminer_drv = { struct device_drv modminer_drv = {
.drv = DRIVER_MODMINER, .drv_id = DRIVER_MODMINER,
.dname = "ModMiner", .dname = "ModMiner",
.name = "MMQ", .name = "MMQ",
.drv_detect = modminer_detect, .drv_detect = modminer_detect,

10
driver-opencl.c

@ -770,7 +770,7 @@ retry:
thr = mining_thr[i]; thr = mining_thr[i];
mutex_unlock(&mining_thr_lock); mutex_unlock(&mining_thr_lock);
cgpu = thr->cgpu; cgpu = thr->cgpu;
if (cgpu->drv->drv != DRIVER_OPENCL) if (cgpu->drv->drv_id != DRIVER_OPENCL)
continue; continue;
if (dev_from_id(i) != selected) if (dev_from_id(i) != selected)
continue; continue;
@ -1159,7 +1159,7 @@ select_cgpu:
thr = mining_thr[thr_id]; thr = mining_thr[thr_id];
mutex_unlock(&mining_thr_lock); mutex_unlock(&mining_thr_lock);
cgpu = thr->cgpu; cgpu = thr->cgpu;
if (cgpu->drv->drv != DRIVER_OPENCL) if (cgpu->drv->drv_id != DRIVER_OPENCL)
continue; continue;
if (dev_from_id(thr_id) != gpu) if (dev_from_id(thr_id) != gpu)
continue; continue;
@ -1188,7 +1188,7 @@ select_cgpu:
thr = mining_thr[thr_id]; thr = mining_thr[thr_id];
mutex_unlock(&mining_thr_lock); mutex_unlock(&mining_thr_lock);
cgpu = thr->cgpu; cgpu = thr->cgpu;
if (cgpu->drv->drv != DRIVER_OPENCL) if (cgpu->drv->drv_id != DRIVER_OPENCL)
continue; continue;
if (dev_from_id(thr_id) != gpu) if (dev_from_id(thr_id) != gpu)
continue; continue;
@ -1227,7 +1227,7 @@ select_cgpu:
thr = mining_thr[thr_id]; thr = mining_thr[thr_id];
mutex_unlock(&mining_thr_lock); mutex_unlock(&mining_thr_lock);
cgpu = thr->cgpu; cgpu = thr->cgpu;
if (cgpu->drv->drv != DRIVER_OPENCL) if (cgpu->drv->drv_id != DRIVER_OPENCL)
continue; continue;
if (dev_from_id(thr_id) != gpu) if (dev_from_id(thr_id) != gpu)
continue; continue;
@ -1574,7 +1574,7 @@ static void opencl_thread_shutdown(struct thr_info *thr)
} }
struct device_drv opencl_drv = { struct device_drv opencl_drv = {
.drv = DRIVER_OPENCL, .drv_id = DRIVER_OPENCL,
.dname = "opencl", .dname = "opencl",
.name = "GPU", .name = "GPU",
.drv_detect = opencl_detect, .drv_detect = opencl_detect,

2
miner.h

@ -273,7 +273,7 @@ struct thr_info;
struct work; struct work;
struct device_drv { struct device_drv {
enum drv_driver drv; enum drv_driver drv_id;
char *dname; char *dname;
char *name; char *name;

6
usbutils.c

@ -1117,17 +1117,17 @@ static struct usb_find_devices *usb_check_each(int drvnum, struct device_drv *dr
static struct usb_find_devices *usb_check(__maybe_unused struct device_drv *drv, __maybe_unused struct libusb_device *dev) static struct usb_find_devices *usb_check(__maybe_unused struct device_drv *drv, __maybe_unused struct libusb_device *dev)
{ {
#ifdef USE_BITFORCE #ifdef USE_BITFORCE
if (drv->drv == DRIVER_BITFORCE) if (drv->drv_id == DRIVER_BITFORCE)
return usb_check_each(DRV_BITFORCE, drv, dev); return usb_check_each(DRV_BITFORCE, drv, dev);
#endif #endif
#ifdef USE_ICARUS #ifdef USE_ICARUS
if (drv->drv == DRIVER_ICARUS) if (drv->drv_id == DRIVER_ICARUS)
return usb_check_each(DRV_ICARUS, drv, dev); return usb_check_each(DRV_ICARUS, drv, dev);
#endif #endif
#ifdef USE_MODMINER #ifdef USE_MODMINER
if (drv->drv == DRIVER_MODMINER) if (drv->drv_id == DRIVER_MODMINER)
return usb_check_each(DRV_MODMINER, drv, dev); return usb_check_each(DRV_MODMINER, drv, dev);
#endif #endif

Loading…
Cancel
Save