From: Ismael Luceno <ismael@iodev.co.uk>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Bluecherry Maintainers <maintainers@bluecherrydvr.com>,
Anton Sviridenko <anton@corp.bluecherry.net>,
Andrey Utkin <andrey.utkin@corp.bluecherry.net>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
y2038@lists.linaro.org, linux-media@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/8] [media] solo6x10: use ktime_get_ts64() for time sync
Date: Mon, 27 Nov 2017 17:45:31 -0300 [thread overview]
Message-ID: <20171127204530.GB330@pirotess.bf.iodev.co.uk> (raw)
In-Reply-To: <20171127132027.1734806-3-arnd@arndb.de>
[-- Attachment #1: Type: text/plain, Size: 2230 bytes --]
On 27/Nov/2017 14:19, Arnd Bergmann wrote:
> solo6x10 correctly deals with time stamps and will never
> suffer from overflows, but it uses the deprecated 'struct timespec'
> type and 'ktime_get_ts()' interface to read the monotonic clock.
>
> This changes it to use ktime_get_ts64() instead, so we can
> eventually remove ktime_get_ts().
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> drivers/media/pci/solo6x10/solo6x10-core.c | 17 +++++++++--------
> 1 file changed, 9 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/media/pci/solo6x10/solo6x10-core.c b/drivers/media/pci/solo6x10/solo6x10-core.c
> index ca0873e47bea..19ffd2ed3cc7 100644
> --- a/drivers/media/pci/solo6x10/solo6x10-core.c
> +++ b/drivers/media/pci/solo6x10/solo6x10-core.c
> @@ -47,18 +47,19 @@ MODULE_PARM_DESC(full_eeprom, "Allow access to full 128B EEPROM (dangerous)");
>
> static void solo_set_time(struct solo_dev *solo_dev)
> {
> - struct timespec ts;
> + struct timespec64 ts;
>
> - ktime_get_ts(&ts);
> + ktime_get_ts64(&ts);
>
> - solo_reg_write(solo_dev, SOLO_TIMER_SEC, ts.tv_sec);
> - solo_reg_write(solo_dev, SOLO_TIMER_USEC, ts.tv_nsec / NSEC_PER_USEC);
> + /* no overflow because we use monotonic timestamps */
> + solo_reg_write(solo_dev, SOLO_TIMER_SEC, (u32)ts.tv_sec);
> + solo_reg_write(solo_dev, SOLO_TIMER_USEC, (u32)ts.tv_nsec / NSEC_PER_USEC);
> }
>
> static void solo_timer_sync(struct solo_dev *solo_dev)
> {
> u32 sec, usec;
> - struct timespec ts;
> + struct timespec64 ts;
> long diff;
>
> if (solo_dev->type != SOLO_DEV_6110)
> @@ -72,11 +73,11 @@ static void solo_timer_sync(struct solo_dev *solo_dev)
> sec = solo_reg_read(solo_dev, SOLO_TIMER_SEC);
> usec = solo_reg_read(solo_dev, SOLO_TIMER_USEC);
>
> - ktime_get_ts(&ts);
> + ktime_get_ts64(&ts);
>
> - diff = (long)ts.tv_sec - (long)sec;
> + diff = (s32)ts.tv_sec - (s32)sec;
> diff = (diff * 1000000)
> - + ((long)(ts.tv_nsec / NSEC_PER_USEC) - (long)usec);
> + + ((s32)(ts.tv_nsec / NSEC_PER_USEC) - (s32)usec);
>
> if (diff > 1000 || diff < -1000) {
> solo_set_time(solo_dev);
> --
> 2.9.0
>
Signed-off-by: Ismael Luceno <ismael@iodev.co.uk>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2017-11-27 20:55 UTC|newest]
Thread overview: 20+ 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 [this message]
2017-11-27 13:19 ` [PATCH 4/8] [media] staging: bcm2835-camera use ktime_t for timestamps Arnd Bergmann
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 ` [PATCH 1/8] [media] uvc_video: use ktime_t for stats Laurent Pinchart
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=20171127204530.GB330@pirotess.bf.iodev.co.uk \
--to=ismael@iodev.co.uk \
--cc=andrey.utkin@corp.bluecherry.net \
--cc=anton@corp.bluecherry.net \
--cc=arnd@arndb.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=maintainers@bluecherrydvr.com \
--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
all inboxes | Powered by JetHome®