From patchwork Sat Jan 24 01:43:56 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 43713 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-we0-f197.google.com (mail-we0-f197.google.com [74.125.82.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B4456218DB for ; Sat, 24 Jan 2015 01:44:23 +0000 (UTC) Received: by mail-we0-f197.google.com with SMTP id l61sf266868wev.0 for ; Fri, 23 Jan 2015 17:44:23 -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=rUurATO4V4YUtGqzxbs8MM8fSuB4a/bgWBvfc9kIvMs=; b=MG/U5NpKjoCzjXRy1G6Nh2b0YdXtxL91+nXe/cHNze52zXRox9m+iK6lYCnlRac+5U nmO2w0RCgVHNTVbdj4N1E5d00D6grRVpybLWfOAwhNHKS1q7fJEnsX+t9AHTcB2LNbhX is4JZIQdIqtAd3+gauUJT6pxE8LaEdfCDKVxJJBJjn/1n8C7pf2b9I6Ku33+H1xC9o4N YYLIA/eS0B0SPOVRs9qs9Gp7HI7owcIIQo5OT/U0iJf/QgfC7iyo7K+wBMOg9OYjSzGd HPMnfJe4IVSzVL6chPWqVERWJvQ3bQUbR3zMJV/2/ABcy3IX2BfcLn0UxCHNvC5XmzML d+sw== X-Gm-Message-State: ALoCoQmI6xyrmZQoDYWfXBpRhSg+Xfq/V8HtRyyGOWwAoeroBTzLHsbdWYrZSjR3DbG5XSaLDgQB X-Received: by 10.180.7.226 with SMTP id m2mr648432wia.5.1422063863050; Fri, 23 Jan 2015 17:44:23 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.234.228 with SMTP id uh4ls352497lac.108.gmail; Fri, 23 Jan 2015 17:44:22 -0800 (PST) X-Received: by 10.112.137.196 with SMTP id qk4mr5549934lbb.33.1422063862828; Fri, 23 Jan 2015 17:44:22 -0800 (PST) Received: from mail-lb0-f172.google.com (mail-lb0-f172.google.com. [209.85.217.172]) by mx.google.com with ESMTPS id ss9si2824121lbb.89.2015.01.23.17.44.22 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 patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.172 as permitted sender) client-ip=209.85.217.172; Received: by mail-lb0-f172.google.com with SMTP id l4so490560lbv.3 for ; Fri, 23 Jan 2015 17:44:22 -0800 (PST) X-Received: by 10.112.84.225 with SMTP id c1mr10289936lbz.22.1422063862731; Fri, 23 Jan 2015 17:44:22 -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 h5csp90272lbj; Fri, 23 Jan 2015 17:44:22 -0800 (PST) X-Received: by 10.70.118.202 with SMTP id ko10mr16210124pdb.48.1422063856799; Fri, 23 Jan 2015 17:44:16 -0800 (PST) Received: from mail-pd0-f174.google.com (mail-pd0-f174.google.com. [209.85.192.174]) by mx.google.com with ESMTPS id yg8si3972665pab.86.2015.01.23.17.44.16 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 23 Jan 2015 17:44:16 -0800 (PST) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.192.174 as permitted sender) client-ip=209.85.192.174; Received: by mail-pd0-f174.google.com with SMTP id ft15so1031107pdb.5 for ; Fri, 23 Jan 2015 17:44:15 -0800 (PST) X-Received: by 10.68.135.197 with SMTP id pu5mr15737142pbb.105.1422063855918; Fri, 23 Jan 2015 17:44:15 -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.14 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 23 Jan 2015 17:44:15 -0800 (PST) From: John Stultz To: lkml Cc: Xunlei Pang , Arnd Bergmann , Thomas Gleixner , Ingo Molnar , John Stultz Subject: [PATCH 4/8] rtc: Update interface.c to use y2038-safe time interfaces Date: Fri, 23 Jan 2015 17:43:56 -0800 Message-Id: <1422063840-2837-5-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.217.172 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 Currently, interface.c uses y2038 problematic rtc_tm_to_time() and rtc_time_to_tm(). So replace them with their corresponding y2038-safe versions: rtc_tm_to_time64() and rtc_time64_to_tm(). Cc: pang.xunlei Cc: Arnd Bergmann Cc: Thomas Gleixner Cc: Ingo Molnar Signed-off-by: Xunlei Pang Signed-off-by: John Stultz --- drivers/rtc/interface.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c index 45bfc28ee..37215cf 100644 --- a/drivers/rtc/interface.c +++ b/drivers/rtc/interface.c @@ -73,10 +73,8 @@ int rtc_set_time(struct rtc_device *rtc, struct rtc_time *tm) else if (rtc->ops->set_time) err = rtc->ops->set_time(rtc->dev.parent, tm); else if (rtc->ops->set_mmss) { - unsigned long secs; - err = rtc_tm_to_time(tm, &secs); - if (err == 0) - err = rtc->ops->set_mmss(rtc->dev.parent, secs); + time64_t secs64 = rtc_tm_to_time64(tm); + err = rtc->ops->set_mmss(rtc->dev.parent, secs64); } else err = -EINVAL; @@ -105,7 +103,7 @@ int rtc_set_mmss(struct rtc_device *rtc, unsigned long secs) err = rtc->ops->read_time(rtc->dev.parent, &old); if (err == 0) { - rtc_time_to_tm(secs, &new); + rtc_time64_to_tm(secs, &new); /* * avoid writing when we're going to change the day of @@ -157,7 +155,7 @@ int __rtc_read_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm) int err; struct rtc_time before, now; int first_time = 1; - unsigned long t_now, t_alm; + time64_t t_now, t_alm; enum { none, day, month, year } missing = none; unsigned days; @@ -258,8 +256,8 @@ int __rtc_read_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm) } /* with luck, no rollover is needed */ - rtc_tm_to_time(&now, &t_now); - rtc_tm_to_time(&alarm->time, &t_alm); + t_now = rtc_tm_to_time64(&now); + t_alm = rtc_tm_to_time64(&alarm->time); if (t_now < t_alm) goto done; @@ -273,7 +271,7 @@ int __rtc_read_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm) case day: dev_dbg(&rtc->dev, "alarm rollover: %s\n", "day"); t_alm += 24 * 60 * 60; - rtc_time_to_tm(t_alm, &alarm->time); + rtc_time64_to_tm(t_alm, &alarm->time); break; /* Month rollover ... if it's the 31th, an alarm on the 3rd will @@ -346,19 +344,19 @@ EXPORT_SYMBOL_GPL(rtc_read_alarm); static int __rtc_set_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm) { struct rtc_time tm; - long now, scheduled; + time64_t now, scheduled; int err; err = rtc_valid_tm(&alarm->time); if (err) return err; - rtc_tm_to_time(&alarm->time, &scheduled); + scheduled = rtc_tm_to_time64(&alarm->time); /* Make sure we're not setting alarms in the past */ err = __rtc_read_time(rtc, &tm); if (err) return err; - rtc_tm_to_time(&tm, &now); + now = rtc_tm_to_time64(&tm); if (scheduled <= now) return -ETIME; /*