aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/c-qcam.c
diff options
context:
space:
mode:
authorJulia Lawall <julia@diku.dk>2008-04-16 15:13:15 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-04-24 13:09:40 -0400
commit168c626cb8f85df17585af99e14403904641c7ac (patch)
treeb3b899a507b76afc2923d4f7d6c1ed995957a4fc /drivers/media/video/c-qcam.c
parent9e05c0f0d84c25f7f576ebc22a9a3a2cf962cc58 (diff)
V4L/DVB (7591): drivers/media/video: use time_before, time_before_eq, etc
The functions time_before, time_before_eq, time_after, and time_after_eq are more robust for comparing jiffies against other values. A simplified version of the semantic patch making this change is as follows: (http://www.emn.fr/x-info/coccinelle/) // <smpl> @ change_compare_np @ expression E; @@ ( - jiffies <= E + time_before_eq(jiffies,E) | - jiffies >= E + time_after_eq(jiffies,E) | - jiffies < E + time_before(jiffies,E) | - jiffies > E + time_after(jiffies,E) ) @ include depends on change_compare_np @ @@ @ no_include depends on !include && change_compare_np @ @@ #include <linux/...> + #include <linux/jiffies.h> // </smpl> Signed-off-by: Julia Lawall <julia@diku.dk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/c-qcam.c')
-rw-r--r--drivers/media/video/c-qcam.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/media/video/c-qcam.c b/drivers/media/video/c-qcam.c
index 2c85ced61150..fe1e67bb1ca8 100644
--- a/drivers/media/video/c-qcam.c
+++ b/drivers/media/video/c-qcam.c
@@ -36,6 +36,7 @@
36#include <linux/videodev.h> 36#include <linux/videodev.h>
37#include <media/v4l2-common.h> 37#include <media/v4l2-common.h>
38#include <linux/mutex.h> 38#include <linux/mutex.h>
39#include <linux/jiffies.h>
39 40
40#include <asm/uaccess.h> 41#include <asm/uaccess.h>
41 42
@@ -95,7 +96,8 @@ static unsigned int qcam_await_ready1(struct qcam_device *qcam,
95 unsigned long oldjiffies = jiffies; 96 unsigned long oldjiffies = jiffies;
96 unsigned int i; 97 unsigned int i;
97 98
98 for (oldjiffies = jiffies; (jiffies - oldjiffies) < msecs_to_jiffies(40); ) 99 for (oldjiffies = jiffies;
100 time_before(jiffies, oldjiffies + msecs_to_jiffies(40)); )
99 if (qcam_ready1(qcam) == value) 101 if (qcam_ready1(qcam) == value)
100 return 0; 102 return 0;
101 103
@@ -120,7 +122,8 @@ static unsigned int qcam_await_ready2(struct qcam_device *qcam, int value)
120 unsigned long oldjiffies = jiffies; 122 unsigned long oldjiffies = jiffies;
121 unsigned int i; 123 unsigned int i;
122 124
123 for (oldjiffies = jiffies; (jiffies - oldjiffies) < msecs_to_jiffies(40); ) 125 for (oldjiffies = jiffies;
126 time_before(jiffies, oldjiffies + msecs_to_jiffies(40)); )
124 if (qcam_ready2(qcam) == value) 127 if (qcam_ready2(qcam) == value)
125 return 0; 128 return 0;
126 129