aboutsummaryrefslogtreecommitdiff
path: root/drivers/usb/misc/usbtest.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-06-21 06:41:07 -1000
committerLinus Torvalds <torvalds@linux-foundation.org>2014-06-21 06:41:07 -1000
commit564fbee928594279409d825b31ee9751ddf11965 (patch)
tree257fdd870c09b5316340023d80f8ea9e01291a5d /drivers/usb/misc/usbtest.c
parent3c8fb50445833b93f69b6b703a29aae3523cad0c (diff)
parent32b36eeae6a859670d2939a7d6136cb5e9ed64f8 (diff)
Merge tag 'usb-3.16-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
Pull USB fixes from Greg KH: "Here are some USB fixes for 3.16-rc2 that resolve some reported issues. All of these have been in linux-next for a while with no problems" * tag 'usb-3.16-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: USB: usbtest: add a timeout for scatter-gather tests USB: EHCI: avoid BIOS handover on the HASEE E200 usb: fix hub-port pm_runtime_enable() vs runtime pm transitions usb: quiet peer failure warning, disable poweroff usb: improve "not suspended yet" message in hub_suspend() xhci: Fix sleeping with IRQs disabled in xhci_stop_device() usb: fix ->update_hub_device() vs hdev->maxchild
Diffstat (limited to 'drivers/usb/misc/usbtest.c')
-rw-r--r--drivers/usb/misc/usbtest.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c
index 51a6da25677..829f446064e 100644
--- a/drivers/usb/misc/usbtest.c
+++ b/drivers/usb/misc/usbtest.c
@@ -7,7 +7,7 @@
#include <linux/moduleparam.h>
#include <linux/scatterlist.h>
#include <linux/mutex.h>
-
+#include <linux/timer.h>
#include <linux/usb.h>
#define SIMPLE_IO_TIMEOUT 10000 /* in milliseconds */
@@ -484,6 +484,14 @@ alloc_sglist(int nents, int max, int vary)
return sg;
}
+static void sg_timeout(unsigned long _req)
+{
+ struct usb_sg_request *req = (struct usb_sg_request *) _req;
+
+ req->status = -ETIMEDOUT;
+ usb_sg_cancel(req);
+}
+
static int perform_sglist(
struct usbtest_dev *tdev,
unsigned iterations,
@@ -495,6 +503,9 @@ static int perform_sglist(
{
struct usb_device *udev = testdev_to_usbdev(tdev);
int retval = 0;
+ struct timer_list sg_timer;
+
+ setup_timer_on_stack(&sg_timer, sg_timeout, (unsigned long) req);
while (retval == 0 && iterations-- > 0) {
retval = usb_sg_init(req, udev, pipe,
@@ -505,7 +516,10 @@ static int perform_sglist(
if (retval)
break;
+ mod_timer(&sg_timer, jiffies +
+ msecs_to_jiffies(SIMPLE_IO_TIMEOUT));
usb_sg_wait(req);
+ del_timer_sync(&sg_timer);
retval = req->status;
/* FIXME check resulting data pattern */