aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKieran Bingham <kieran.bingham@ideasonboard.com>2017-04-10 11:24:22 -0700
committerMichal Simek <michal.simek@xilinx.com>2017-04-21 07:55:52 +0200
commit77d6590adafe0b51c37e8f0335b2780ef8a9b7c0 (patch)
tree0b52e99a082e7e106aeff92ded38b625e3ca414f
parent3203228aae64b28c222c485eb13b5a7db9d1c426 (diff)
downloadlinux-77d6590adafe0b51c37e8f0335b2780ef8a9b7c0.tar.gz
uvcvideo: don't recode timespec_sub
The statistics function subtracts two timespecs manually. A helper is provided by the kernel to do this. Replace the implementation, using the helper. Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
-rw-r--r--drivers/media/usb/uvc/uvc_video.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/drivers/media/usb/uvc/uvc_video.c b/drivers/media/usb/uvc/uvc_video.c
index c2885648110880..bc8b95c7238db1 100644
--- a/drivers/media/usb/uvc/uvc_video.c
+++ b/drivers/media/usb/uvc/uvc_video.c
@@ -868,14 +868,8 @@ size_t uvc_video_stats_dump(struct uvc_streaming *stream, char *buf,
struct timespec ts;
size_t count = 0;
- ts.tv_sec = stream->stats.stream.stop_ts.tv_sec
- - stream->stats.stream.start_ts.tv_sec;
- ts.tv_nsec = stream->stats.stream.stop_ts.tv_nsec
- - stream->stats.stream.start_ts.tv_nsec;
- if (ts.tv_nsec < 0) {
- ts.tv_sec--;
- ts.tv_nsec += 1000000000;
- }
+ ts = timespec_sub(stream->stats.stream.stop_ts,
+ stream->stats.stream.start_ts);
/* Compute the SCR.SOF frequency estimate. At the nominal 1kHz SOF
* frequency this will not overflow before more than 1h.