aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/misc/usbtest.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-11-13 20:56:58 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2017-11-13 20:56:58 -0500
commit2bcc673101268dc50e52b83226c5bbf38391e16d (patch)
tree0cdaf6affa8b05d436c2e8b80ff23e8c7f03a30a /drivers/usb/misc/usbtest.c
parent670310dfbae0eefe7318ff6a61e29e67a7a7bbce (diff)
parentb24591e2fcf852ad7ad2ccf745c8220bf378d312 (diff)
Merge branch 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull timer updates from Thomas Gleixner: "Yet another big pile of changes: - More year 2038 work from Arnd slowly reaching the point where we need to think about the syscalls themself. - A new timer function which allows to conditionally (re)arm a timer only when it's either not running or the new expiry time is sooner than the armed expiry time. This allows to use a single timer for multiple timeout requirements w/o caring about the first expiry time at the call site. - A new NMI safe accessor to clock real time for the printk timestamp work. Can be used by tracing, perf as well if required. - A large number of timer setup conversions from Kees which got collected here because either maintainers requested so or they simply got ignored. As Kees pointed out already there are a few trivial merge conflicts and some redundant commits which was unavoidable due to the size of this conversion effort. - Avoid a redundant iteration in the timer wheel softirq processing. - Provide a mechanism to treat RTC implementations depending on their hardware properties, i.e. don't inflict the write at the 0.5 seconds boundary which originates from the PC CMOS RTC to all RTCs. No functional change as drivers need to be updated separately. - The usual small updates to core code clocksource drivers. Nothing really exciting" * 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (111 commits) timers: Add a function to start/reduce a timer pstore: Use ktime_get_real_fast_ns() instead of __getnstimeofday() timer: Prepare to change all DEFINE_TIMER() callbacks netfilter: ipvs: Convert timers to use timer_setup() scsi: qla2xxx: Convert timers to use timer_setup() block/aoe: discover_timer: Convert timers to use timer_setup() ide: Convert timers to use timer_setup() drbd: Convert timers to use timer_setup() mailbox: Convert timers to use timer_setup() crypto: Convert timers to use timer_setup() drivers/pcmcia: omap1: Fix error in automated timer conversion ARM: footbridge: Fix typo in timer conversion drivers/sgi-xp: Convert timers to use timer_setup() drivers/pcmcia: Convert timers to use timer_setup() drivers/memstick: Convert timers to use timer_setup() drivers/macintosh: Convert timers to use timer_setup() hwrng/xgene-rng: Convert timers to use timer_setup() auxdisplay: Convert timers to use timer_setup() sparc/led: Convert timers to use timer_setup() mips: ip22/32: Convert timers to use timer_setup() ...
Diffstat (limited to 'drivers/usb/misc/usbtest.c')
-rw-r--r--drivers/usb/misc/usbtest.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c
index b3fc602b2e24..5ad74750e8a4 100644
--- a/drivers/usb/misc/usbtest.c
+++ b/drivers/usb/misc/usbtest.c
@@ -576,11 +576,16 @@ alloc_sglist(int nents, int max, int vary, struct usbtest_dev *dev, int pipe)
576 return sg; 576 return sg;
577} 577}
578 578
579static void sg_timeout(unsigned long _req) 579struct sg_timeout {
580 struct timer_list timer;
581 struct usb_sg_request *req;
582};
583
584static void sg_timeout(struct timer_list *t)
580{ 585{
581 struct usb_sg_request *req = (struct usb_sg_request *) _req; 586 struct sg_timeout *timeout = from_timer(timeout, t, timer);
582 587
583 usb_sg_cancel(req); 588 usb_sg_cancel(timeout->req);
584} 589}
585 590
586static int perform_sglist( 591static int perform_sglist(
@@ -594,9 +599,11 @@ static int perform_sglist(
594{ 599{
595 struct usb_device *udev = testdev_to_usbdev(tdev); 600 struct usb_device *udev = testdev_to_usbdev(tdev);
596 int retval = 0; 601 int retval = 0;
597 struct timer_list sg_timer; 602 struct sg_timeout timeout = {
603 .req = req,
604 };
598 605
599 setup_timer_on_stack(&sg_timer, sg_timeout, (unsigned long) req); 606 timer_setup_on_stack(&timeout.timer, sg_timeout, 0);
600 607
601 while (retval == 0 && iterations-- > 0) { 608 while (retval == 0 && iterations-- > 0) {
602 retval = usb_sg_init(req, udev, pipe, 609 retval = usb_sg_init(req, udev, pipe,
@@ -607,13 +614,14 @@ static int perform_sglist(
607 614
608 if (retval) 615 if (retval)
609 break; 616 break;
610 mod_timer(&sg_timer, jiffies + 617 mod_timer(&timeout.timer, jiffies +
611 msecs_to_jiffies(SIMPLE_IO_TIMEOUT)); 618 msecs_to_jiffies(SIMPLE_IO_TIMEOUT));
612 usb_sg_wait(req); 619 usb_sg_wait(req);
613 if (!del_timer_sync(&sg_timer)) 620 if (!del_timer_sync(&timeout.timer))
614 retval = -ETIMEDOUT; 621 retval = -ETIMEDOUT;
615 else 622 else
616 retval = req->status; 623 retval = req->status;
624 destroy_timer_on_stack(&timeout.timer);
617 625
618 /* FIXME check resulting data pattern */ 626 /* FIXME check resulting data pattern */
619 627