]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
[media] uvcvideo: Don't record timespec_sub
authorKieran Bingham <kieran.bingham@ideasonboard.com>
Mon, 3 Apr 2017 11:25:31 +0000 (08:25 -0300)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Mon, 10 Apr 2017 10:42:12 +0000 (07:42 -0300)
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>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/media/usb/uvc/uvc_video.c

index 128c0a7826cea55bc28a55af9a597ebf4165fd1f..47d93a938ddefb001d87e3622be37fffc9c7a267 100644 (file)
@@ -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.