Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3984996imm; Mon, 18 Jun 2018 07:22:14 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIhcYdL6XKtY1oKx6YUwuJMFvy5DEcap/QJCkplcDvsOn5Pqp689yR7DACJ9FIimMNellck X-Received: by 2002:a63:8f0d:: with SMTP id n13-v6mr11545677pgd.109.1529331733977; Mon, 18 Jun 2018 07:22:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529331733; cv=none; d=google.com; s=arc-20160816; b=JslElHob04oMIfHu2ncrCUGQ2fAPeb2lC6m0hoGTXy/BkVGsiBOIQ3RUoP+nWbAtTN 99ggNNQpjrC/AL32tuxligNY1i7nanNFT+mf4pkOnlRYJVhQiotJqdjTb1hkFbzAh/Xo ss8Ctl2xW65AJxM3JyD5TqdEiVpBonvv6N5a0HSITknCJ0W6pXQA511dZ2WyuroC3NWu XTN6PgikzpS4emy0+H4cQLag+gJ8lnop6WaRKY1dX/Kza6bSTQUuBsc2uap34Od4mgBj KTOoEp8mMB3LdfVDo+n1OcRJl0w/WlaFAz41NrerzEOpa08WJX0ELD+yzOHg3iBDqxGG RxdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=tkmhL5dDZ5b8rXC2HyecI5p9wG8MtSmqp0pcjMZiwRQ=; b=YU3HWg2xe88flCwH/1uGIlRypeKLaK+rnSTU7SkjKB/ctvKAR91h34HgNDAlaPb/yO yPDyfbOgrxoYhok1uGG+v8oGf4e1beZOGlgsLeccx9lBAAf94bx2qguBo6xCc34VlFit VWcuUG+uNZHKLn1JyYnlFxVFQq95EaHaZCsd8VT8vEzAaiX6kKQpvK5ny8a637wovYwh YXhAFFP/IF/QXUWf1h5SzPexPiEGqilOC24Wx/ekoLU+cofvZSbOL1yR7XmtN0tQZVsz WWn/Mhmvl7qLJhCTHXuGUVGnJVhX0kXLNtOysbwnk5WS4ZlNf+dFQXKTzn7Iv5NLHU4F g5Eg== 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 y23-v6si15662241pli.354.2018.06.18.07.21.59; Mon, 18 Jun 2018 07:22:13 -0700 (PDT) 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 S934724AbeFROUC (ORCPT + 99 others); Mon, 18 Jun 2018 10:20:02 -0400 Received: from mout.kundenserver.de ([212.227.126.131]:52413 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934284AbeFROUB (ORCPT ); Mon, 18 Jun 2018 10:20:01 -0400 Received: from wuerfel.lan ([95.208.111.237]) by mrelayeu.kundenserver.de (mreue003 [212.227.15.129]) with ESMTPA (Nemesis) id 0LgKx6-1fyQJn1XkK-00njHZ; Mon, 18 Jun 2018 16:19:35 +0200 From: Arnd Bergmann To: Stefan Richter Cc: y2038@lists.linaro.org, Arnd Bergmann , Hector Martin , Mark Rutland , Ingo Molnar , "Paul E. McKenney" , linux1394-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org Subject: [PATCH] firewire: ohci: stop using get_seconds() for BUS_TIME Date: Mon, 18 Jun 2018 16:19:24 +0200 Message-Id: <20180618141933.3404739-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K1:fsiBvUI1XEghixXicUguhIpsjFL9E36Kf1V0WZCOVr9DFsr3mY8 PxvdZ6Z5oMxg7CB+tZwqyzoiMFP3UeANfigRh5n9mEWeown2di1kYOYpLWsszfZqXGwYxIX d2/QCq4ME4lPrUA3F9PlHUHpYc90ZPTd5hRfMSP0Z+Eh6r/U/2VdvBcI6xajzC7OoQKKt/i vsnOSptbPc3sciDqkdpfw== X-UI-Out-Filterresults: notjunk:1;V01:K0:DLJ/MaAMXIc=:CLSqRq4CtglwyyGHSEwFmW g93Nu3r4bCgvdJ7aZk12MG7j1ophzcVLNwxD58+KDKEmlPz0yBfKXgEE/f2yzoPhzrI0/P/3z x5gswKv5wfjDj2vKD4ZNzY62cbYX9LVLrz1h7cewqnKGL7RIDTZk2TvbuGWacdoNiF2BKk6Eu EudNs4YVpRo+HPCHSmO8goXPsrmizrNEWOyc5PrYNufaEH/cC2NqQDAGv3VhCZVLOlOqtRQqu 0JeePHrqMSvrg4iFHnSCHMiQh/RIrkpMB35X0xwdfnYegWORWw6Xl1KA836AsQ3ekqWsiURwv od6VcHC7qI3YvGWh5fLE9jbLiO3BEQ25CC3S8AoqakVOY8x0QnWl7E2G+ZbIl4N4soSJGZjH6 PFquNM6F+fTgtcAT8suiGiwks2xD7Fpg7lW9NgFBjYKEGhy5o+qdH3U1MbjsbGiya5BPZxIaZ 6qUb1OB4PB29fYxd89q7xHVCro90hIHo7tpAtGWO22FOzkaAENEICcZ4YbUC59gFEVZU2I7V4 ZiB1DH+ZJPBuCy6Z46Fgqec5fdietrQmUGfdwrSCeE430Xemd3mjtYBP471L/AATCi40n/+Qx vMnm2lI8nsNOyNQ6M961huRcoi4+susa3E3O4GHPGN4QJwOv4r97R9SjNi4x/3VwFWACxPKvt Xgxr2b2n/5Y1IdSW01eNRPe7teBy8V03RrrgoZCuVo5LYMYy5UAFWahjZLJ3uZqGIUg0= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The ohci driver uses the get_seconds() function to implement the 32-bit CSR_BUS_TIME register. This was added in 2010 commit a48777e03ad5 ("firewire: add CSR BUS_TIME support"). As get_seconds() returns a 32-bit value (on 32-bit architectures), it seems like a good fit for that register, but it is also deprecated because of the y2038/y2106 overflow problem, and should be replaced throughout the kernel with either ktime_get_real_seconds() or ktime_get_seconds(). I'm using the latter here, which uses monotonic time. This has the advantage of behaving better during concurrent settimeofday() updates or leap second adjustments and won't overflow a 32-bit integer, but the downside of using CLOCK_MONOTONIC instead of CLOCK_REALTIME is that the observed values are not related to external clocks. If we instead need UTC but can live with clock jumps or overflows, then we should use ktime_get_real_seconds() instead, retaining the existing behavior. Signed-off-by: Arnd Bergmann --- drivers/firewire/ohci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c index 45c048751f3b..5125841ea338 100644 --- a/drivers/firewire/ohci.c +++ b/drivers/firewire/ohci.c @@ -1765,7 +1765,7 @@ static u32 update_bus_time(struct fw_ohci *ohci) if (unlikely(!ohci->bus_time_running)) { reg_write(ohci, OHCI1394_IntMaskSet, OHCI1394_cycle64Seconds); - ohci->bus_time = (lower_32_bits(get_seconds()) & ~0x7f) | + ohci->bus_time = (lower_32_bits(ktime_get_seconds()) & ~0x7f) | (cycle_time_seconds & 0x40); ohci->bus_time_running = true; } -- 2.9.0