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: 10077293 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 3237160353 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 243B728F30 for ; Mon, 27 Nov 2017 16:48:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 18A7728F37; 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=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B19A828F30 for ; Mon, 27 Nov 2017 16:48:25 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E30EB89E5F; Mon, 27 Nov 2017 16:48:23 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.17.10]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9607A89E5F for ; Mon, 27 Nov 2017 16:48:22 +0000 (UTC) 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 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== Cc: linux-fbdev@vger.kernel.org, Arnd Bergmann , "Gustavo A. R. Silva" , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Himanshu Jha X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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);