Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 52276df0 authored by Kieran Bingham's avatar Kieran Bingham Committed by Mauro Carvalho Chehab
Browse files

[media] uvcvideo: Don't record 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: default avatarKieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 360a3a90
Loading
Loading
Loading
Loading
+2 −8
Original line number Original line Diff line number Diff line
@@ -868,14 +868,8 @@ size_t uvc_video_stats_dump(struct uvc_streaming *stream, char *buf,
	struct timespec ts;
	struct timespec ts;
	size_t count = 0;
	size_t count = 0;


	ts.tv_sec = stream->stats.stream.stop_ts.tv_sec
	ts = timespec_sub(stream->stats.stream.stop_ts,
		  - stream->stats.stream.start_ts.tv_sec;
			  stream->stats.stream.start_ts);
	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;
	}


	/* Compute the SCR.SOF frequency estimate. At the nominal 1kHz SOF
	/* Compute the SCR.SOF frequency estimate. At the nominal 1kHz SOF
	 * frequency this will not overflow before more than 1h.
	 * frequency this will not overflow before more than 1h.