1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-09-09 12:42:05 +00:00

Set avalon_info to device data void struct.

This commit is contained in:
Con Kolivas 2013-05-27 15:54:07 +10:00
parent c478b302ce
commit 2c633fdbe4

View File

@ -42,7 +42,6 @@
#include "util.h" #include "util.h"
static int option_offset = -1; static int option_offset = -1;
struct avalon_info **avalon_infos;
struct device_drv avalon_drv; struct device_drv avalon_drv;
static int avalon_init_task(struct avalon_task *at, static int avalon_init_task(struct avalon_task *at,
@ -613,16 +612,10 @@ static bool avalon_detect_one(libusb_device *dev, struct usb_find_devices *found
avalon->device_path = strdup(devpath); avalon->device_path = strdup(devpath);
add_cgpu(avalon); add_cgpu(avalon);
avalon_infos = realloc(avalon_infos, avalon->device_data = calloc(sizeof(struct avalon_info), 1);
sizeof(struct avalon_info *) * if (unlikely(!(avalon->device_data)))
(total_devices + 1)); quit(1, "Failed to malloc avalon_info data");
if (unlikely(!avalon_infos)) info = avalon->device_data;
quit(1, "Failed to malloc avalon_infos");
avalon_infos[avalon->device_id] = calloc(sizeof(struct avalon_info), 1);
if (unlikely(!(avalon_infos[avalon->device_id])))
quit(1, "Failed to malloc avalon_infos device");
info = avalon_infos[avalon->device_id];
info->baud = baud; info->baud = baud;
info->miner_count = miner_count; info->miner_count = miner_count;
@ -1036,11 +1029,12 @@ static void avalon_update_temps(struct cgpu_info *avalon, struct avalon_info *in
* the buffer when we need the extra space for new work. */ * the buffer when we need the extra space for new work. */
static bool avalon_fill(struct cgpu_info *avalon) static bool avalon_fill(struct cgpu_info *avalon)
{ {
int subid, slot, mc = avalon_infos[avalon->device_id]->miner_count;
struct avalon_info *info = avalon->device_data; struct avalon_info *info = avalon->device_data;
int subid, slot, mc;
struct work *work; struct work *work;
bool ret = true; bool ret = true;
mc = info->miner_count;
mutex_lock(&info->qlock); mutex_lock(&info->qlock);
if (avalon->queued >= mc) if (avalon->queued >= mc)
goto out_unlock; goto out_unlock;