aboutsummaryrefslogtreecommitdiff
path: root/drivers/media/test-drivers/vivid/vivid-kthread-out.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/test-drivers/vivid/vivid-kthread-out.c')
-rw-r--r--drivers/media/test-drivers/vivid/vivid-kthread-out.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/media/test-drivers/vivid/vivid-kthread-out.c b/drivers/media/test-drivers/vivid/vivid-kthread-out.c
index 79c57d14ac4e..0833e021bb11 100644
--- a/drivers/media/test-drivers/vivid/vivid-kthread-out.c
+++ b/drivers/media/test-drivers/vivid/vivid-kthread-out.c
@@ -18,6 +18,7 @@
#include <linux/freezer.h>
#include <linux/random.h>
#include <linux/v4l2-dv-timings.h>
+#include <linux/jiffies.h>
#include <asm/div64.h>
#include <media/videobuf2-vmalloc.h>
#include <media/v4l2-dv-timings.h>
@@ -154,12 +155,13 @@ static int vivid_thread_vid_out(void *data)
/* Resets frame counters */
dev->out_seq_offset = 0;
- if (dev->seq_wrap)
- dev->out_seq_count = 0xffffff80U;
+ dev->out_seq_count = 0;
dev->jiffies_vid_out = jiffies;
- dev->vid_out_seq_start = dev->vbi_out_seq_start = 0;
- dev->meta_out_seq_start = 0;
dev->out_seq_resync = false;
+ if (dev->time_wrap)
+ dev->time_wrap_offset = dev->time_wrap - ktime_get_ns();
+ else
+ dev->time_wrap_offset = 0;
for (;;) {
try_to_freeze();
@@ -233,7 +235,7 @@ static int vivid_thread_vid_out(void *data)
next_jiffies_since_start = jiffies_since_start;
wait_jiffies = next_jiffies_since_start - jiffies_since_start;
- while (jiffies - cur_jiffies < wait_jiffies &&
+ while (time_is_after_jiffies(cur_jiffies + wait_jiffies) &&
!kthread_should_stop())
schedule();
}