From patchwork Wed Jul 11 12:49:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 141737 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp248071ljj; Wed, 11 Jul 2018 05:50:02 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfm/SW5qBACy8jF+Oa72BZmxOM4thDrJ2cWgWyk7nui1lZGbQUYd0jd71SOgt+7hQjs8RON X-Received: by 2002:a63:af14:: with SMTP id w20-v6mr21284076pge.47.1531313402346; Wed, 11 Jul 2018 05:50:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531313402; cv=none; d=google.com; s=arc-20160816; b=HNiNE2ktM/3fkoiKtHcx+iNDGguKTHes7ZPB1ZuvqBLp95xfCRjz96iwDQlX8346aG RjtdCV2OrInxcgoQG/fjc8hg7/G/OJcxkYAwCyjaoiWxSfk9qC0luc2J94zrJ22H16tz UcbZiFHtmu0JB5WyqKZRrckkv4RJpPiQaYqOjBepuo6o8aCSJpMrscVV9OiZzCfQtSOu d+VGOAslbEmItE2NmGKlkT9AD3CCD76g5JOQ9uXEzLQ+3U/Bonv1nPKmKodJ4cpJKUfd 0OJNjbAgkB7LdlWyQ/ay3fs29Ds07uILd1Q6781JILf4+X+7FMXgAIZna69uXI6Utw7a mjrA== 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 e85-v6si20651068pfl.132.2018.07.11.05.50.02; Wed, 11 Jul 2018 05:50:02 -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 S1732788AbeGKMyK (ORCPT + 23 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(-) -- 2.9.0 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; }