From patchwork Wed Apr 15 09:20:10 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xunlei Pang X-Patchwork-Id: 47168 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f197.google.com (mail-wi0-f197.google.com [209.85.212.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 1411420553 for ; Wed, 15 Apr 2015 09:22:28 +0000 (UTC) Received: by wizk4 with SMTP id k4sf10016490wiz.2 for ; Wed, 15 Apr 2015 02:22:27 -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=6xTk/N7nFiuU69QiA85Sroox9Op3XDHmB8KfMAM9HcA=; b=C0a0APIRzvGRRmyAstUVPvWQuOQbUA8gP5Unzyf6YmDYDthi7UwgekbUiX/4QP8/0+ ANEhAx3DPAaHvIeDgvejt66BDuPLxatF5Vd5yuGQ3cvDsKTk2UpLIPBbTFSxhPFKWEX4 cuxe5jlT+nLjEKJSx+1giUKiW3krSvqnSOO6Sf1EDHJRcQhsJThAOl0NR6+LiTezAzlI 9NMp/4dhTeb3HxdkaHCJQEyEU4AhQ6pJ7IbvoyHC0v1Uv/UIkg4NVg1VSr9C1RZZ524V ioR48+voH/5bL3gnUkzhbUm3pgFzRSgK5wMXJFqXKrb6tmUalCKUzxXtprGc0bVD8fr8 bpJw== X-Gm-Message-State: ALoCoQmOgvfs+V9sJfAQXk4K5C6zTBG3IwbguuyzFwYHzcvId2eqogS1H24znpxfGNoMqZhjx8P5 X-Received: by 10.112.26.5 with SMTP id h5mr5034326lbg.4.1429089747355; Wed, 15 Apr 2015 02:22:27 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.184.8 with SMTP id eq8ls177743lac.91.gmail; Wed, 15 Apr 2015 02:22:27 -0700 (PDT) X-Received: by 10.152.179.39 with SMTP id dd7mr10932062lac.118.1429089747103; Wed, 15 Apr 2015 02:22:27 -0700 (PDT) Received: from mail-lb0-x236.google.com (mail-lb0-x236.google.com. [2a00:1450:4010:c04::236]) by mx.google.com with ESMTPS id ys9si3383813lab.63.2015.04.15.02.22.26 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 15 Apr 2015 02:22:26 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c04::236 as permitted sender) client-ip=2a00:1450:4010:c04::236; Received: by lbbuc2 with SMTP id uc2so29073766lbb.2 for ; Wed, 15 Apr 2015 02:22:26 -0700 (PDT) X-Received: by 10.112.125.138 with SMTP id mq10mr712288lbb.35.1429089746823; Wed, 15 Apr 2015 02:22:26 -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.67.65 with SMTP id l1csp2383417lbt; Wed, 15 Apr 2015 02:22:25 -0700 (PDT) X-Received: by 10.70.89.138 with SMTP id bo10mr45238788pdb.146.1429089744924; Wed, 15 Apr 2015 02:22:24 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id dy1si6156531pbc.32.2015.04.15.02.22.23; Wed, 15 Apr 2015 02:22:24 -0700 (PDT) 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 S1754395AbbDOJWJ (ORCPT + 27 others); Wed, 15 Apr 2015 05:22:09 -0400 Received: from m15-111.126.com ([220.181.15.111]:46612 "EHLO m15-111.126.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932267AbbDOJVg (ORCPT ); Wed, 15 Apr 2015 05:21:36 -0400 Received: from localhost.localdomain (unknown [210.21.223.3]) by smtp1 (Coremail) with SMTP id C8mowEDJuURQLS5VuDFEAA--.7421S5; Wed, 15 Apr 2015 17:20:31 +0800 (CST) From: Xunlei Pang To: linux-kernel@vger.kernel.org Cc: rtc-linux@googlegroups.com, Alessandro Zummo , John Stultz , Arnd Bergmann , Xunlei Pang , Russell King Subject: [PATCH 4/5] drivers/rtc/pl030: Replace deprecated rtc_tm_to_time() and rtc_time_to_tm() Date: Wed, 15 Apr 2015 17:20:10 +0800 Message-Id: <1429089611-29776-4-git-send-email-xlpang@126.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1429089611-29776-1-git-send-email-xlpang@126.com> References: <1429089611-29776-1-git-send-email-xlpang@126.com> X-CM-TRANSID: C8mowEDJuURQLS5VuDFEAA--.7421S5 X-Coremail-Antispam: 1Uf129KBjvJXoW7AF45urWUWr45Zry5Cr1fCrg_yoW8tw1kpF WUua98Jr4Iqr9ag3WDtr1kuFsxGw1xJa47Wr4xK39a93WkJw1ktFy8Cr9avry5Jas5GFW7 JF4rJF98Gr1UGFDanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jm4E_UUUUU= X-Originating-IP: [210.21.223.3] X-CM-SenderInfo: p0ost0bj6rjloofrz/1tbimgDcv1GfV7g4fAAAsc 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:c04::236 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org; dkim=neutral (body hash did not verify) header.i=@; 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 The driver uses deprecated rtc_tm_to_time() and rtc_time_to_tm(), which will overflow in year 2106 on 32-bit machines. This patch solves this by: - Replacing rtc_tm_to_time() with rtc_tm_to_time64() - Replacing rtc_time_to_tm() with rtc_time64_to_tm() Cc: Russell King Signed-off-by: Xunlei Pang --- drivers/rtc/rtc-pl030.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/rtc/rtc-pl030.c b/drivers/rtc/rtc-pl030.c index f85a1a9..d874b6e 100644 --- a/drivers/rtc/rtc-pl030.c +++ b/drivers/rtc/rtc-pl030.c @@ -39,32 +39,34 @@ static int pl030_read_alarm(struct device *dev, struct rtc_wkalrm *alrm) { struct pl030_rtc *rtc = dev_get_drvdata(dev); - rtc_time_to_tm(readl(rtc->base + RTC_MR), &alrm->time); + rtc_time64_to_tm(readl(rtc->base + RTC_MR), &alrm->time); return 0; } static int pl030_set_alarm(struct device *dev, struct rtc_wkalrm *alrm) { struct pl030_rtc *rtc = dev_get_drvdata(dev); - unsigned long time; + time64_t time; int ret; /* * At the moment, we can only deal with non-wildcarded alarm times. */ ret = rtc_valid_tm(&alrm->time); - if (ret == 0) - ret = rtc_tm_to_time(&alrm->time, &time); - if (ret == 0) - writel(time, rtc->base + RTC_MR); - return ret; + if (ret) + return ret; + + time = rtc_tm_to_time64(&alrm->time); + writel(time, rtc->base + RTC_MR); + + return 0; } static int pl030_read_time(struct device *dev, struct rtc_time *tm) { struct pl030_rtc *rtc = dev_get_drvdata(dev); - rtc_time_to_tm(readl(rtc->base + RTC_DR), tm); + rtc_time64_to_tm(readl(rtc->base + RTC_DR), tm); return 0; } @@ -80,14 +82,12 @@ static int pl030_read_time(struct device *dev, struct rtc_time *tm) static int pl030_set_time(struct device *dev, struct rtc_time *tm) { struct pl030_rtc *rtc = dev_get_drvdata(dev); - unsigned long time; - int ret; + time64_t time; - ret = rtc_tm_to_time(tm, &time); - if (ret == 0) - writel(time + 1, rtc->base + RTC_LR); + time = rtc_tm_to_time64(tm); + writel(time + 1, rtc->base + RTC_LR); - return ret; + return 0; } static const struct rtc_class_ops pl030_ops = {