From patchwork Sat Jan 24 01:43:58 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 43715 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f199.google.com (mail-lb0-f199.google.com [209.85.217.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 9CF60218DB for ; Sat, 24 Jan 2015 01:44:29 +0000 (UTC) Received: by mail-lb0-f199.google.com with SMTP id f15sf259600lbj.2 for ; Fri, 23 Jan 2015 17:44:28 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=F2sj+TkL+2HwprirNDQYaISr/euNkxOjQVbj5ZOCa5w=; b=R6VXA2YxK6DaIvfLVyFHtBPseMlw934yOLDn20cc5RBjlWHjHUKAgHWM9bDbqgjr+o UjUdEvQkppwIldAqQ4rpY8nAU/v3u6eMRwdCVYxeutP/sImzfLkTZJ6QsT6QaQjcrJBr H2Hy9wZLjDcMbMcyTVp9rACP8xER4zB9VSurhd4t/CN40FDd4EAV1a5UX8yQooN/ybE4 9ypiZnXlv4kjEnZ+ziePrFG6FxhhGcPm599bFq4n6ZG37629s5cQuwz0zL6xrF9bRzku 3C9IL6dUVHzkiXRD1Z99gl6TSNvuu6pe3NESxfSIZtKcZS+MrxqVWsqEi5PZLVsnSFZN 0WHg== X-Gm-Message-State: ALoCoQlOtNr4yim9hcoSFoiq5Xdeqen2l6pDIk9XAG7OJB8pmPawXURchBbVvvirneZAd/J/HV6k X-Received: by 10.112.89.36 with SMTP id bl4mr1347690lbb.1.1422063868584; Fri, 23 Jan 2015 17:44:28 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.239.165 with SMTP id vt5ls300651lac.0.gmail; Fri, 23 Jan 2015 17:44:28 -0800 (PST) X-Received: by 10.152.203.201 with SMTP id ks9mr10117036lac.57.1422063868272; Fri, 23 Jan 2015 17:44:28 -0800 (PST) Received: from mail-lb0-f175.google.com (mail-lb0-f175.google.com. [209.85.217.175]) by mx.google.com with ESMTPS id v4si2585285lav.14.2015.01.23.17.44.28 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 23 Jan 2015 17:44:28 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.175 as permitted sender) client-ip=209.85.217.175; Received: by mail-lb0-f175.google.com with SMTP id 10so474826lbg.6 for ; Fri, 23 Jan 2015 17:44:28 -0800 (PST) X-Received: by 10.152.20.169 with SMTP id o9mr503823lae.50.1422063868112; Fri, 23 Jan 2015 17:44:28 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.112.35.133 with SMTP id h5csp90286lbj; Fri, 23 Jan 2015 17:44:27 -0800 (PST) X-Received: by 10.66.65.169 with SMTP id y9mr16092920pas.105.1422063859520; Fri, 23 Jan 2015 17:44:19 -0800 (PST) Received: from mail-pa0-f50.google.com (mail-pa0-f50.google.com. [209.85.220.50]) by mx.google.com with ESMTPS id n7si3777860pdj.247.2015.01.23.17.44.18 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 23 Jan 2015 17:44:19 -0800 (PST) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.50 as permitted sender) client-ip=209.85.220.50; Received: by mail-pa0-f50.google.com with SMTP id rd3so469909pab.9 for ; Fri, 23 Jan 2015 17:44:18 -0800 (PST) X-Received: by 10.67.15.137 with SMTP id fo9mr16245464pad.154.1422063858598; Fri, 23 Jan 2015 17:44:18 -0800 (PST) Received: from localhost.localdomain (c-67-170-153-23.hsd1.or.comcast.net. [67.170.153.23]) by mx.google.com with ESMTPSA id ci17sm3111170pdb.70.2015.01.23.17.44.17 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 23 Jan 2015 17:44:17 -0800 (PST) From: John Stultz To: lkml Cc: Xunlei Pang , Arnd Bergmann , Thomas Gleixner , Ingo Molnar , John Stultz Subject: [PATCH 6/8] rtc: Modify rtc_hctosys() to address y2038 issues Date: Fri, 23 Jan 2015 17:43:58 -0800 Message-Id: <1422063840-2837-7-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1422063840-2837-1-git-send-email-john.stultz@linaro.org> References: <1422063840-2837-1-git-send-email-john.stultz@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: john.stultz@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.175 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Xunlei Pang rtc_hctosys() has a number of y2038 issues. This patch resolves them by: - Replace rtc_tm_to_time() with y2038-safe rtc_tm_to_time64() - Replace do_settimeofday() with y2038-safe do_settimeofday64() After this patch, it should not have any remaining y2038 issues. Cc: pang.xunlei Cc: Arnd Bergmann Cc: Thomas Gleixner Cc: Ingo Molnar Signed-off-by: Xunlei Pang Signed-off-by: John Stultz --- drivers/rtc/hctosys.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/rtc/hctosys.c b/drivers/rtc/hctosys.c index 4aa60d7..2153b52 100644 --- a/drivers/rtc/hctosys.c +++ b/drivers/rtc/hctosys.c @@ -26,7 +26,7 @@ static int __init rtc_hctosys(void) { int err = -ENODEV; struct rtc_time tm; - struct timespec tv = { + struct timespec64 tv64 = { .tv_nsec = NSEC_PER_SEC >> 1, }; struct rtc_device *rtc = rtc_class_open(CONFIG_RTC_HCTOSYS_DEVICE); @@ -52,16 +52,16 @@ static int __init rtc_hctosys(void) goto err_invalid; } - rtc_tm_to_time(&tm, &tv.tv_sec); + tv64.tv_sec = rtc_tm_to_time64(&tm); - err = do_settimeofday(&tv); + err = do_settimeofday64(&tv64); dev_info(rtc->dev.parent, "setting system clock to " - "%d-%02d-%02d %02d:%02d:%02d UTC (%u)\n", + "%d-%02d-%02d %02d:%02d:%02d UTC (%lld)\n", tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec, - (unsigned int) tv.tv_sec); + (long long) tv64.tv_sec); err_invalid: err_read: