From patchwork Fri Apr 20 16:14:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 133910 Delivered-To: patch@linaro.org Received: by 10.46.66.142 with SMTP id h14csp464201ljf; Fri, 20 Apr 2018 09:15:39 -0700 (PDT) X-Google-Smtp-Source: AIpwx485exS6LaNBdMc9E9XYpGC4SCDJ0ULayUs16HhAmk9ybrutwppCFrcPqU+XvNfCCk6U9AGg X-Received: by 2002:a17:902:aa0b:: with SMTP id be11-v6mr11024914plb.179.1524240938894; Fri, 20 Apr 2018 09:15:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524240938; cv=none; d=google.com; s=arc-20160816; b=mD9y9dZV8eTMzhN0l8DdRU0VRzDqZFHJpeqGlotA6VsZOo9icyU3iDw39bhIvRGqsn 9RgPIgSywTGtziDkphSiM3NEKRbhtyHD5iAu22FDc1+RMbfdmlPsloZ7R5zwxszE/hmw vZfqRHWZybRintw7TpCAEH6GY0VFtZF1fX6C6DKRMbuMPbAFmYRyd2LHF34A/wVzlMB9 N2hkxd3q7Jj9fNmkyRtZ3H3yQqYxEGuEcQTeObbAhu0ogLNoqVg2RcoUoVIDWgGI92N2 ubZ+bkCC1R2VWfRl/X0E4BVJxTiGvL8ytTvAWd+UmcTF0GqICuUYIVGMOJnRO5/l6PBq Q6ag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=fFfIcCPPjK4SQYijRwKK/JLUi1zp8qgddjBIWDHpxzQ=; b=hkBox7syj06CWnUJFbJJf0RDLIDcLGXogypLYeolwWn9Uld9u3OzWry4YTtEcejUFH z9Q7Xs4u6lYfgXkhjVuDtTFzMOOG2IXQxgdOsgl1kGMt8ncfXrP9J9a2u8PdzPiUve5+ 4Mac11Y9EcycePSm6ujroX0gmXdSXZE62imGpa3l1h4sft5mWAPfsXomED26MEXJDz9P 5OKc4s0OmJZc4Hcw4/Hxl7hjtKuFKMsbm6pKdfv9+0FV1hSiKFOaCJSjgC0/w7BbL+5u sTBFyfpwmNLS66YcU0gjUpNf56vuOTTNKYj1h4UhT2d5mQ8PJnEMCkKmqhp712bcWSNj FPrw== 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 k185si5206374pgk.2.2018.04.20.09.15.38; Fri, 20 Apr 2018 09:15:38 -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 S1752731AbeDTQPh (ORCPT + 29 others); Fri, 20 Apr 2018 12:15:37 -0400 Received: from mout.kundenserver.de ([212.227.126.187]:52585 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751836AbeDTQO6 (ORCPT ); Fri, 20 Apr 2018 12:14:58 -0400 Received: from wuerfel.lan ([95.208.111.237]) by mrelayeu.kundenserver.de (mreue003 [212.227.15.129]) with ESMTPA (Nemesis) id 0MEJGG-1fBmf33Mb2-00FVyc; Fri, 20 Apr 2018 18:14:41 +0200 From: Arnd Bergmann To: Alessandro Zummo , Alexandre Belloni Cc: y2038@lists.linaro.org, Arnd Bergmann , linux-rtc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/3] rtc: ls1x: remove mktime usage Date: Fri, 20 Apr 2018 18:14:25 +0200 Message-Id: <20180420161433.3721192-2-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20180420161433.3721192-1-arnd@arndb.de> References: <20180420161433.3721192-1-arnd@arndb.de> X-Provags-ID: V03:K1:jLE80nIlTuHNBXQS5Q/kQoDTiwWNUWQEnwnlls4orHmeBQUKjjB N77cwiVuy6dsEhFiEXrwHIi9VkkjydOE/7GwGMuK5h7N27usXUdEy0mqvlyNW2cdBGbuhxO VczAqeW+ALJK3NgfG3vT/lV/akWejvHBZmQmu3QjroztusFbju0KENnqVEKqFKHBAeRBYkZ 05/1TJCNDmQjATPXoEREA== X-UI-Out-Filterresults: notjunk:1; V01:K0:4BCmzUPsy58=:umGPZc5w0R0G9gUX/EFSYp 5h/BwkQdvU83AX1DnPvFpsVD+t4tUuV2Y7eabH9Z5bchs/vfHkUI0gwcDofv5gKBmThHHAlCu W1wgGlfecIAz5/DR8oh5KLo9bfM4hQT4ZK4n29pY9PEIGXagZcpmhUEv6i3Ezzxl6rNFMcXfV fBnVtJhE5Y+PFNGwO+ckQPFO199/bde840s6qDVwPz7ncHlOUGJz8hiEIFjFJj4FXWbQk+l3q wR7wNvlt9Ph9EF3osXjD1OfOUHuTPM8DG3pNarzjdLRPzj5jrmmBaCHz3tBPJsOjns3bpb69s Zeh3gGWTH5sfXsz6o0x6JVXOoGd2dGy99HHx3itiTClxAHIrScdkqQdiBqfIjEU4bET1DeHqp oXgMME0xyr3cJiWV1E2nLvN7NjEXdalE1bUkvb7wyXwV/qI2Q2aTDP3hoVmVWgdpHfepvZnru hT0hs5PNx6rSnCNURlryRi8AEFwa+/AFbSZ77WvGwE4AbdDHF0jDT30AsAqSMWWB3QkiiPKeF KwumMcnOcJhfSauan7GIsnRz4LDBZYNZEHRCKYlYxHeWnYuR2OVdPU3DlRcVRf8tnVfau/lcb +7iHg8kxkWU9Mg/J2+YmswZloppSF9DK9wRMIXHUUoh0TIzqLmDz3mfIL7p66z/qlTvw1/bVO PJPkyRopIAvbcH0Qps7jkZjmUfJGJm0D8FCbaaKe72CzqjunvjEV3hSrWlw6Xz+jtJjjq2vjS 8jv1VoHmLfxQn/dTp4swoPYt9NiQG8PC9pBR+w== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The loongson1 platform is 32-bit, so storing a time value in 32 bits suffers from limited range. In this case it is likely to be correct until 2106, but it's better to avoid the limitation and just use the time64_t based mktime64() and rtc_time64_to_tm() interfaces. The hardware uses a 32-bit year number, and time64_t can cover that entire range. Signed-off-by: Arnd Bergmann --- drivers/rtc/rtc-ls1x.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) -- 2.9.0 diff --git a/drivers/rtc/rtc-ls1x.c b/drivers/rtc/rtc-ls1x.c index 045af1135e48..de86f9fabc11 100644 --- a/drivers/rtc/rtc-ls1x.c +++ b/drivers/rtc/rtc-ls1x.c @@ -87,16 +87,17 @@ static int ls1x_rtc_read_time(struct device *dev, struct rtc_time *rtm) { - unsigned long v, t; + unsigned long v; + time64_t t; v = readl(SYS_TOYREAD0); t = readl(SYS_TOYREAD1); memset(rtm, 0, sizeof(struct rtc_time)); - t = mktime((t & LS1X_YEAR_MASK), ls1x_get_month(v), + t = mktime64((t & LS1X_YEAR_MASK), ls1x_get_month(v), ls1x_get_day(v), ls1x_get_hour(v), ls1x_get_min(v), ls1x_get_sec(v)); - rtc_time_to_tm(t, rtm); + rtc_time64_to_tm(t, rtm); return 0; }