From patchwork Thu Jan 22 02:31:55 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "pang.xunlei" X-Patchwork-Id: 43486 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f70.google.com (mail-wg0-f70.google.com [74.125.82.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 59435240D5 for ; Thu, 22 Jan 2015 02:33:31 +0000 (UTC) Received: by mail-wg0-f70.google.com with SMTP id b13sf5276133wgh.1 for ; Wed, 21 Jan 2015 18:33:30 -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:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=vfIX7LdooAfnnW557qi3uGuTvwEK4oXrqZwEu60l2Es=; b=IAZsQoF7aEDVKo77HmzgPc1h+SV6mZZORYv4NTbA+scsT7MF0d6q0OuVRVOOCkJgZf Y/gEViSJjf2OBUI8ft9jt2J5IkF6dLDdVvW9oK+NsBt6xjzH13qs0djSW2xsPAi4Gd8F LCF+sSpSdTspocgVBqkEmuiIGLjPXMZ1uY5tJydYewhveAiFyEGoFGrXLHIaAQr46V2B PxUlxXA1SgCjPB2UTDyiF6mma91hgxLyOn7vJbDhA4LMn5Yw/z1StFN6rVQRPpvH17YD 5Py5GMutTGzuZpZSOBceYsRpq9Kj1ZilQkFTQEN0zPpxtBlQssUHnpbAcvKsIuValFGf cw9Q== X-Gm-Message-State: ALoCoQlzzthNiSTV00Ny4FIxilKlUc/9igXeK78hcHf4WjiLKWgTV9/ouGZPyN2tZUOUIXH0JGbr X-Received: by 10.194.77.1 with SMTP id o1mr5561599wjw.1.1421894010602; Wed, 21 Jan 2015 18:33:30 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.191.140 with SMTP id gy12ls109438lac.93.gmail; Wed, 21 Jan 2015 18:33:30 -0800 (PST) X-Received: by 10.112.129.228 with SMTP id nz4mr47141512lbb.8.1421894010387; Wed, 21 Jan 2015 18:33:30 -0800 (PST) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com. [209.85.217.182]) by mx.google.com with ESMTPS id sg5si19556520lbb.19.2015.01.21.18.33.30 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 21 Jan 2015 18:33:30 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.182 as permitted sender) client-ip=209.85.217.182; Received: by mail-lb0-f182.google.com with SMTP id l4so17120013lbv.13 for ; Wed, 21 Jan 2015 18:33:30 -0800 (PST) X-Received: by 10.112.90.170 with SMTP id bx10mr47497731lbb.69.1421894010187; Wed, 21 Jan 2015 18:33:30 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.9.200 with SMTP id c8csp110104lbb; Wed, 21 Jan 2015 18:33:29 -0800 (PST) X-Received: by 10.66.224.199 with SMTP id re7mr1419952pac.65.1421894008329; Wed, 21 Jan 2015 18:33:28 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o4si4073925pdg.219.2015.01.21.18.33.27; Wed, 21 Jan 2015 18:33:28 -0800 (PST) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754649AbbAVCdW (ORCPT + 28 others); Wed, 21 Jan 2015 21:33:22 -0500 Received: from mail-qc0-f181.google.com ([209.85.216.181]:55866 "EHLO mail-qc0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754376AbbAVCcJ (ORCPT ); Wed, 21 Jan 2015 21:32:09 -0500 Received: by mail-qc0-f181.google.com with SMTP id l6so30680731qcy.12 for ; Wed, 21 Jan 2015 18:32:08 -0800 (PST) X-Received: by 10.229.174.70 with SMTP id s6mr74013928qcz.7.1421893928636; Wed, 21 Jan 2015 18:32:08 -0800 (PST) Received: from ip-10-181-65-231.ec2.internal ([54.235.93.228]) by mx.google.com with ESMTPSA id w9sm5174891qab.18.2015.01.21.18.32.08 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 21 Jan 2015 18:32:08 -0800 (PST) From: Xunlei Pang To: linux-kernel@vger.kernel.org Cc: rtc-linux@googlegroups.com, Thomas Gleixner , Alessandro Zummo , John Stultz , Arnd Bergmann , Xunlei Pang Subject: [PATCH 5/5] rtc: Convert rtc_set_ntp_time() to use timespec64 Date: Thu, 22 Jan 2015 02:31:55 +0000 Message-Id: <1421893915-19309-5-git-send-email-pang.xunlei@linaro.org> X-Mailer: git-send-email 2.2.1 In-Reply-To: <1421893915-19309-1-git-send-email-pang.xunlei@linaro.org> References: <1421893915-19309-1-git-send-email-pang.xunlei@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: pang.xunlei@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.182 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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. Reviewed-by: John Stultz Reviewed-by: Arnd Bergmann Signed-off-by: Xunlei Pang --- 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 e34a07b..22bbe2e 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 29093da..8dcf682 100644 --- a/include/linux/rtc.h +++ b/include/linux/rtc.h @@ -162,7 +162,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)