1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-08-26 05:41:55 +00:00

Don't bother having a separate cancellable transfer struct for usb transfers, simply include the list in the usb_transfer struct.

This commit is contained in:
Con Kolivas 2013-10-24 21:58:25 +11:00
parent c96f096577
commit 51660838da

View File

@ -98,11 +98,6 @@
int cgusb_transfers; int cgusb_transfers;
static struct list_head ct_list; static struct list_head ct_list;
struct cancellable_transfer {
cgsem_t *cgsem;
struct list_head list;
};
#ifdef USE_BFLSC #ifdef USE_BFLSC
// N.B. transfer size is 512 with USB2.0, but only 64 with USB1.1 // N.B. transfer size is 512 with USB2.0, but only 64 with USB1.1
static struct usb_epinfo bas_epinfos[] = { static struct usb_epinfo bas_epinfos[] = {
@ -2219,7 +2214,7 @@ struct usb_transfer {
cgsem_t cgsem; cgsem_t cgsem;
struct libusb_transfer *transfer; struct libusb_transfer *transfer;
bool cancellable; bool cancellable;
struct cancellable_transfer ct; struct list_head list;
}; };
static void init_usb_transfer(struct usb_transfer *ut) static void init_usb_transfer(struct usb_transfer *ut)
@ -2239,7 +2234,7 @@ static void complete_usb_transfer(struct usb_transfer *ut)
cg_wlock(&cgusb_fd_lock); cg_wlock(&cgusb_fd_lock);
cgusb_transfers--; cgusb_transfers--;
if (ut->cancellable) if (ut->cancellable)
list_del(&ut->ct.list); list_del(&ut->list);
cg_wunlock(&cgusb_fd_lock); cg_wunlock(&cgusb_fd_lock);
} }
@ -2311,8 +2306,8 @@ static int usb_submit_transfer(struct usb_transfer *ut, struct libusb_transfer *
cgusb_transfers++; cgusb_transfers++;
if (cancellable) { if (cancellable) {
ut->cancellable = true; ut->cancellable = true;
INIT_LIST_HEAD(&ut->ct.list); INIT_LIST_HEAD(&ut->list);
list_add(&ct_list, &ut->ct.list); list_add(&ct_list, &ut->list);
} else } else
ut->cancellable = false; ut->cancellable = false;
cg_wunlock(&cgusb_fd_lock); cg_wunlock(&cgusb_fd_lock);