From patchwork Mon Nov 27 16:46:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 10077295 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 BB6BC60353 for ; Mon, 27 Nov 2017 16:48:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AE02428F18 for ; Mon, 27 Nov 2017 16:48:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A2A0328F3A; Mon, 27 Nov 2017 16:48:26 +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=ham 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 5214028F30 for ; Mon, 27 Nov 2017 16:48:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752777AbdK0QsZ (ORCPT ); Mon, 27 Nov 2017 11:48:25 -0500 Received: from mout.kundenserver.de ([212.227.17.10]:50681 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752586AbdK0QsY (ORCPT ); Mon, 27 Nov 2017 11:48:24 -0500 Received: from wuerfel.lan ([109.193.157.232]) by mrelayeu.kundenserver.de (mreue104 [212.227.15.145]) with ESMTPA (Nemesis) id 0Lutwv-1fJKrb3Buz-0101CP; Mon, 27 Nov 2017 17:48:02 +0100 From: Arnd Bergmann To: Bartlomiej Zolnierkiewicz Cc: Arnd Bergmann , "Gustavo A. R. Silva" , Himanshu Jha , dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] fbdev: pxa3xx: use ktime_get_ts64 for time stamps Date: Mon, 27 Nov 2017 17:46:14 +0100 Message-Id: <20171127164755.525720-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:/ToxUlAhza5Y4L4MslbIQqiPJKCmxYL9dqh+MuqQNtuZNvb/5ZE fFJIr/BHdnUy6A//qE94dEcEho8wQFBxHcC4Aw7+0O2R/5hrHbB5SL7q0Ylzn+Uniw1AHmM hZMVO8o+yRjUFUaMCJtCV18WXsRp2OdkuGmo/0ZA7L8LTDvhwyK4Jr/F4hVfKOLWftInsmC jzUqexbfomNAQbAqYGBdA== X-UI-Out-Filterresults: notjunk:1; V01:K0:T3PYlyE6Ep8=:QaBkfkL5ktMxVLpj+Srt1+ m3h5k2dOZcdvA+DXdoVX6BLj/Ib6p009k+pRs8+SCjFU3Pn0xcseLoDkv2go1oReNFnt3fniE M8FhIWdtgG84QyxAHK7AD2p2JZm3A06fopX0BN0Nxv/8Dzugy+nj1ORAX2WevQDbZhvt9wfqX ivbJ1tJ6BiYlrbKje5+PCE3Oujq98ul7G6WNx9pTSEMEb7oJ6TIsAfFA2Z8wraBDP4akePH8n rZfngOtOFiT7gxIbIt58YVwOw1PtCgysyssl9czrXFFI43QwlrDl+i32HuJvfMv+3kYRg6gOk Oig3mDWvFuB5jaMO1fgaABGJaYT4Vq97nJuCc36dQ4Ham1x2J1xV9mT9AHMP8ijHjsemtav7U UfcTkRzmTi4MdFKnTBmoT+VK+N81tiBqemHM48cEiFw3aY/yGmPV0m1LSNGgowba/an4eKz1R CUjPGD5480ZZQ6u/pS5f3eYs6HFbwkppYe06AYnT9JjaEsRVo2URAEJisfDO34V8XuMwQCmft ejZj4K3+SxQwcmUXHhnhTs/RJUEizXs48BJnykO+aPM7GL8LJ3xo1C2jn+yyNavrXV8g0jjxq GFqlzZFVtETP4kOluk7Eg6RBc5y9/iu7vks08ZL+bSEWGNiAzaAXYSAMSS9wvFGsWfLUsvJ6P aK31fmIB5O+KNCeAzsgjC8xVpd6WqvbQJLzaxsf6gz3mvLy+7UMlHJjrAYbv+f+aLj/XUcyUy nL1bEqLqTckma9NXPLSfUJ672MvbjjYn5NWnnw== Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP do_gettimeofday() is deprecated because it is not y2038 safe, so I'm changing the calculation for the diagnostic output over to using 'timespec64'. We really only print time deltas here, so changing it to monotonic time makes this more robust, the correct accessor for this is ktime_get_ts64(). Signed-off-by: Arnd Bergmann --- v2: fix typo --- drivers/video/fbdev/pxa3xx-gcu.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/video/fbdev/pxa3xx-gcu.c b/drivers/video/fbdev/pxa3xx-gcu.c index 55fbb432c053..0955622a1227 100644 --- a/drivers/video/fbdev/pxa3xx-gcu.c +++ b/drivers/video/fbdev/pxa3xx-gcu.c @@ -104,7 +104,7 @@ struct pxa3xx_gcu_priv { wait_queue_head_t wait_idle; wait_queue_head_t wait_free; spinlock_t spinlock; - struct timeval base_time; + struct timespec64 base_time; struct pxa3xx_gcu_batch *free; struct pxa3xx_gcu_batch *ready; @@ -126,18 +126,20 @@ gc_writel(struct pxa3xx_gcu_priv *priv, unsigned int off, unsigned long val) #define QPRINT(priv, level, msg) \ do { \ - struct timeval tv; \ + struct timespec64 ts; \ struct pxa3xx_gcu_shared *shared = priv->shared; \ u32 base = gc_readl(priv, REG_GCRBBR); \ \ - do_gettimeofday(&tv); \ + ktime_get_ts64(&ts); \ + ts = timespec64_sub(ts, priv->base_time); \ \ - printk(level "%ld.%03ld.%03ld - %-17s: %-21s (%s, " \ + printk(level "%lld.%03ld.%03ld - %-17s: %-21s (%s, " \ "STATUS " \ "0x%02lx, B 0x%08lx [%ld], E %5ld, H %5ld, " \ "T %5ld)\n", \ - tv.tv_sec - priv->base_time.tv_sec, \ - tv.tv_usec / 1000, tv.tv_usec % 1000, \ + (s64)(ts.tv_sec), \ + ts.tv_nsec / NSEC_PER_MSEC, \ + (ts.tv_nsec % NSEC_PER_MSEC) / USEC_PER_MSEC, \ __func__, msg, \ shared->hw_running ? "running" : " idle", \ gc_readl(priv, REG_GCISCR), \ @@ -164,7 +166,7 @@ pxa3xx_gcu_reset(struct pxa3xx_gcu_priv *priv) priv->shared->buffer_phys = priv->shared_phys; priv->shared->magic = PXA3XX_GCU_SHARED_MAGIC; - do_gettimeofday(&priv->base_time); + ktime_get_ts64(&priv->base_time); /* set up the ring buffer pointers */ gc_writel(priv, REG_GCRBLR, 0);