From patchwork Mon Nov 27 13:19:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 10076891 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 65BFF602BC for ; Mon, 27 Nov 2017 13:21:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 55FC128E41 for ; Mon, 27 Nov 2017 13:21:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4AFA228E46; Mon, 27 Nov 2017 13:21:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DE1EA28E41 for ; Mon, 27 Nov 2017 13:21:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752445AbdK0NVC (ORCPT ); Mon, 27 Nov 2017 08:21:02 -0500 Received: from mout.kundenserver.de ([217.72.192.74]:64383 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751570AbdK0NVA (ORCPT ); Mon, 27 Nov 2017 08:21:00 -0500 Received: from wuerfel.lan ([109.193.157.232]) by mrelayeu.kundenserver.de (mreue102 [212.227.15.145]) with ESMTPA (Nemesis) id 0MC1MO-1eS91r1qDo-008uOH; Mon, 27 Nov 2017 14:20:55 +0100 From: Arnd Bergmann To: Bluecherry Maintainers , Anton Sviridenko , Andrey Utkin , Ismael Luceno , Mauro Carvalho Chehab Cc: y2038@lists.linaro.org, Arnd Bergmann , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/8] [media] solo6x10: use ktime_get_ts64() for time sync Date: Mon, 27 Nov 2017 14:19:55 +0100 Message-Id: <20171127132027.1734806-3-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20171127132027.1734806-1-arnd@arndb.de> References: <20171127132027.1734806-1-arnd@arndb.de> X-Provags-ID: V03:K0:FbTw/8Y9brlcBCI1tpM56+AGBf2vaLj19c24OzcxKAi/ImSqk5H EgrkiIWtuwATl2NplOaNQ4s+UCAEQNFpAfDOUG3CFFxE+5CNAHMg09VKvntiCTsOaEjPsbN ngBES4n6S3nPyIH5tB82lk7Zyjo+o0Z/RzrAAhnCYc/d4isX/c/IlMO7lpbSCuTR9s1zgb1 6ohMlb94Cxbimskgd4g/g== X-UI-Out-Filterresults: notjunk:1; V01:K0:AN3otbxvyvo=:8chms7JmlGDs04j7uUlts/ zDasdAoEIBxWQfh3b83bELpqBaZen4f7GWIG5lodo5jCb7FA4utBwAtljorf9WSgvC21bjEdC BvqHfV5aDm3tipoK2aPlzC8kEkp6NIU5pBG/OfmfmhFOhAxyUb3woo35o7ggXAh0HY7KxSTO1 /zS/xDcYBcxgilQE+T/eX+3ze8Ej/VY8ZNdnm8+/RdyyQLfhpNTV/KoewIjj5Du1sMg+9msoL 5xNenZkQg+tciKkOtQQ0EZ+Iwv+yIxJAVg8WvBrs1JYSM66iWlclq1sqIsYYKecOkhpoBMHZU S8MhVv4NU/9+WO2sdBvCf2JyQcc8+CoES/Q4sOCjFsyZFjvli5Gr5TbH6ZUYn4UdumBaJhp5A BcuyUt4pGrHEEouZAmz2MsihxSLfV57z8F3QK3BACQ3X8H+eK7/z/utFaGKjn5JE1qNg2hrpT fNm2UcbKGHkn5vvQ/Sm2Ok3ZtgrposfWpy5J6P2XOOC8PZlLyOZCRnV5BwIkStPJBki1QSp6p GXWYhn4aHNuxDvNE1uhlEIGOWir+50VV9Mcm5sQ2YIVg5kb7A5vdoYpQsKcA0OJw9ZptJKk4A obORgYSQybG/rA28lUkVbDjA8dNOlU9I89QY6C5ex3pad8uAcQD8phAdpl5eF4HcONcn05H14 2hQ3S+TVVF1xXSJO8l4mTUGrCQK0gD8l+t0eg2SyRYbjbTLG78vplvcJuHZOydiuff/OWRTrY v8hGB6nDlp/AYGx9xhIlWGvp/vYyi5xCuvL8Ng== Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Signed-off-by: Ismael Luceno --- 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);