From patchwork Sun Jul 26 10:45:40 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xunlei Pang X-Patchwork-Id: 51471 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 patches.linaro.org (Postfix) with ESMTPS id 5C22B22DA5 for ; Sun, 26 Jul 2015 10:53:37 +0000 (UTC) Received: by lbcjf8 with SMTP id jf8sf19396354lbc.0 for ; Sun, 26 Jul 2015 03:53:36 -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=ISr1SK2F/FsPz0tkEbQEIFQ+LdFHasMIq0naCEmgv9s=; b=HZY1nO1gRjUzZeCckV2TVB60j0mP8bp/ZRz4WDZorqRQTu9P23+mgXzOlQT78Umohy m4zfO68qDMp57YxlyphmSFownKwde9LXk1J9sQUV9jGtaqPmhZAPgqnAtjxyOED/xSIS thrzkMZ0PUNpOhIh+Ay9zYn2WSmIEtALcrJXu3BbwouOJGe/+Jq/O311hvvh9gZY+Rz7 KuUmeGylem406wHlM71Z5LySNGQpQpp76DkCI95XQzxOFylCOk0V0U8FS67Dr+R2wmzg JB6w4QV2u/zJzyMjbijW6+pTsADv1yhNpVrfX6Gpmswka2KWDdsKG7yh8Co30+quUy5/ kkuQ== X-Gm-Message-State: ALoCoQkjWybylCRIKn/syLHsD8OgKOrf3mQFjc7AktqT8YQ9hYx5P00M9DwR6+5MmXgR9FWgc0l3 X-Received: by 10.152.87.46 with SMTP id u14mr7434796laz.5.1437908016287; Sun, 26 Jul 2015 03:53:36 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.87.81 with SMTP id v17ls614055laz.2.gmail; Sun, 26 Jul 2015 03:53:36 -0700 (PDT) X-Received: by 10.152.42.205 with SMTP id q13mr21728965lal.119.1437908015954; Sun, 26 Jul 2015 03:53:35 -0700 (PDT) Received: from mail-la0-x22f.google.com (mail-la0-x22f.google.com. [2a00:1450:4010:c03::22f]) by mx.google.com with ESMTPS id ln10si12429789lac.42.2015.07.26.03.53.35 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 26 Jul 2015 03:53:35 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c03::22f as permitted sender) client-ip=2a00:1450:4010:c03::22f; Received: by lahh5 with SMTP id h5so34326855lah.2 for ; Sun, 26 Jul 2015 03:53:35 -0700 (PDT) X-Received: by 10.152.36.102 with SMTP id p6mr22005795laj.19.1437908015792; Sun, 26 Jul 2015 03:53:35 -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 l6csp962597lba; Sun, 26 Jul 2015 03:53:34 -0700 (PDT) X-Received: by 10.66.161.232 with SMTP id xv8mr54566377pab.137.1437908013659; Sun, 26 Jul 2015 03:53:33 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a10si35195254pas.176.2015.07.26.03.53.32; Sun, 26 Jul 2015 03:53:33 -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 S1755182AbbGZKx3 (ORCPT + 28 others); Sun, 26 Jul 2015 06:53:29 -0400 Received: from m50-112.126.com ([123.125.50.112]:53667 "EHLO m50-112.126.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755140AbbGZKx1 (ORCPT ); Sun, 26 Jul 2015 06:53:27 -0400 Received: from localhost.localdomain (unknown [210.21.223.3]) by smtp6 (Coremail) with SMTP id j9KowADXZmOlu7RVhtpEAQ--.160S4; Sun, 26 Jul 2015 18:51:28 +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 v3 2/2] mn10300: time: Provide 64-bit persistent clock time Date: Sun, 26 Jul 2015 18:45:40 +0800 Message-Id: <1437907540-13610-2-git-send-email-xlpang@126.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1437907540-13610-1-git-send-email-xlpang@126.com> References: <1437907540-13610-1-git-send-email-xlpang@126.com> X-CM-TRANSID: j9KowADXZmOlu7RVhtpEAQ--.160S4 X-Coremail-Antispam: 1Uf129KBjvJXoW7CryDZw4fKFW5trWUXrWrZrb_yoW8Krykp3 yIk3Z8Jr4UtFW3ZF92y34Duw1Yq3s0yF42qa4fta4FywnrtrnrKFy0v3y2vr9FgFyfZa10 9a1xGFnIvw48CwUanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jJqXdUUUUU= X-Originating-IP: [210.21.223.3] X-CM-SenderInfo: p0ost0bj6rjloofrz/1tbi6BhDv1UJRdG3QwAAsw 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::22f 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 --- v2->v3: no changes. 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); }