Commit 5bd1b560acfaced29d96a985440b4b8658d88760

Kano 2013-10-28T07:41:15

usbutils - usb_nodev() allow a driver to drop a device

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);