From 5bd1b560acfaced29d96a985440b4b8658d88760 Mon Sep 17 00:00:00 2001 From: Kano Date: Mon, 28 Oct 2013 07:41:15 +1100 Subject: [PATCH] usbutils - usb_nodev() allow a driver to drop a device --- usbutils.c | 14 ++++++++++++++ usbutils.h | 3 ++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/usbutils.c b/usbutils.c index 4c21e36f..82dc312a 100644 --- a/usbutils.c +++ b/usbutils.c @@ -1355,6 +1355,20 @@ static void release_cgpu(struct cgpu_info *cgpu) cgminer_usb_unlock_bd(cgpu->drv, cgpu->usbinfo.bus_number, cgpu->usbinfo.device_address); } +/* + * Force a NODEV on a device so it goes back to hotplug + */ +void usb_nodev(struct cgpu_info *cgpu) +{ + int pstate; + + DEVWLOCK(cgpu, pstate); + + release_cgpu(cgpu); + + DEVWUNLOCK(cgpu, pstate); +} + /* * Use the same usbdev thus locking is across all related devices */ diff --git a/usbutils.h b/usbutils.h index 2c9e5ad2..4f0dfedd 100644 --- a/usbutils.h +++ b/usbutils.h @@ -358,7 +358,8 @@ bool async_usb_transfers(void); void cancel_usb_transfers(void); void usb_all(int level); const char *usb_cmdname(enum usb_cmds cmd); -void usb_applog(struct cgpu_info *bflsc, enum usb_cmds cmd, char *msg, int amount, int err); +void usb_applog(struct cgpu_info *cgpu, enum usb_cmds cmd, char *msg, int amount, int err); +void usb_nodev(struct cgpu_info *cgpu); struct cgpu_info *usb_copy_cgpu(struct cgpu_info *orig); struct cgpu_info *usb_alloc_cgpu(struct device_drv *drv, int threads); struct cgpu_info *usb_free_cgpu(struct cgpu_info *cgpu);