|
|
@ -2368,12 +2368,14 @@ int _usb_transfer_read(struct cgpu_info *cgpu, uint8_t request_type, uint8_t bRe |
|
|
|
void usb_cleanup() |
|
|
|
void usb_cleanup() |
|
|
|
{ |
|
|
|
{ |
|
|
|
struct cgpu_info *cgpu; |
|
|
|
struct cgpu_info *cgpu; |
|
|
|
|
|
|
|
int count; |
|
|
|
int i; |
|
|
|
int i; |
|
|
|
|
|
|
|
|
|
|
|
hotplug_time = 0; |
|
|
|
hotplug_time = 0; |
|
|
|
|
|
|
|
|
|
|
|
nmsleep(10); |
|
|
|
nmsleep(10); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
count = 0; |
|
|
|
for (i = 0; i < total_devices; i++) { |
|
|
|
for (i = 0; i < total_devices; i++) { |
|
|
|
cgpu = devices[i]; |
|
|
|
cgpu = devices[i]; |
|
|
|
switch (cgpu->drv->drv_id) { |
|
|
|
switch (cgpu->drv->drv_id) { |
|
|
@ -2383,11 +2385,40 @@ void usb_cleanup() |
|
|
|
case DRIVER_ICARUS: |
|
|
|
case DRIVER_ICARUS: |
|
|
|
case DRIVER_AVALON: |
|
|
|
case DRIVER_AVALON: |
|
|
|
release_cgpu(cgpu); |
|
|
|
release_cgpu(cgpu); |
|
|
|
|
|
|
|
count++; |
|
|
|
break; |
|
|
|
break; |
|
|
|
default: |
|
|
|
default: |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
* Must attempt to wait for the resource thread to release coz |
|
|
|
|
|
|
|
* during a restart it won't automatically release them in linux |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
if (count) { |
|
|
|
|
|
|
|
struct timeval start, now; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cgtime(&start); |
|
|
|
|
|
|
|
while (42) { |
|
|
|
|
|
|
|
nmsleep(50); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mutex_lock(&cgusbres_lock); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!res_work_head) |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cgtime(&now); |
|
|
|
|
|
|
|
if (tdiff(&now, &start) > 0.366) { |
|
|
|
|
|
|
|
applog(LOG_WARNING, |
|
|
|
|
|
|
|
"usb_cleanup gave up waiting for resource thread"); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mutex_unlock(&cgusbres_lock); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
mutex_unlock(&cgusbres_lock); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void usb_initialise() |
|
|
|
void usb_initialise() |
|
|
|