From patchwork Fri Nov 21 19:44:17 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 41363 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f69.google.com (mail-wg0-f69.google.com [74.125.82.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 27DAB2452C for ; Fri, 21 Nov 2014 19:44:54 +0000 (UTC) Received: by mail-wg0-f69.google.com with SMTP id k14sf3444962wgh.8 for ; Fri, 21 Nov 2014 11:44:53 -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=N7PgK8kdFhizM4StKmAD5CztPGZ8nD8RAzQhfVRFs80=; b=QP8BfViBcyv3R7tdGuYNgJEoCK2i1JK1mfD/yRlg9MzAQloDfv/IAC/HnJm8nthnmF ZrRZuQ3Gb7+L4tYlDg9p5igqU8fIoV/OUaucY7u5oZpllX0tpRqQ7iMcM6mLxZ8J+qAH ztpaTUay9dc8c+L50MXXaJDHUgkiw6bZv7yNzyTia2BsoBfkTkXAKNzCBl0hQ5mRW2Lm pKNQ9wblNaqgEExcLLAwsvTF9cAEsK7hS36EL1yW4kxiWs8FAo86Ue3vtP9kBucxsF2o SuLktE7fDRAKGTiU8r8TQSxuKK7TP1wYkA26QAtl/cq1vIC/DfNdycut5IN/j1TisSfh 0KBA== X-Gm-Message-State: ALoCoQk9OtyEqNJAy/6Fq9N2a3H4Mw/imSniyAXlT8CUF3xbjgNNjW605q0QRzK1NrIq9cDvwhNa X-Received: by 10.112.32.163 with SMTP id k3mr1395213lbi.17.1416599093390; Fri, 21 Nov 2014 11:44:53 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.42.197 with SMTP id q5ls246013lal.39.gmail; Fri, 21 Nov 2014 11:44:52 -0800 (PST) X-Received: by 10.152.179.1 with SMTP id dc1mr6143750lac.88.1416599092698; Fri, 21 Nov 2014 11:44:52 -0800 (PST) Received: from mail-la0-f49.google.com (mail-la0-f49.google.com. [209.85.215.49]) by mx.google.com with ESMTPS id kw3si7047395lbc.61.2014.11.21.11.44.52 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 21 Nov 2014 11:44:52 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) client-ip=209.85.215.49; Received: by mail-la0-f49.google.com with SMTP id hs14so4834029lab.36 for ; Fri, 21 Nov 2014 11:44:52 -0800 (PST) X-Received: by 10.112.189.10 with SMTP id ge10mr7210191lbc.23.1416599092597; Fri, 21 Nov 2014 11:44:52 -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.184.201 with SMTP id ew9csp153761lbc; Fri, 21 Nov 2014 11:44:51 -0800 (PST) X-Received: by 10.66.118.198 with SMTP id ko6mr10181619pab.19.1416599088442; Fri, 21 Nov 2014 11:44:48 -0800 (PST) Received: from mail-pa0-f46.google.com (mail-pa0-f46.google.com. [209.85.220.46]) by mx.google.com with ESMTPS id yk2si10168152pbc.140.2014.11.21.11.44.47 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 21 Nov 2014 11:44:48 -0800 (PST) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.46 as permitted sender) client-ip=209.85.220.46; Received: by mail-pa0-f46.google.com with SMTP id lj1so5470469pab.5 for ; Fri, 21 Nov 2014 11:44:47 -0800 (PST) X-Received: by 10.68.138.137 with SMTP id qq9mr10123381pbb.73.1416599087362; Fri, 21 Nov 2014 11:44:47 -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 t9sm5513621pbs.75.2014.11.21.11.44.46 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 21 Nov 2014 11:44:46 -0800 (PST) From: John Stultz To: lkml Cc: John Stultz , Thomas Gleixner , Ingo Molnar , Arnd Bergmann , "pang.xunlei" , Miroslav Lichvar , Richard Cochran , Prarit Bhargava , Alessandro Zummo Subject: [PATCH 11/12] rtc: Update suspend/resume timing to use 64bit time Date: Fri, 21 Nov 2014 11:44:17 -0800 Message-Id: <1416599058-13836-12-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1416599058-13836-1-git-send-email-john.stultz@linaro.org> References: <1416599058-13836-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.49 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: , Currently the rtc suspend/resume timing is done using y2038 problematic timespecs. So update the code to utilize timespec64 types. Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Arnd Bergmann Cc: pang.xunlei Cc: Miroslav Lichvar Cc: Richard Cochran Cc: Prarit Bhargava Cc: Alessandro Zummo Signed-off-by: John Stultz --- drivers/rtc/class.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/rtc/class.c b/drivers/rtc/class.c index 38e26be..472a5ad 100644 --- a/drivers/rtc/class.c +++ b/drivers/rtc/class.c @@ -45,14 +45,14 @@ int rtc_hctosys_ret = -ENODEV; * system's wall clock; restore it on resume(). */ -static struct timespec old_rtc, old_system, old_delta; +static struct timespec64 old_rtc, old_system, old_delta; static int rtc_suspend(struct device *dev) { struct rtc_device *rtc = to_rtc_device(dev); struct rtc_time tm; - struct timespec delta, delta_delta; + struct timespec64 delta, delta_delta; int err; if (has_persistent_clock()) @@ -68,8 +68,8 @@ static int rtc_suspend(struct device *dev) return 0; } - getnstimeofday(&old_system); - rtc_tm_to_time(&tm, &old_rtc.tv_sec); + getnstimeofday64(&old_system); + old_rtc.tv_sec = rtc_tm_to_time64(&tm); /* @@ -78,8 +78,8 @@ static int rtc_suspend(struct device *dev) * try to compensate so the difference in system time * and rtc time stays close to constant. */ - delta = timespec_sub(old_system, old_rtc); - delta_delta = timespec_sub(delta, old_delta); + delta = timespec64_sub(old_system, old_rtc); + delta_delta = timespec64_sub(delta, old_delta); if (delta_delta.tv_sec < -2 || delta_delta.tv_sec >= 2) { /* * if delta_delta is too large, assume time correction @@ -88,7 +88,7 @@ static int rtc_suspend(struct device *dev) old_delta = delta; } else { /* Otherwise try to adjust old_system to compensate */ - old_system = timespec_sub(old_system, delta_delta); + old_system = timespec64_sub(old_system, delta_delta); } return 0; @@ -98,8 +98,8 @@ static int rtc_resume(struct device *dev) { struct rtc_device *rtc = to_rtc_device(dev); struct rtc_time tm; - struct timespec new_system, new_rtc; - struct timespec sleep_time; + struct timespec64 new_system, new_rtc; + struct timespec64 sleep_time; int err; if (has_persistent_clock()) @@ -110,7 +110,7 @@ static int rtc_resume(struct device *dev) return 0; /* snapshot the current rtc and system time at resume */ - getnstimeofday(&new_system); + getnstimeofday64(&new_system); err = rtc_read_time(rtc, &tm); if (err < 0) { pr_debug("%s: fail to read rtc time\n", dev_name(&rtc->dev)); @@ -121,7 +121,7 @@ static int rtc_resume(struct device *dev) pr_debug("%s: bogus resume time\n", dev_name(&rtc->dev)); return 0; } - rtc_tm_to_time(&tm, &new_rtc.tv_sec); + new_rtc.tv_sec = rtc_tm_to_time64(&tm); new_rtc.tv_nsec = 0; if (new_rtc.tv_sec < old_rtc.tv_sec) { @@ -130,7 +130,7 @@ static int rtc_resume(struct device *dev) } /* calculate the RTC time delta (sleep time)*/ - sleep_time = timespec_sub(new_rtc, old_rtc); + sleep_time = timespec64_sub(new_rtc, old_rtc); /* * Since these RTC suspend/resume handlers are not called @@ -139,11 +139,11 @@ static int rtc_resume(struct device *dev) * so subtract kernel run-time between rtc_suspend to rtc_resume * to keep things accurate. */ - sleep_time = timespec_sub(sleep_time, - timespec_sub(new_system, old_system)); + sleep_time = timespec64_sub(sleep_time, + timespec64_sub(new_system, old_system)); if (sleep_time.tv_sec >= 0) - timekeeping_inject_sleeptime(&sleep_time); + timekeeping_inject_sleeptime64(&sleep_time); rtc_hctosys_ret = 0; return 0; }