Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 249381
b: refs/heads/master
c: 0f79847
h: refs/heads/master
i:
  249379: 95d30f2
v: v3
  • Loading branch information
matt mooney authored and Greg Kroah-Hartman committed May 6, 2011
1 parent da6fa9f commit 9ed9756
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f9eacc9846041f84f5f9abcbb99cb1a52c235e88
refs/heads/master: 0f79847ce0caa988383767c0b1a85a1fde0344dc
18 changes: 6 additions & 12 deletions trunk/drivers/staging/usbip/usbip_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
* USA.
*/

#include "usbip_common.h"
#include <linux/kthread.h>
#include "usbip_common.h"

static int event_handler(struct usbip_device *ud)
{
Expand All @@ -36,21 +36,18 @@ 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;
}

Expand All @@ -68,13 +65,14 @@ static int event_handler_loop(void *data)

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

Expand All @@ -86,9 +84,10 @@ int usbip_start_eh(struct usbip_device *ud)
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);
Expand All @@ -106,11 +105,8 @@ EXPORT_SYMBOL_GPL(usbip_stop_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);
Expand All @@ -120,10 +116,8 @@ int usbip_event_happened(struct usbip_device *ud)
int happened = 0;

spin_lock(&ud->lock);

if (ud->event != 0)
happened = 1;

spin_unlock(&ud->lock);

return happened;
Expand Down

0 comments on commit 9ed9756

Please sign in to comment.