public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>,
	y2038@lists.linaro.org,
	Kieran Bingham <kieran.bingham@ideasonboard.com>,
	Guennadi Liakhovetski <g.liakhovetski@gmx.de>,
	Hans Verkuil <hans.verkuil@cisco.com>,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/8] [media] uvc_video: use ktime_t for stats
Date: Tue, 05 Dec 2017 02:40:05 +0200	[thread overview]
Message-ID: <5754187.M8RXguK81k@avalon> (raw)
In-Reply-To: <20171127132027.1734806-1-arnd@arndb.de>

Hi Arnd,

Thank you for the patch.

On Monday, 27 November 2017 15:19:53 EET Arnd Bergmann wrote:
> 'struct timespec' works fine here, but we try to migrate
> away from it in favor of ktime_t or timespec64. In this
> case, using ktime_t produces the simplest code.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  drivers/media/usb/uvc/uvc_video.c | 11 ++++-------
>  drivers/media/usb/uvc/uvcvideo.h  |  4 ++--
>  2 files changed, 6 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/media/usb/uvc/uvc_video.c
> b/drivers/media/usb/uvc/uvc_video.c index fb86d6af398d..d6bee37cd1b8 100644
> --- a/drivers/media/usb/uvc/uvc_video.c
> +++ b/drivers/media/usb/uvc/uvc_video.c
> @@ -725,7 +725,7 @@ static void uvc_video_stats_decode(struct uvc_streaming
> *stream,
> 
>  	if (stream->stats.stream.nb_frames == 0 &&
>  	    stream->stats.frame.nb_packets == 0)
> -		ktime_get_ts(&stream->stats.stream.start_ts);
> +		stream->stats.stream.start_ts = ktime_get();
> 
>  	switch (data[1] & (UVC_STREAM_PTS | UVC_STREAM_SCR)) {
>  	case UVC_STREAM_PTS | UVC_STREAM_SCR:
> @@ -865,16 +865,13 @@ size_t uvc_video_stats_dump(struct uvc_streaming
> *stream, char *buf, {
>  	unsigned int scr_sof_freq;
>  	unsigned int duration;
> -	struct timespec ts;
>  	size_t count = 0;
> 
> -	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.
>  	 */
> -	duration = ts.tv_sec * 1000 + ts.tv_nsec / 1000000;
> +	duration = ktime_ms_delta(stream->stats.stream.stop_ts,
> +				  stream->stats.stream.start_ts);
>  	if (duration != 0)
>  		scr_sof_freq = stream->stats.stream.scr_sof_count * 1000
>  			     / duration;
> @@ -915,7 +912,7 @@ static void uvc_video_stats_start(struct uvc_streaming
> *stream)
> 
>  static void uvc_video_stats_stop(struct uvc_streaming *stream)
>  {
> -	ktime_get_ts(&stream->stats.stream.stop_ts);
> +	stream->stats.stream.stop_ts = ktime_get();
>  }
> 
>  /* ------------------------------------------------------------------------
> diff --git a/drivers/media/usb/uvc/uvcvideo.h
> b/drivers/media/usb/uvc/uvcvideo.h index 05398784d1c8..a2c190937067 100644
> --- a/drivers/media/usb/uvc/uvcvideo.h
> +++ b/drivers/media/usb/uvc/uvcvideo.h
> @@ -452,8 +452,8 @@ struct uvc_stats_frame {
>  };
> 
>  struct uvc_stats_stream {
> -	struct timespec start_ts;	/* Stream start timestamp */
> -	struct timespec stop_ts;	/* Stream stop timestamp */
> +	ktime_t start_ts;		/* Stream start timestamp */
> +	ktime_t stop_ts;		/* Stream stop timestamp */
> 
>  	unsigned int nb_frames;		/* Number of frames */


-- 
Regards,

Laurent Pinchart

      parent reply	other threads:[~2017-12-05  0:39 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-27 13:19 [PATCH 1/8] [media] uvc_video: use ktime_t for stats Arnd Bergmann
2017-11-27 13:19 ` [PATCH 2/8] [media] uvc_video: use ktime_t for timestamps Arnd Bergmann
2017-12-05  0:37   ` Laurent Pinchart
2017-12-05  0:58     ` Laurent Pinchart
2017-12-05 11:27       ` Arnd Bergmann
2017-11-27 13:19 ` [PATCH 3/8] [media] solo6x10: use ktime_get_ts64() for time sync Arnd Bergmann
2017-11-27 20:45   ` Ismael Luceno
2017-11-27 13:19 ` [PATCH 5/8] [media] omap3isp: support 64-bit version of omap3isp_stat_data Arnd Bergmann
2017-12-05  0:41   ` Laurent Pinchart
2018-01-16 17:10     ` Arnd Bergmann
2017-11-27 13:19 ` [PATCH 6/8] [media] vivid: use ktime_t for timestamp calculation Arnd Bergmann
2017-11-27 15:14   ` Hans Verkuil
2017-11-27 15:25     ` Arnd Bergmann
2017-11-27 13:19 ` [PATCH 7/8] [media] staging: atomisp: convert timestamps to ktime_t Arnd Bergmann
2017-11-27 15:05   ` Andy Shevchenko
2017-11-27 15:20     ` [Y2038] " Arnd Bergmann
2017-11-27 13:20 ` [PATCH 8/8] [media] staging: imx: use ktime_t for timestamps Arnd Bergmann
2017-12-01 23:55   ` Steve Longerbeam
2017-12-05  0:40 ` Laurent Pinchart [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5754187.M8RXguK81k@avalon \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=arnd@arndb.de \
    --cc=g.liakhovetski@gmx.de \
    --cc=hans.verkuil@cisco.com \
    --cc=kieran.bingham@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=y2038@lists.linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox