From patchwork Sat Jan 24 01:44:00 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 43717 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id BD148218DB for ; Sat, 24 Jan 2015 01:44:36 +0000 (UTC) Received: by mail-wi0-f200.google.com with SMTP id fb4sf255084wid.3 for ; Fri, 23 Jan 2015 17:44:36 -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=nUPmAY/oYlTAIloPBYa8wxJV4IBOwWRFN35yPd1zDnI=; b=kZri/Yiex3iHIAwwyzW7YFIqeaOpsIG9c69YZ77080sUzGeuFDWsw1F3nhVwlAVMuR rbqOhhul6kRYGl3/qD2tkkb2kEVLx1gUntJsUPK+sthzIGsuJyq9884eZ9Wss7f5NCwi V4z4Ozj2cXooy/a3j17QG/zxseCnFglF/1zUnXGIgAAabTH7RSgEJCikerfOhLfJAimM YAfowrAs/HxdN2GX+Haa798I5TFiADPzpECB783IBxdmMMEoWdxFa+5yuIP9vxEhChHJ dexuLrgOadhKtH2fqCV5PWQVhQKzEcCDlhxSMIvrI+d2ujC3kBsmlM446d26Z9yqxVOd tSEg== X-Gm-Message-State: ALoCoQkT3ZSpJoGrwd+AcQrMhKNdpHRdpehuH0lKDOHlDuOIIyEX7At4T4ogk9FpC7YwtUs0SYEg X-Received: by 10.112.84.226 with SMTP id c2mr1341388lbz.5.1422063876011; Fri, 23 Jan 2015 17:44:36 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.19.73 with SMTP id c9ls353274lae.74.gmail; Fri, 23 Jan 2015 17:44:35 -0800 (PST) X-Received: by 10.112.151.4 with SMTP id um4mr10538650lbb.50.1422063875868; Fri, 23 Jan 2015 17:44:35 -0800 (PST) Received: from mail-la0-f42.google.com (mail-la0-f42.google.com. [209.85.215.42]) by mx.google.com with ESMTPS id we6si2892498lbb.1.2015.01.23.17.44.35 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 23 Jan 2015 17:44:35 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.42 as permitted sender) client-ip=209.85.215.42; Received: by mail-la0-f42.google.com with SMTP id ms9so502970lab.1 for ; Fri, 23 Jan 2015 17:44:35 -0800 (PST) X-Received: by 10.152.44.228 with SMTP id h4mr9267676lam.31.1422063875776; Fri, 23 Jan 2015 17:44:35 -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 h5csp90313lbj; Fri, 23 Jan 2015 17:44:34 -0800 (PST) X-Received: by 10.68.242.163 with SMTP id wr3mr13741956pbc.159.1422063862474; Fri, 23 Jan 2015 17:44:22 -0800 (PST) Received: from mail-pd0-f182.google.com (mail-pd0-f182.google.com. [209.85.192.182]) by mx.google.com with ESMTPS id wm4si3910574pbc.131.2015.01.23.17.44.21 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 23 Jan 2015 17:44:22 -0800 (PST) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.192.182 as permitted sender) client-ip=209.85.192.182; Received: by mail-pd0-f182.google.com with SMTP id z10so964370pdj.13 for ; Fri, 23 Jan 2015 17:44:21 -0800 (PST) X-Received: by 10.67.7.131 with SMTP id dc3mr15544521pad.97.1422063861525; Fri, 23 Jan 2015 17:44:21 -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.20 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 23 Jan 2015 17:44:20 -0800 (PST) From: John Stultz To: lkml Cc: Xunlei Pang , Arnd Bergmann , Thomas Gleixner , Ingo Molnar , John Stultz Subject: [PATCH 8/8] rtc: Convert rtc_set_ntp_time() to use timespec64 Date: Fri, 23 Jan 2015 17:44:00 -0800 Message-Id: <1422063840-2837-9-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.215.42 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_set_ntp_time() uses timespec which is y2038-unsafe, so modify to use timespec64 which is y2038-safe, then replace rtc_time_to_tm() with rtc_time64_to_tm(). Also adjust all its call sites(only NTP uses it) accordingly. Cc: pang.xunlei Cc: Arnd Bergmann Cc: Thomas Gleixner Cc: Ingo Molnar Signed-off-by: Xunlei Pang Signed-off-by: John Stultz --- drivers/rtc/systohc.c | 6 +++--- include/linux/rtc.h | 2 +- kernel/time/ntp.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/rtc/systohc.c b/drivers/rtc/systohc.c index bf3e242..eb71872 100644 --- a/drivers/rtc/systohc.c +++ b/drivers/rtc/systohc.c @@ -20,16 +20,16 @@ * * If temporary failure is indicated the caller should try again 'soon' */ -int rtc_set_ntp_time(struct timespec now) +int rtc_set_ntp_time(struct timespec64 now) { struct rtc_device *rtc; struct rtc_time tm; int err = -ENODEV; if (now.tv_nsec < (NSEC_PER_SEC >> 1)) - rtc_time_to_tm(now.tv_sec, &tm); + rtc_time64_to_tm(now.tv_sec, &tm); else - rtc_time_to_tm(now.tv_sec + 1, &tm); + rtc_time64_to_tm(now.tv_sec + 1, &tm); rtc = rtc_class_open(CONFIG_RTC_HCTOSYS_DEVICE); if (rtc) { diff --git a/include/linux/rtc.h b/include/linux/rtc.h index 6d6be09..dcad7ee 100644 --- a/include/linux/rtc.h +++ b/include/linux/rtc.h @@ -161,7 +161,7 @@ extern void devm_rtc_device_unregister(struct device *dev, extern int rtc_read_time(struct rtc_device *rtc, struct rtc_time *tm); extern int rtc_set_time(struct rtc_device *rtc, struct rtc_time *tm); extern int rtc_set_mmss(struct rtc_device *rtc, unsigned long secs); -extern int rtc_set_ntp_time(struct timespec now); +extern int rtc_set_ntp_time(struct timespec64 now); int __rtc_read_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm); extern int rtc_read_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alrm); diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c index 87a346f..183dfe2 100644 --- a/kernel/time/ntp.c +++ b/kernel/time/ntp.c @@ -488,13 +488,13 @@ static void sync_cmos_clock(struct work_struct *work) getnstimeofday64(&now); if (abs(now.tv_nsec - (NSEC_PER_SEC / 2)) <= tick_nsec * 5) { - struct timespec adjust = timespec64_to_timespec(now); + struct timespec64 adjust = now; fail = -ENODEV; if (persistent_clock_is_local) adjust.tv_sec -= (sys_tz.tz_minuteswest * 60); #ifdef CONFIG_GENERIC_CMOS_UPDATE - fail = update_persistent_clock(adjust); + fail = update_persistent_clock(timespec64_to_timespec(adjust)); #endif #ifdef CONFIG_RTC_SYSTOHC if (fail == -ENODEV)