Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp3046405ybx; Fri, 8 Nov 2019 13:13:45 -0800 (PST) X-Google-Smtp-Source: APXvYqwHo2uOB2e6+iMQYf8p7KOGSFzGWkbP0NyLzlpo8BQAZ48m2usOawULSKsvDfIDSROsdtUn X-Received: by 2002:a50:da4b:: with SMTP id a11mr12637760edk.17.1573247625300; Fri, 08 Nov 2019 13:13:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573247625; cv=none; d=google.com; s=arc-20160816; b=vQLp16eA++2k/elyeGHQLxTqJzKG0TBBg8LGlFLcruFoATMesODM9bfl1m87vvOnIQ A5qY4yjgo4Yr6HqBxEeCj1GUYQgG/kwVzviXtThpJVve124dRMkH1SlZz+lxsEmCf8jl 43OuHGas7WCZhS1Gcvqr84Kb0OtcQrz9wDlUWzZ2syQ/Z3ag904hjlg9aAcUHAuIpZhl zRFEd9qUajfy1UopACoB3H04fApMlMPbVBwYc9e+1p1KC1VKY7k7rHdf27yZvYKdiIhT aVIA7eRDMhL0drCaTOtDDkeUvecY2lflFn3GjDuKOjY76dJCCjgRW3eptxkAn0R6uprE 6XEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=8PuORsoHACnpcO/lkXG5hkW1+8J+sLJGS2MQ4hsOa70=; b=qivswwWs26vLKOdy0QSpH/fJglVoAivc3AiZQrgsact60ANPx5yGF1+VwXBByZB0YQ YzU3Exdn3Ee8Iwop67UylNXMdBmbRTuxShxgf6s4F8x0HXLnAV2orLQhkZPa3PLDBmx6 LZfXSiEZtFOOq2wH0LctxScdKx6KXz7c9fIbxNf+t3/eC4PoVdQHfs2esAeY7ElUf64d LwfQYQQxBNY5zdK+KP/GApbWFE/hpxJSn/CTN2dA2IpoM3cs05p/IJsCYdsHqgolmpuM RL5kmiN2hnlVRfUmQzKt78TmMkHeHWZ2QeIn2+Sgvy8aP9xLN6jWFfVfpvol+AP0by6L zMtg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y12si4737635ejp.299.2019.11.08.13.13.22; Fri, 08 Nov 2019 13:13:45 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731379AbfKHVKi (ORCPT + 99 others); Fri, 8 Nov 2019 16:10:38 -0500 Received: from mout.kundenserver.de ([217.72.192.73]:40383 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727558AbfKHVKh (ORCPT ); Fri, 8 Nov 2019 16:10:37 -0500 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.145]) with ESMTPA (Nemesis) id 1MvJwN-1hbuBO0HpZ-00rIaY; Fri, 08 Nov 2019 22:10:35 +0100 From: Arnd Bergmann To: y2038@lists.linaro.org, Greentime Hu , Vincent Chen Cc: linux-kernel@vger.kernel.org, Arnd Bergmann , Vincenzo Frascino Subject: [PATCH 06/23] y2038: vdso: nds32: open-code timespec_add_ns() Date: Fri, 8 Nov 2019 22:07:26 +0100 Message-Id: <20191108210824.1534248-6-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191108210236.1296047-1-arnd@arndb.de> References: <20191108210236.1296047-1-arnd@arndb.de> MIME-Version: 1.0 Content-Transfer-Encoding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KQdoSbpRLN1wXvOh85s5T3Bt9flDh3P xwx3dSKCVt117fCza5IlcVAfqreCo6kVwaFVVfY4huHvhnbf9ydVEHZpRevXylWyEXIpsJ5mz tdlbq72Zg/YV+Dtf8ZFA== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The nds32 vdso is now the last user of the deprecated timespec_add_ns(). Change it to an open-coded version like the one it already uses in do_realtime(). What we should really do though is to use the generic vdso implementation that is now used in x86. arm and mips. Signed-off-by: Arnd Bergmann --- arch/nds32/kernel/vdso/gettimeofday.c | 33 ++++++++++++--------------- 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/arch/nds32/kernel/vdso/gettimeofday.c b/arch/nds32/kernel/vdso/gettimeofday.c index 687abc7145f5..9ec03cf0ec54 100644 --- a/arch/nds32/kernel/vdso/gettimeofday.c +++ b/arch/nds32/kernel/vdso/gettimeofday.c @@ -81,22 +81,20 @@ static notrace int do_realtime_coarse(struct __kernel_old_timespec *ts, static notrace int do_monotonic_coarse(struct __kernel_old_timespec *ts, struct vdso_data *vdata) { - struct timespec tomono; u32 seq; + u64 ns; do { seq = vdso_read_begin(vdata); - ts->tv_sec = vdata->xtime_coarse_sec; - ts->tv_nsec = vdata->xtime_coarse_nsec; - - tomono.tv_sec = vdata->wtm_clock_sec; - tomono.tv_nsec = vdata->wtm_clock_nsec; + ts->tv_sec = vdata->xtime_coarse_sec + vdata->wtm_clock_sec; + ns = vdata->xtime_coarse_nsec + vdata->wtm_clock_nsec; } while (vdso_read_retry(vdata, seq)); - ts->tv_sec += tomono.tv_sec; - timespec_add_ns(ts, tomono.tv_nsec); + ts->tv_sec += __iter_div_u64_rem(ns, NSEC_PER_SEC, &ns); + ts->tv_nsec = ns; + return 0; } @@ -135,26 +133,25 @@ static notrace int do_realtime(struct __kernel_old_timespec *ts, struct vdso_dat static notrace int do_monotonic(struct __kernel_old_timespec *ts, struct vdso_data *vdata) { - struct timespec tomono; - u64 nsecs; + u64 ns; u32 seq; do { seq = vdso_read_begin(vdata); ts->tv_sec = vdata->xtime_clock_sec; - nsecs = vdata->xtime_clock_nsec; - nsecs += vgetsns(vdata); - nsecs >>= vdata->cs_shift; + ns = vdata->xtime_clock_nsec; + ns += vgetsns(vdata); + ns >>= vdata->cs_shift; - tomono.tv_sec = vdata->wtm_clock_sec; - tomono.tv_nsec = vdata->wtm_clock_nsec; + ts->tv_sec += vdata->wtm_clock_sec; + ns += vdata->wtm_clock_nsec; } while (vdso_read_retry(vdata, seq)); - ts->tv_sec += tomono.tv_sec; - ts->tv_nsec = 0; - timespec_add_ns(ts, nsecs + tomono.tv_nsec); + ts->tv_sec += __iter_div_u64_rem(ns, NSEC_PER_SEC, &ns); + ts->tv_nsec = ns; + return 0; } -- 2.20.0