From patchwork Tue Jun 20 09:35:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 9799069 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DC30860329 for ; Tue, 20 Jun 2017 09:38:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CFFED26B41 for ; Tue, 20 Jun 2017 09:38:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C4F28283A6; Tue, 20 Jun 2017 09:38:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3C76126B41 for ; Tue, 20 Jun 2017 09:38:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=vgrQwGRgmNV09wJ8HuXP2cMLOSpYDjZKsTPZMaiSHdQ=; b=VD4L/xlOH6/4vFOVCJuJ0AJAIP iLAPNEgU4LFv/6IsW0dfPkzvybjbOtruV7GyxyPWN6DI3iu7utvtu7hcnuFEVjG73mDrog7orST7j prVN5wh0WaTFXAdSdYFDBc+40oLqxjZBcu0VVh+8K2JdAhTqRyUG47TSbL2ZEDUuBKNoEiw/uB4uk wUY4jNHuSEsLAlP32BgkIsvR2zmpoVHzhXwZo9XxR8mNmldJa8VaLwmeIXuTNWDTe0Pn4OVK9wAyO q2uy6R5X3ltz3B0YK8XkQZtLueRQ1chrMQYLH0SzmyBf+P8JLeATWNj5ppljyCJJKpBOFluqA1CAl 9Jw7XL9A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dNFce-000557-CY; Tue, 20 Jun 2017 09:38:56 +0000 Received: from mail-wm0-x230.google.com ([2a00:1450:400c:c09::230]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dNFcK-0004Tx-S7 for linux-arm-kernel@lists.infradead.org; Tue, 20 Jun 2017 09:38:46 +0000 Received: by mail-wm0-x230.google.com with SMTP id u195so14579867wmd.1 for ; Tue, 20 Jun 2017 02:38:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=2+VrQinv8y8IjhpmSE6ShuyuOYFwnl8rbzbhn72pOvE=; b=eVAt8hRFU7DAVl5tJovu0k0iJ+kXYuYwZ+RLUlp3i0JOFNCOPTTcF64VZpwlPjP7Vm YYTMgZ+R01fS1jpgcPHthuX/+FvTWe++vv1J+Rrc4MJ0uX5gIVpPXPV7RO/Ik22dPJGs 8jp2gaIcFAURLs0Oh+NDkiwzrQJX/euzSIncY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=2+VrQinv8y8IjhpmSE6ShuyuOYFwnl8rbzbhn72pOvE=; b=MS8YAhMwqrd9GY/+isDqkJ9Fh8ghNhZyi8gvWRSYswE1Hg2R99srRTludC15EFwJnD dlyt1jaEBa4fqtS+ufH3HCiS9ZR+/ZeTr+7u/q4fR9Rog+7+EGJnn3gWjucq+t/KVZ1w cPm08vraPe+jY/jTnHfAciVwL620oeb6fYPo3NpUCt3DPSGnUBhnZ1nCP3dRGh3EVllj ENgJEKgJS333ViUvFY24Fk+maRe9qJLNOs+6xzm4D9qW7ssVy7ra5ljMSjalMsMDxxZf b/r6lji17G8xi92dCnujw6/dchJK8+J2Z90Xt2p8Ax4PAOIVGiUaKW1LasB7t4cIGrdD MAqQ== X-Gm-Message-State: AKS2vOy4VakTSWnfLztXuIuCF23k4ACKkp+qQn9N3daki0dU09/C3ZI9 eeNuFetCQp64pDxA X-Received: by 10.28.101.213 with SMTP id z204mr2154228wmb.106.1497951494866; Tue, 20 Jun 2017 02:38:14 -0700 (PDT) Received: from lmenx321.st.com. ([80.215.93.217]) by smtp.gmail.com with ESMTPSA id e24sm4482318wrc.35.2017.06.20.02.38.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 20 Jun 2017 02:38:14 -0700 (PDT) From: Benjamin Gaignard To: benjamin.gaignard@linaro.org Subject: [PATCH 34/51] rtc: pl031: stop using rtc deprecated functions Date: Tue, 20 Jun 2017 11:35:42 +0200 Message-Id: <1497951359-13334-35-git-send-email-benjamin.gaignard@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1497951359-13334-1-git-send-email-benjamin.gaignard@linaro.org> References: <1497951359-13334-1-git-send-email-benjamin.gaignard@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170620_023837_137118_FB8551CF X-CRM114-Status: GOOD ( 14.48 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alessandro Zummo , linaro-kernel@lists.linaro.org, rtc-linux@googlegroups.com, Linus Walleij , linux-kernel@vger.kernel.org, Alexandre Belloni , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP rtc_time_to_tm() and rtc_tm_to_time() are deprecated because they rely on 32bits variables and that will make rtc break in y2038/2016. Stop using those two functions to safer 64bits ones. Signed-off-by: Benjamin Gaignard CC: Linus Walleij CC: Alessandro Zummo CC: Alexandre Belloni CC: rtc-linux@googlegroups.com CC: linux-kernel@vger.kernel.org CC: linux-arm-kernel@lists.infradead.org Acked-by: Linus Walleij --- drivers/rtc/rtc-pl031.c | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/drivers/rtc/rtc-pl031.c b/drivers/rtc/rtc-pl031.c index e1687e1..07f72b3 100644 --- a/drivers/rtc/rtc-pl031.c +++ b/drivers/rtc/rtc-pl031.c @@ -127,11 +127,11 @@ static int pl031_stv2_tm_to_time(struct device *dev, return -EINVAL; } else if (wday == -1) { /* wday is not provided, calculate it here */ - unsigned long time; + unsigned long long time; struct rtc_time calc_tm; - rtc_tm_to_time(tm, &time); - rtc_time_to_tm(time, &calc_tm); + time = rtc_tm_to_time64(tm); + rtc_time64_to_tm(time, &calc_tm); wday = calc_tm.tm_wday; } @@ -252,30 +252,27 @@ static int pl031_read_time(struct device *dev, struct rtc_time *tm) { struct pl031_local *ldata = dev_get_drvdata(dev); - rtc_time_to_tm(readl(ldata->base + RTC_DR), tm); + rtc_time64_to_tm(readl(ldata->base + RTC_DR), tm); return 0; } static int pl031_set_time(struct device *dev, struct rtc_time *tm) { - unsigned long time; + unsigned long long time; struct pl031_local *ldata = dev_get_drvdata(dev); - int ret; - - ret = rtc_tm_to_time(tm, &time); - if (ret == 0) - writel(time, ldata->base + RTC_LR); + time = rtc_tm_to_time64(tm); + writel(time, ldata->base + RTC_LR); - return ret; + return 0; } static int pl031_read_alarm(struct device *dev, struct rtc_wkalrm *alarm) { struct pl031_local *ldata = dev_get_drvdata(dev); - rtc_time_to_tm(readl(ldata->base + RTC_MR), &alarm->time); + rtc_time64_to_tm(readl(ldata->base + RTC_MR), &alarm->time); alarm->pending = readl(ldata->base + RTC_RIS) & RTC_BIT_AI; alarm->enabled = readl(ldata->base + RTC_IMSC) & RTC_BIT_AI; @@ -286,17 +283,15 @@ static int pl031_read_alarm(struct device *dev, struct rtc_wkalrm *alarm) static int pl031_set_alarm(struct device *dev, struct rtc_wkalrm *alarm) { struct pl031_local *ldata = dev_get_drvdata(dev); - unsigned long time; + unsigned long long time; int ret; /* At the moment, we can only deal with non-wildcarded alarm times. */ ret = rtc_valid_tm(&alarm->time); if (ret == 0) { - ret = rtc_tm_to_time(&alarm->time, &time); - if (ret == 0) { - writel(time, ldata->base + RTC_MR); - pl031_alarm_irq_enable(dev, alarm->enabled); - } + time = rtc_tm_to_time64(&alarm->time); + writel(time, ldata->base + RTC_MR); + pl031_alarm_irq_enable(dev, alarm->enabled); } return ret;