Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp653251imm; Wed, 11 Jul 2018 08:43:27 -0700 (PDT) X-Google-Smtp-Source: AAOMgpd96rAWqdmOe6VnQOhlSKd4MJpnCAwXb0LtXHotrnk1266+grA3H0+WR7kBkStNnLWYb7mm X-Received: by 2002:a17:902:9693:: with SMTP id n19-v6mr29464976plp.212.1531323807509; Wed, 11 Jul 2018 08:43:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531323807; cv=none; d=google.com; s=arc-20160816; b=ZBB9i2BtshJ2YfWMLKacOrPuM3MQvGhw14g76X+9lSX8Zk7s5iQP0JRLFEGmHUw1oB anzinyiDsbRKyvjcRgCMMZccnGCIFN+APjRkgknItyldeZAap0KQT3QQ4d4ji+HzP1tc FzSzKCGf7nJ+hMSWE/pHsnmy8ZxbZOKF7w0MbFQc9Nh8qIyYNsCYNfdcfyk4H2lz5UZu BP+XoTO80BcPFZ/u55E/SEUsQG92m1OeCmlitL3hFeUrPNQbCt97losv5o1uuoYcV0Xy WvydndM/hFyi8R0lDuAY89nEOc7FJJJtIjkWmeLngFtc6iga1CjGOkN0RJSt4eHKMjtb vfxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:message-id:date:subject:cc:from :arc-authentication-results; bh=qzd/8feRraI7yJwVPxASdWTvSs+ZPyWwvewvPmVr+eM=; b=sIzuX5I/V0jnRuW5U+aSntmrlgP1ugXlj+/jKq2fC+rot2BxJ6heKhLsrj0CeccYP8 ORp6wtp/33jXC20bAjyiJdK45YfdMVZNs23QoalJaT3OqfM64jjyGEeI2pdYqEGEhS5+ pScfpReIw4BtYbM4a4tBJH17ry8NLepUB3tWS2qXrnD8gSNEZt61DvXZVH3GPj7kZWXw G0/9V2mgXFNccgAmrwuyJF2ddVs2StItj9sZPqJsNsHZHkTa0A/TXhNjeRYSoGOx5hFU AHO7o2d5PmTNWbvBMkkBGv8db7beeyqWiWQau/A/ajXVnesrFY80FHCsun0I1gOK4/cq GhcQ== 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 c197-v6si21834299pfc.74.2018.07.11.08.43.12; Wed, 11 Jul 2018 08:43:27 -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 S1732783AbeGKMyK (ORCPT + 99 others); Wed, 11 Jul 2018 08:54:10 -0400 Received: from mout.kundenserver.de ([212.227.126.134]:41174 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726457AbeGKMyK (ORCPT ); Wed, 11 Jul 2018 08:54:10 -0400 Received: from wuerfel.lan ([46.223.138.35]) by mrelayeu.kundenserver.de (mreue002 [212.227.15.129]) with ESMTPA (Nemesis) id 0MTsu0-1fUKaj0gBE-00QPZ7; Wed, 11 Jul 2018 14:49:25 +0200 From: Arnd Bergmann Cc: y2038@lists.linaro.org, Arnd Bergmann , Stefan Richter , Clemens Ladisch , Ingo Molnar , "Paul E. McKenney" , Mark Rutland , Hector Martin , linux1394-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org Subject: [PATCH] [RESEND] firewire: ohci: stop using get_seconds() for BUS_TIME Date: Wed, 11 Jul 2018 14:49:10 +0200 Message-Id: <20180711124923.1205200-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K1:rBQAoJaU0sb9gNo8i2dT0AukZ5wIMycUjk9nycNiWQZPIXYlDNc Mor81/qGfSGB5TjcwAELw+QHsC5NVpdEv2kEZLlQqSQfu4PZnFak5AhYiQgCK+0iwQJSmUg JKlQ3qN1nqOnkJmkAK/z4FQmkkzN863TcDz7CRxbNemWkXR/9/2fcJtSlmGr2C/w+hQeAzj 8cbZmNHKQVK7npaBhN46Q== X-UI-Out-Filterresults: notjunk:1;V01:K0:2N3j8uCFws0=:o+PtsId4bvINMfnlkJ23v7 xcJ4XZfml57zMhiX18yPxGWaoucmFqoIWGQ79jIyk95gXdoXmD8sD7ogH4K4V5cIT3hNMl1/M HbvE7Dl8lGbVEO3O92ZDoJBUbcM42ebaiNYyMbSlsNBh3Hu2puhkD+TKsFHPLMq94okOLgLYH o5x73WASkJhV3sQftqaTFlAeGD+IoE1asxP3Olrf+5aqQmVJ7HAO7e0FBqAziMY14udvyVtD1 nP8JB9SKtxdBO/SQHoF8p0CSAVL31IZ0+5xQwtv74p2QY/0CuYXcT9P7mjO5l8z1Q6jcBnVMT o6xsg7CyPqcK2h6QLenj5HbKkAAXijSSdBsNUqyNt9s75bIA+XosndEUyCGRQviTz3fmf00OS Uw9RKiTaVIhHg0j64Fc0rQgyjrMi5SsBzzYNMM0J3ruwvaVW7J7qRaZyH1jnSo8y/gFYHoK7e 23gqsWqC/HN4yP0X/CraTbpk12TgXdKg2fWXwDD5jH0+wCDoeY7k8o4jlkTtLq95h53zDJFal 8ZkKaL+AD10QUKhHKH63nz/xkrJ8wuw998LzzY8oAKlXT7fCeNwe/5ZGHsISAffXN4qHb3cs+ i/1R899f6buFsiz6E3e/u/KJ7r8tbb3HV/w2lJYZRVE6CI8hTY0IZnfnNTWVsXlqI7SH58d+J KOx4N4FS1cYR7hfNmUYt2oMr0eZt96TfrGAahtrVzRMl6rbP/sb4C7OHP2trf25+Rlw8= To: unlisted-recipients:; (no To-header on input) 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. Reviewed-by: Clemens Ladisch Signed-off-by: Arnd Bergmann --- I notice that Stefan Richter has not been active on the mailing lists since February 2018. Andrew, could you pick it up in the meantime? --- 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