From patchwork Wed Jul 12 08:04:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 9836091 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 96F32602BD for ; Wed, 12 Jul 2017 08:06:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8A18F28437 for ; Wed, 12 Jul 2017 08:06:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7EB5128602; Wed, 12 Jul 2017 08:06:22 +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 E672D28437 for ; Wed, 12 Jul 2017 08:06:21 +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=5SwnTgG5UpVagzYx+n8bBH6KG5dZX//04MaXeSb7JUo=; b=n67jB7TlI9I70vgKxBWG57vjgt Z08y+1OcFu6WS85EyGm47nf7OjKJ91pjfreg6CD1m+QhKldGpoCk3IEKF6f8LdNDzHcMyz9sbL2b4 lAuRUvuDgN7zJxPLngrYqUpGFaV+fHqFkv2aVcdCpR8cLkd2jf7cvXhtUcBnRz75jkJv/p7Fz8qSn vg60lxKKLFTFGS1I0ultq50pL0FDE/o9EnkdOGxH5qeuEjeKdODEnjk6p1G5kvUgvXF5gy2K5lx5G jQ3Y+WLaXy/GzT/FXyZOBTUBKCG5qsAi5LJWhb6/EPDXA5wkffFROfwg49rOednzjAwMMRkYGVCeh fGh73NbA==; 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 1dVCf5-0007q3-VB; Wed, 12 Jul 2017 08:06:20 +0000 Received: from mail-wr0-x236.google.com ([2a00:1450:400c:c0c::236]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dVCep-0007BT-KL for linux-arm-kernel@lists.infradead.org; Wed, 12 Jul 2017 08:06:11 +0000 Received: by mail-wr0-x236.google.com with SMTP id 77so22555551wrb.1 for ; Wed, 12 Jul 2017 01:05:42 -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=N5o21xjhsfYiOkiAvAc8xDLniSaY3M4Z9yubD+7kWIo=; b=AKvhkiyAVxHnk5dXCEV/gD9uZJ62hwSILkoG8fCyOd2TRzhXpK7jxvP67gwpDMH6jZ RnHnD1U9vmr61JGuK52jL0bBwbfuFJPD4SB1j3Wi6dhd1BlSkssaBxJtqCmGo9UPTx2/ WwOF7PWPVuM0VgPdHTFODHqdW2/PbQKMXfXF4= 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=N5o21xjhsfYiOkiAvAc8xDLniSaY3M4Z9yubD+7kWIo=; b=LN4sMmaLF+q2QdDHGl9A2wF02exvZi9RisUm4+/6/uMhLltBP+prLJINYwL+p8tkwY 0FxXt5ObC0zBt8oiBon35KzWkbQF/NiyXQYmf6CWy6f3M972kwl6YnENCv8m1PJDxo3K 46v2LaJ9VWd0Ve8jpqsA0aLi1QuIOXcJMbqdhp7nRHffKdRfSEcGhn/ONn9WAWsDtDlj 2uq1ruozfl85JElFBc3zli+DPXC2brS69YX2JS9jUPBpoxSIWFhfFu7jrzKFcOkNIp0a 3lp9wdtmOu/Mo1VUJEBxdbQJa4ZRd9swKK3m9nBPZQ6wm1+V1m8H2tcDHv5vzpeNkSlp d+Hw== X-Gm-Message-State: AIVw113O4MWlsFFS6nzQch9TTd29TfWk+ZuCX3ksjJbgnToHEg/JZ+W6 8ke4aAeUpG4H66MG X-Received: by 10.28.175.135 with SMTP id y129mr1549411wme.87.1499846741458; Wed, 12 Jul 2017 01:05:41 -0700 (PDT) Received: from lmenx321.st.com. ([80.215.158.26]) by smtp.gmail.com with ESMTPSA id p34sm1430744wrc.66.2017.07.12.01.05.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 12 Jul 2017 01:05:40 -0700 (PDT) From: Benjamin Gaignard To: benjamin.gaignard@linaro.org Subject: [PATCH v2 19/22] rtc: sun6i: stop using rtc deprecated functions Date: Wed, 12 Jul 2017 10:04:39 +0200 Message-Id: <1499846682-14093-20-git-send-email-benjamin.gaignard@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1499846682-14093-1-git-send-email-benjamin.gaignard@linaro.org> References: <1499846682-14093-1-git-send-email-benjamin.gaignard@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170712_010604_552211_4771F7BA X-CRM114-Status: GOOD ( 13.28 ) 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, linux-kernel@vger.kernel.org, Chen-Yu Tsai , Alexandre Belloni , Maxime Ripard , 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: Maxime Ripard CC: Chen-Yu Tsai CC: Alessandro Zummo CC: Alexandre Belloni CC: rtc-linux@googlegroups.com CC: linux-kernel@vger.kernel.org CC: linux-arm-kernel@lists.infradead.org --- drivers/rtc/rtc-sun6i.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/rtc/rtc-sun6i.c b/drivers/rtc/rtc-sun6i.c index 39cbc12..9928f74 100644 --- a/drivers/rtc/rtc-sun6i.c +++ b/drivers/rtc/rtc-sun6i.c @@ -120,7 +120,7 @@ struct sun6i_rtc_dev { struct device *dev; void __iomem *base; int irq; - unsigned long alarm; + unsigned long long alarm; struct clk_hw hw; struct clk_hw *int_osc; @@ -342,7 +342,7 @@ static int sun6i_rtc_getalarm(struct device *dev, struct rtc_wkalrm *wkalrm) wkalrm->enabled = !!(alrm_en & SUN6I_ALRM_EN_CNT_EN); wkalrm->pending = !!(alrm_st & SUN6I_ALRM_EN_CNT_EN); - rtc_time_to_tm(chip->alarm, &wkalrm->time); + rtc_time64_to_tm(chip->alarm, &wkalrm->time); return 0; } @@ -352,9 +352,9 @@ static int sun6i_rtc_setalarm(struct device *dev, struct rtc_wkalrm *wkalrm) struct sun6i_rtc_dev *chip = dev_get_drvdata(dev); struct rtc_time *alrm_tm = &wkalrm->time; struct rtc_time tm_now; - unsigned long time_now = 0; - unsigned long time_set = 0; - unsigned long time_gap = 0; + unsigned long long time_now = 0; + unsigned long long time_set = 0; + unsigned long long time_gap = 0; int ret = 0; ret = sun6i_rtc_gettime(dev, &tm_now); @@ -363,8 +363,8 @@ static int sun6i_rtc_setalarm(struct device *dev, struct rtc_wkalrm *wkalrm) return -EINVAL; } - rtc_tm_to_time(alrm_tm, &time_set); - rtc_tm_to_time(&tm_now, &time_now); + time_set = rtc_tm_to_time64(alrm_tm); + time_now = rtc_tm_to_time64(&tm_now); if (time_set <= time_now) { dev_err(dev, "Date to set in the past\n"); return -EINVAL;