summaryrefslogtreecommitdiff
path: root/drivers/media/video
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-03-15 17:06:05 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2012-03-15 17:06:05 -0700
commit72c79bdbda396b7f67e97b2a89410ac91d814c1b (patch)
tree64603d5598ec65f5be36d7666b9f53fc4a3b326c /drivers/media/video
parentfe83558a33f509277aa07566d484096cc7149807 (diff)
parentd138210ffa90e6c78e3f7a2c348f50e865ff735c (diff)
Merge branch 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media
Pull media fixes from Mauro Carvalho Chehab: "For 4 fixes for 3.3 (all trivial): - uvc video driver: fixes a division by zero; - davinci: add module.h to fix compilation; - smsusb: fix the delivery system setting; - smsdvb: the get_frontend implementation there is broken. The smsdvb patch has 127 lines, but it is trivial: instead of returning a cache of the set_frontend (with is wrong, as it doesn't have the updated values for the data, and the implementation there is buggy), it copies the information of the detected DVB parameters from the smsdvb private structures into the corresponding DVBv5 struct fields." * 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: [media] smsdvb: fix get_frontend [media] smsusb: fix the default delivery system setting [media] media: davinci: added module.h to resolve unresolved macros [media] [FOR,v3.3] uvcvideo: Avoid division by 0 in timestamp calculation
Diffstat (limited to 'drivers/media/video')
-rw-r--r--drivers/media/video/davinci/isif.c1
-rw-r--r--drivers/media/video/uvc/uvc_video.c14
2 files changed, 10 insertions, 5 deletions
diff --git a/drivers/media/video/davinci/isif.c b/drivers/media/video/davinci/isif.c
index 1e63852374be..5278fe7d6d0c 100644
--- a/drivers/media/video/davinci/isif.c
+++ b/drivers/media/video/davinci/isif.c
@@ -34,6 +34,7 @@
#include <linux/videodev2.h>
#include <linux/clk.h>
#include <linux/err.h>
+#include <linux/module.h>
#include <mach/mux.h>
diff --git a/drivers/media/video/uvc/uvc_video.c b/drivers/media/video/uvc/uvc_video.c
index c7e69b8f81c9..4a44f9a1bae0 100644
--- a/drivers/media/video/uvc/uvc_video.c
+++ b/drivers/media/video/uvc/uvc_video.c
@@ -611,9 +611,11 @@ void uvc_video_clock_update(struct uvc_streaming *stream,
delta_stc = buf->pts - (1UL << 31);
x1 = first->dev_stc - delta_stc;
x2 = last->dev_stc - delta_stc;
+ if (x1 == x2)
+ goto done;
+
y1 = (first->dev_sof + 2048) << 16;
y2 = (last->dev_sof + 2048) << 16;
-
if (y2 < y1)
y2 += 2048 << 16;
@@ -631,14 +633,16 @@ void uvc_video_clock_update(struct uvc_streaming *stream,
x1, x2, y1, y2, clock->sof_offset);
/* Second step, SOF to host clock conversion. */
- ts = timespec_sub(last->host_ts, first->host_ts);
x1 = (uvc_video_clock_host_sof(first) + 2048) << 16;
x2 = (uvc_video_clock_host_sof(last) + 2048) << 16;
- y1 = NSEC_PER_SEC;
- y2 = (ts.tv_sec + 1) * NSEC_PER_SEC + ts.tv_nsec;
-
if (x2 < x1)
x2 += 2048 << 16;
+ if (x1 == x2)
+ goto done;
+
+ ts = timespec_sub(last->host_ts, first->host_ts);
+ y1 = NSEC_PER_SEC;
+ y2 = (ts.tv_sec + 1) * NSEC_PER_SEC + ts.tv_nsec;
/* Interpolated and host SOF timestamps can wrap around at slightly
* different times. Handle this by adding or removing 2048 to or from