usbutils - usb_nodev() allow a driver to drop a device
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
diff --git a/usbutils.c b/usbutils.c
index 4c21e36..82dc312 100644
--- a/usbutils.c
+++ b/usbutils.c
@@ -1356,6 +1356,20 @@ static void release_cgpu(struct cgpu_info *cgpu)
}
/*
+ * 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
*/
struct cgpu_info *usb_copy_cgpu(struct cgpu_info *orig)
diff --git a/usbutils.h b/usbutils.h
index 2c9e5ad..4f0dfed 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);