diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-06-22 12:33:51 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-06-22 12:33:51 -0400 |
commit | ef7994fa2aecd8d1fb0d75034caa050ff908d26a (patch) | |
tree | aa7bbe9499256ced149dce70891de5eedf33c283 /drivers/usb/misc/usbtest.c | |
parent | ad8686bc05adc2b8301d749f5958bd904f3a46ee (diff) | |
parent | a497c3ba1d97fc69c1e78e7b96435ba8c2cb42ee (diff) |
Merge 3.16-rc2 into staging-next
We want the staging fixes here as well.
Diffstat (limited to 'drivers/usb/misc/usbtest.c')
-rw-r--r-- | drivers/usb/misc/usbtest.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c index 51a6da256772..829f446064ea 100644 --- a/drivers/usb/misc/usbtest.c +++ b/drivers/usb/misc/usbtest.c | |||
@@ -7,7 +7,7 @@ | |||
7 | #include <linux/moduleparam.h> | 7 | #include <linux/moduleparam.h> |
8 | #include <linux/scatterlist.h> | 8 | #include <linux/scatterlist.h> |
9 | #include <linux/mutex.h> | 9 | #include <linux/mutex.h> |
10 | 10 | #include <linux/timer.h> | |
11 | #include <linux/usb.h> | 11 | #include <linux/usb.h> |
12 | 12 | ||
13 | #define SIMPLE_IO_TIMEOUT 10000 /* in milliseconds */ | 13 | #define SIMPLE_IO_TIMEOUT 10000 /* in milliseconds */ |
@@ -484,6 +484,14 @@ alloc_sglist(int nents, int max, int vary) | |||
484 | return sg; | 484 | return sg; |
485 | } | 485 | } |
486 | 486 | ||
487 | static void sg_timeout(unsigned long _req) | ||
488 | { | ||
489 | struct usb_sg_request *req = (struct usb_sg_request *) _req; | ||
490 | |||
491 | req->status = -ETIMEDOUT; | ||
492 | usb_sg_cancel(req); | ||
493 | } | ||
494 | |||
487 | static int perform_sglist( | 495 | static int perform_sglist( |
488 | struct usbtest_dev *tdev, | 496 | struct usbtest_dev *tdev, |
489 | unsigned iterations, | 497 | unsigned iterations, |
@@ -495,6 +503,9 @@ static int perform_sglist( | |||
495 | { | 503 | { |
496 | struct usb_device *udev = testdev_to_usbdev(tdev); | 504 | struct usb_device *udev = testdev_to_usbdev(tdev); |
497 | int retval = 0; | 505 | int retval = 0; |
506 | struct timer_list sg_timer; | ||
507 | |||
508 | setup_timer_on_stack(&sg_timer, sg_timeout, (unsigned long) req); | ||
498 | 509 | ||
499 | while (retval == 0 && iterations-- > 0) { | 510 | while (retval == 0 && iterations-- > 0) { |
500 | retval = usb_sg_init(req, udev, pipe, | 511 | retval = usb_sg_init(req, udev, pipe, |
@@ -505,7 +516,10 @@ static int perform_sglist( | |||
505 | 516 | ||
506 | if (retval) | 517 | if (retval) |
507 | break; | 518 | break; |
519 | mod_timer(&sg_timer, jiffies + | ||
520 | msecs_to_jiffies(SIMPLE_IO_TIMEOUT)); | ||
508 | usb_sg_wait(req); | 521 | usb_sg_wait(req); |
522 | del_timer_sync(&sg_timer); | ||
509 | retval = req->status; | 523 | retval = req->status; |
510 | 524 | ||
511 | /* FIXME check resulting data pattern */ | 525 | /* FIXME check resulting data pattern */ |