From 60c40636c801862e58e7e7c1217266f14184256f Mon Sep 17 00:00:00 2001 From: "Devin J. Pohly" Date: Fri, 22 Aug 2014 00:53:04 -0400 Subject: [PATCH] timeout on wait_event when closing because I'm just nervous, that's why... --- mod/piuio.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mod/piuio.c b/mod/piuio.c index 5f75f1f..90055b3 100644 --- a/mod/piuio.c +++ b/mod/piuio.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -248,8 +249,10 @@ static void piuio_close(struct input_dev *dev) /* Stop polling, but wait for the last requests to complete */ usb_block_urb(piu->in); usb_block_urb(piu->out); - wait_event(piu->shutdown_wait, atomic_read(&piu->in->use_count) == 0 && - atomic_read(&piu->out->use_count) == 0); + wait_event_timeout(piu->shutdown_wait, + atomic_read(&piu->in->use_count) == 0 && + atomic_read(&piu->out->use_count) == 0, + msecs_to_jiffies(5)); usb_unblock_urb(piu->in); usb_unblock_urb(piu->out);