* USA.
*/
-#include "usbip_common.h"
#include <linux/kthread.h>
+#include "usbip_common.h"
static int event_handler(struct usbip_device *ud)
{
*/
if (ud->event & USBIP_EH_SHUTDOWN) {
ud->eh_ops.shutdown(ud);
-
ud->event &= ~USBIP_EH_SHUTDOWN;
}
/* Reset the device. */
if (ud->event & USBIP_EH_RESET) {
ud->eh_ops.reset(ud);
-
ud->event &= ~USBIP_EH_RESET;
}
/* Mark the device as unusable. */
if (ud->event & USBIP_EH_UNUSABLE) {
ud->eh_ops.unusable(ud);
-
ud->event &= ~USBIP_EH_UNUSABLE;
}
while (!kthread_should_stop()) {
wait_event_interruptible(ud->eh_waitq,
- usbip_event_happened(ud) ||
- kthread_should_stop());
+ usbip_event_happened(ud) ||
+ kthread_should_stop());
usbip_dbg_eh("wakeup\n");
if (event_handler(ud) < 0)
break;
}
+
return 0;
}
ud->eh = kthread_run(event_handler_loop, ud, "usbip_eh");
if (IS_ERR(ud->eh)) {
printk(KERN_WARNING
- "Unable to start control thread\n");
+ "Unable to start control thread\n");
return PTR_ERR(ud->eh);
}
+
return 0;
}
EXPORT_SYMBOL_GPL(usbip_start_eh);
void usbip_event_add(struct usbip_device *ud, unsigned long event)
{
spin_lock(&ud->lock);
-
ud->event |= event;
-
wake_up(&ud->eh_waitq);
-
spin_unlock(&ud->lock);
}
EXPORT_SYMBOL_GPL(usbip_event_add);
int happened = 0;
spin_lock(&ud->lock);
-
if (ud->event != 0)
happened = 1;
-
spin_unlock(&ud->lock);
return happened;