From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933320AbbI3L1L (ORCPT ); Wed, 30 Sep 2015 07:27:11 -0400 Received: from mout.kundenserver.de ([212.227.126.187]:64318 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932661AbbI3L1D (ORCPT ); Wed, 30 Sep 2015 07:27:03 -0400 From: Arnd Bergmann To: netdev@vger.kernel.org Cc: y2038@lists.linaro.org, linux-kernel@vger.kernel.org, "David S. Miller" , Arnd Bergmann , Richard Cochran , Fugang Duan , Luwei Zhou , Frank Li Subject: [PATCH 01/12] net: fec: avoid timespec use Date: Wed, 30 Sep 2015 13:26:31 +0200 Message-Id: <1443612402-3000775-2-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 2.1.0.rc2 In-Reply-To: <1443612402-3000775-1-git-send-email-arnd@arndb.de> References: <1443612402-3000775-1-git-send-email-arnd@arndb.de> X-Provags-ID: V03:K0:S2X8bm2aN9fI6YfNcSvbjdV77Pms82FJBmSQI/HBZdCb50wYzMM TPy3XxFDfe17NFx9JvbMn0j3zAGNFEZp54zhJt8aFxre3Uw3xGGI4luywlm22ROQ4IQdcme mpE/yE1s/5x6Lfw/xdlvyEF1Pubt/IakI/H7xOyDT96elTWJgOs1W/EoTt3NCrc4uhERf1a HgzXrVsS5M4PDzx8TFLJQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:kTBmW8t+lps=:ukfQA2jUalcDgC1jZsOvS7 JeQ9OePs7O75xt8mvMdM1FF27vQ6EXYyLD8ZgKwdR1ved8lWO6bQVFHx0mswzrTYWn0pgPOow 90eYhZvjEVh+O3P0ab+j4S92hXPqliHnwf8T2jdry/NaBUlnkjc3zODrrhqd+DTziP35fMjdj YLm8k/9q0Gk/ZSOMG5hQSRQBBEEp52SgTcWx8lJctW04FIRU4tXPP2AQfUEVwD8Sy28gQ8eDL UCYKCRDlP1zHqTioQgq3MIZz77VBP26qdTgh275RMUrdgc/wYsL9Za9cgYJd+Gx3woHJ1BnB9 ws8NHyLicgJiTgE/A9Fkk0JffUzt2X669fGdoj5OUgV75jxCBnYeqj2NxdwWvB3FVg5sxT+wj Ra2tESpE7yd7fqyrHLYWu0fVY604Gkbi4ruJ8brRE5VklywuVDOMcHhGKHnonh/voN+WDyoDs lZ9oBri6tfkav+a1LzvQHeXUp3+APmU7Br3p3SWRY7So7N5Eqhj0RfEzHiGiSLn/GZc+yfYAO tcf+XtrdKsQ+uD1QQSI/T2t5hFTVSNxuRwLerMBafDekBt8zNMdlorDt44qfkX4Ch809hqitv nUEDqeW0+Y/CrDtdbQqDS0tK7PB0WhZofvd0Dr2L0aJZCrp7ngSOhPvYFPzasHjU3O0VEBXn9 bA5seKFDK5HAmSvJeYI+GuVZcVzwf9bXHOMKGzwBdlhftRxrCzoXib4CtE8Wov1dcLpo= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The fec_ptp_enable_pps uses an open-coded implementation of ns_to_timespec, which will be removed eventually as it is not y2038-safe on 32-bit architectures. Two more instances of the same code in this file were already converted to use the safe ns_to_timespec64 in commit 6630514fcee ("ptp: fec: use helpers for converting ns to timespec"), this changes the last one as well. The seconds portion here is actually unused and we could just remove the timespec variable, but using ns_to_timespec64 can still be better as the implementation can be hand-optimized in the future. Signed-off-by: Arnd Bergmann Cc: Richard Cochran Cc: Fugang Duan Cc: Luwei Zhou Cc: Frank Li --- drivers/net/ethernet/freescale/fec_ptp.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/freescale/fec_ptp.c b/drivers/net/ethernet/freescale/fec_ptp.c index 1543cf0e8ef6..f9e74461bdc0 100644 --- a/drivers/net/ethernet/freescale/fec_ptp.c +++ b/drivers/net/ethernet/freescale/fec_ptp.c @@ -112,9 +112,8 @@ static int fec_ptp_enable_pps(struct fec_enet_private *fep, uint enable) unsigned long flags; u32 val, tempval; int inc; - struct timespec ts; + struct timespec64 ts; u64 ns; - u32 remainder; val = 0; if (!(fep->hwts_tx_en || fep->hwts_rx_en)) { @@ -163,8 +162,7 @@ static int fec_ptp_enable_pps(struct fec_enet_private *fep, uint enable) tempval = readl(fep->hwp + FEC_ATIME); /* Convert the ptp local counter to 1588 timestamp */ ns = timecounter_cyc2time(&fep->tc, tempval); - ts.tv_sec = div_u64_rem(ns, 1000000000ULL, &remainder); - ts.tv_nsec = remainder; + ts = ns_to_timespec64(ns); /* The tempval is less than 3 seconds, and so val is less than * 4 seconds. No overflow for 32bit calculation. -- 2.1.0.rc2