From patchwork Sun Jul 26 01:53:53 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xunlei Pang X-Patchwork-Id: 51469 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f71.google.com (mail-la0-f71.google.com [209.85.215.71]) by patches.linaro.org (Postfix) with ESMTPS id 5C0AB20323 for ; Sun, 26 Jul 2015 01:55:44 +0000 (UTC) Received: by lagw2 with SMTP id w2sf17755826lag.3 for ; Sat, 25 Jul 2015 18:55:42 -0700 (PDT) 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=yjT3ItcfsfwLajfm2s8UHAKXNM89JXZzcR4aCT7qmsU=; b=J/LFWEKIH7WXmqTwoVUPb7Ek+UHdLuwkEwkT6kr6+Evaz4CBYOZWEv84wnqGJZjwNN oFs8XQxIJMs7FnfYLem0RT1o/tv6BD9R/NKODgcQemRU04gvFtcbr5LWtCS+OraDq2f3 ZsEzNjka7Q4KiP/3HuPqUUFwpiJRbWZ3Xy41i0k7RUOWgZA3eGJKyferugpGvjTUiA33 FCGVgLvt2fLd9NMP5W+fU43sAbgxYmkunhwRhvMSEVAoRJ7wPR6uY8gFXOaN7imOVn1J jPdXB0Oh1EWsGUBS25j2Zq0YAC50N7zctTAmLSvTPTzQQ7K4cqygFDD3tPNyr5uvsl33 ON/g== X-Gm-Message-State: ALoCoQnv7NfvRyz/uHS79vLIJanjl13oLFgC/dKaiKgwNvbxhVCZRhKOX1lhwcA5/OaEllX2tsy6 X-Received: by 10.112.51.177 with SMTP id l17mr9345498lbo.1.1437875742404; Sat, 25 Jul 2015 18:55:42 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.42.165 with SMTP id p5ls445686lal.68.gmail; Sat, 25 Jul 2015 18:55:42 -0700 (PDT) X-Received: by 10.152.22.4 with SMTP id z4mr20710426lae.81.1437875742069; Sat, 25 Jul 2015 18:55:42 -0700 (PDT) Received: from mail-la0-x22a.google.com (mail-la0-x22a.google.com. [2a00:1450:4010:c03::22a]) by mx.google.com with ESMTPS id us12si11571663lbb.107.2015.07.25.18.55.41 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 25 Jul 2015 18:55:41 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c03::22a as permitted sender) client-ip=2a00:1450:4010:c03::22a; Received: by lahh5 with SMTP id h5so31772199lah.2 for ; Sat, 25 Jul 2015 18:55:41 -0700 (PDT) X-Received: by 10.152.22.99 with SMTP id c3mr21065476laf.32.1437875741708; Sat, 25 Jul 2015 18:55:41 -0700 (PDT) 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.7.198 with SMTP id l6csp782877lba; Sat, 25 Jul 2015 18:55:40 -0700 (PDT) X-Received: by 10.70.48.166 with SMTP id m6mr38914705pdn.13.1437875739704; Sat, 25 Jul 2015 18:55:39 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id pg3si32606420pdb.40.2015.07.25.18.55.38; Sat, 25 Jul 2015 18:55:39 -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; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964872AbbGZBzb (ORCPT + 28 others); Sat, 25 Jul 2015 21:55:31 -0400 Received: from m50-110.126.com ([123.125.50.110]:55222 "EHLO m50-110.126.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755078AbbGZBza (ORCPT ); Sat, 25 Jul 2015 21:55:30 -0400 Received: from localhost.localdomain (unknown [210.21.223.3]) by smtp4 (Coremail) with SMTP id jdKowAAHrCTXPbRVwMbaAQ--.5958S4; Sun, 26 Jul 2015 09:54:40 +0800 (CST) From: Xunlei Pang To: linux-kernel@vger.kernel.org Cc: Thomas Gleixner , David Howells , Koichi Yasutake , linux-am33-list@redhat.com, Xunlei Pang , John Stultz , Arnd Bergmann Subject: [PATCH v2 2/2] mn10300: time: Provide 64-bit persistent clock time Date: Sun, 26 Jul 2015 09:53:53 +0800 Message-Id: <1437875633-5715-2-git-send-email-xlpang@126.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1437875633-5715-1-git-send-email-xlpang@126.com> References: <1437875633-5715-1-git-send-email-xlpang@126.com> X-CM-TRANSID: jdKowAAHrCTXPbRVwMbaAQ--.5958S4 X-Coremail-Antispam: 1Uf129KBjvJXoW7CryDZw47tr18ZF1UXr15XFb_yoW8Kr45p3 yIk3Z8Jr4UtFW7ZF92y34Duw1Yg3s8tF42qa4fta4Fywn7trnrKFy0v342vr9FgFyfZa10 9a1xGFnIvw4kCwUanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jJqXdUUUUU= X-Originating-IP: [210.21.223.3] X-CM-SenderInfo: p0ost0bj6rjloofrz/1tbi7wBDv1UwzFDCfgAAsW Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Original-Sender: xlpang@126.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c03::22a as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org; dkim=neutral (body hash did not verify) header.i=@126.com; dmarc=fail (p=NONE dis=NONE) header.from=126.com 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: , From: Xunlei Pang As part of addressing the "y2038 problem" for in-kernel uses, convert update_persistent_clock() to update_persistent_clock64(), read_persistent_clock() to read_persistent_clock64() using timespec64 for MN10300. Cc: John Stultz Cc: Arnd Bergmann Signed-off-by: Xunlei Pang --- arch/mn10300/kernel/rtc.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/arch/mn10300/kernel/rtc.c b/arch/mn10300/kernel/rtc.c index 48d7058..038ae16 100644 --- a/arch/mn10300/kernel/rtc.c +++ b/arch/mn10300/kernel/rtc.c @@ -23,19 +23,19 @@ EXPORT_SYMBOL(rtc_lock); /* * Read the current RTC time */ -void read_persistent_clock(struct timespec *ts) +void read_persistent_clock64(struct timespec64 *ts) { struct rtc_time tm; get_rtc_time(&tm); ts->tv_nsec = 0; - ts->tv_sec = mktime(tm.tm_year, tm.tm_mon, tm.tm_mday, + ts->tv_sec = mktime64(tm.tm_year, tm.tm_mon, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec); /* if rtc is way off in the past, set something reasonable */ if (ts->tv_sec < 0) - ts->tv_sec = mktime(2009, 1, 1, 12, 0, 0); + ts->tv_sec = mktime64(2009, 1, 1, 12, 0, 0); } /* @@ -48,7 +48,7 @@ void read_persistent_clock(struct timespec *ts) * BUG: This routine does not handle hour overflow properly; it just * sets the minutes. Usually you'll only notice that after reboot! */ -static int set_rtc_mmss(unsigned long nowtime) +static int set_rtc_mmss(time64_t nowtime) { unsigned char save_control, save_freq_select; int retval = 0; @@ -74,8 +74,7 @@ static int set_rtc_mmss(unsigned long nowtime) * messing with unknown time zones but requires your * RTC not to be off by more than 15 minutes */ - real_seconds = nowtime % 60; - real_minutes = nowtime / 60; + real_minutes = div_s64_rem(nowtime, 60, &real_seconds); if (((abs(real_minutes - cmos_minutes) + 15) / 30) & 1) /* correct for half hour time zone */ real_minutes += 30; @@ -109,7 +108,7 @@ static int set_rtc_mmss(unsigned long nowtime) return retval; } -int update_persistent_clock(struct timespec now) +int update_persistent_clock64(struct timespec64 now) { return set_rtc_mmss(now.tv_sec); }