Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp3074758ybx; Fri, 8 Nov 2019 13:39:29 -0800 (PST) X-Google-Smtp-Source: APXvYqyproiqdOiW48VugrE4jgeeqvKs1eJ9EW+gbVfKVyiSFkHX8ZSnqTycd98FK4LWiRe3AOck X-Received: by 2002:a50:950a:: with SMTP id u10mr13110980eda.68.1573249169563; Fri, 08 Nov 2019 13:39:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573249169; cv=none; d=google.com; s=arc-20160816; b=putS7zI1xlJpRNx9WVZMRlMK9kcf/3VJv3WrEQh+zzuzMnG9K57acR2RFjauOnuS65 qtojGvAL0YyR9/h0jzdk1tvGvQiqNI+IZsUJDF57PwmRqa0e2OOHN++Fn2yKgcYy+1Rj pPCW3YBlba1gIclhY+7LTghwutkYQkzn+B32nvytnHJiAKT3bAhvVB0wqEz/D6mmjb2Y +QvYD7VC70VDcdkfDdgImlDShqGiMR1+CRjRBqB5YFLfXzAdM+nLK3WCQhskkWIFAif0 ngZpJRNpVxPIsybfiLD38MT0zOqh/NEz1OjNi5o9onCdjCo+uKgYxasEMfH8+vuoKMQ0 sVDw== 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=lpdQWKdDrOPtx3R/NC5nwe7J1uH5+RbEM2cIVGKt/So=; b=uBwVZwWIrE0+mi2SqzL9ChEmerd0obE3Rx57Ryk5vkFBMlkYjAM3mNK497IxXgGSlg 7QcEnFrB8pwytNJ1x3PCv0DO/pZeY1yfTpubjtVNbrdxnwhKZ42bk0R4QokLBBHhvTuu Mp/C9ZLQPihHd0MabcpnOVS80Uqs0JY7qGuQcwqiboVe6EZtxc+K5YJmhWpY92HllcXl kSEyptnpSY2zUc+J38PkZUsa+5EYeVZSVsj0zodLlPNgGHqdmgZ+U2nrvMgubhkOcL6e EzDC+nXtCJ/K4I2yut97b/TRoZijVaP++QmknZ+M76lkjL9N+ssyZRMvX8RehiIsXUxQ AEzg== 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 f45si5222466ede.381.2019.11.08.13.39.06; Fri, 08 Nov 2019 13:39:29 -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 S2388503AbfKHVi3 (ORCPT + 99 others); Fri, 8 Nov 2019 16:38:29 -0500 Received: from mout.kundenserver.de ([212.227.126.187]:43755 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388444AbfKHVi3 (ORCPT ); Fri, 8 Nov 2019 16:38:29 -0500 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.129]) with ESMTPA (Nemesis) id 1N0WwO-1hfVjv2o8i-00wTtI; Fri, 08 Nov 2019 22:37:59 +0100 From: Arnd Bergmann To: y2038@lists.linaro.org, Stefan Richter Cc: linux-kernel@vger.kernel.org, Arnd Bergmann , Clemens Ladisch , Thomas Gleixner , Will Deacon , Greg Kroah-Hartman , Richard Fontana , linux1394-devel@lists.sourceforge.net Subject: [PATCH 16/16] firewire: ohci: stop using get_seconds() for BUS_TIME Date: Fri, 8 Nov 2019 22:32:54 +0100 Message-Id: <20191108213257.3097633-17-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191108213257.3097633-1-arnd@arndb.de> References: <20191108213257.3097633-1-arnd@arndb.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K1:ShTMGp4lVNVsHj+KLbB1IsdO5sH5jn0FUtExiYeIktC9NBhPH68 Eo6Di/s4x1/c0s0lLRtXEL3+pUqH2jXe+lTpS1u0fj9Wj5g2hSZfutPCDmz9vVx1gkCHN+t lGkblZXmLSCwyqit9GXFDVWTAAGNnFLncfw6TYZEMKhOitqIsxr/7PMTbimFz3Ksb8vTWOR lcjupetSVcK3O/vCeAMtQ== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:leyoQLNXbQg=:XqNTH//TUd2wRfId2+/xfy eQ+WZQp1hTDWEnjaAb3rr/ypuDM/uWEbbd+ht2cL4NNSBam+Merhk3GCl8f9Na4vCuujDmXp8 dTjKewx5lcZM1j2vniPAnG5tRQtmf4DXuVdbRTg/AJW7r2nGu5oaik/cj+FLrQALbLu5W3S2g gn9HXG8FzCIFPb/yCthoolqyFw1m2CxJZI9yWZgM2EqbmeJkf1nAHcVCMqKOF6TCy1SC0r0pV YnTSdvXiIpNhzoHR2kfebW4bI7Jj+aN39JoSq370yilI8ABf3QPD/FULOrAElxyBBCVnigEUv qCDQH5Lo1X/AMa0go2UF08ZtuZ3WfXhE9/ULxTNV6KqnBU6W+jSU1tyAJtszmDnwmNIi6v8si jSBExJE9oZ5quHrJTc9DZ577cTb/GNuAJUDmoAub3HEkdJ2KxO5YZI0PUcsG22ysKX/+U0i6C 0meZYkHhON7G/I6cH0I6NivXIWpO7MNRerECpI5I5D4h5NGqscYeORHflrzpCI25c9GxtLPQJ JgpoygF3V4/4nBEOZTUOYfpCRWcaWMe+ZyAt/gYF5GRy5WAU3VETV85RWCDjhPLFKp2LvhP8I BZDS6CJDy7h1TOWLwOBMIGvM5bLAayvlR1dex0YsaPLpEh1b22ozGKQF8+DrZy42ok1EDxLpJ SJhNU7KVWt3RglSABWD8Pc98EBImv87rsCwacFTUKL806Y2GIsiTq/6DqDKWKsih4BhsCtQax TV2lC6jZ38zsEPk/ETTxzKlYrkyogQt7gehGY9ObecJ2WRR+9e6JIM0XpYWBTEeXkZLIY2mLc Kn/cN2Ga7qkgoMkPqDxRkgz/aavM11Cuw+uzN2F84JYcYiOLXxXTBZLQ5pqciOre7GWcnWYXf 8sV8mV4nOIfQV8FMpaVQ== 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 Cc: Stefan Richter Link: https://lore.kernel.org/lkml/20180711124923.1205200-1-arnd@arndb.de/ 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 522f3addb5bd..33269316f111 100644 --- a/drivers/firewire/ohci.c +++ b/drivers/firewire/ohci.c @@ -1752,7 +1752,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.20.0