From patchwork Wed Apr 15 09:20:11 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xunlei Pang X-Patchwork-Id: 47167 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 EAF8220553 for ; Wed, 15 Apr 2015 09:22:12 +0000 (UTC) Received: by wghm4 with SMTP id m4sf8234080wgh.2 for ; Wed, 15 Apr 2015 02:22:12 -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=l+atQaQYpZ50SMuzv0WxCzH/SOuNha8+v+xGLLC5/AA=; b=Cqw02tXhQ24G2YwmyyBDmuyeL1QMqnERtvhU7IEjlh+BiWBzqJmtTRfWxEdSC10Ifc SoU+JTTEaNW6hl3u8nH9WFrCdrUtml2lNc1F8k6vozNx/owKBIczNDMuCrgCxfYidwqL FDGdSI6z3AhnF8OCwc+xZL23PITMeuTuhNknTwY8ldy2vOYZH2W37vmJxvwLv1sX0evX lc5Ox5dK78S7b3IupoabBMEbY2DVMuPcX9GsDDSIRUkW79S08ZgMhuzRQbn8Dieo/wRa ajpUXenNdcvKSR9fr+SBLVJWWgOExhRoA/0JZzO/WpX5BHkuoDH61FTP6MIMnYuaF02w vbNw== X-Gm-Message-State: ALoCoQmZXxnBJOgnwCbhw4yi+RQyZW28DJMmOVR1DLeUwRnJQKtjTCLZtgZc6aMJlDGz8peF6run X-Received: by 10.112.51.68 with SMTP id i4mr5030112lbo.13.1429089732182; Wed, 15 Apr 2015 02:22:12 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.204.69 with SMTP id kw5ls148833lac.86.gmail; Wed, 15 Apr 2015 02:22:12 -0700 (PDT) X-Received: by 10.152.19.199 with SMTP id h7mr23457540lae.32.1429089731999; Wed, 15 Apr 2015 02:22:11 -0700 (PDT) Received: from mail-lb0-x233.google.com (mail-lb0-x233.google.com. [2a00:1450:4010:c04::233]) by mx.google.com with ESMTPS id zk8si3383867lbb.62.2015.04.15.02.22.11 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 15 Apr 2015 02:22:11 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c04::233 as permitted sender) client-ip=2a00:1450:4010:c04::233; Received: by lbbqq2 with SMTP id qq2so29016960lbb.3 for ; Wed, 15 Apr 2015 02:22:11 -0700 (PDT) X-Received: by 10.112.125.167 with SMTP id mr7mr22931912lbb.106.1429089731847; Wed, 15 Apr 2015 02:22:11 -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 l1csp2383320lbt; Wed, 15 Apr 2015 02:22:11 -0700 (PDT) X-Received: by 10.66.139.109 with SMTP id qx13mr16146119pab.110.1429089730156; Wed, 15 Apr 2015 02:22:10 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d2si6166272pdn.45.2015.04.15.02.22.08; Wed, 15 Apr 2015 02:22:10 -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 S932483AbbDOJWE (ORCPT + 27 others); Wed, 15 Apr 2015 05:22:04 -0400 Received: from m15-111.126.com ([220.181.15.111]:47366 "EHLO m15-111.126.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932354AbbDOJVu (ORCPT ); Wed, 15 Apr 2015 05:21:50 -0400 Received: from localhost.localdomain (unknown [210.21.223.3]) by smtp1 (Coremail) with SMTP id C8mowEDJuURQLS5VuDFEAA--.7421S6; Wed, 15 Apr 2015 17:20:34 +0800 (CST) From: Xunlei Pang To: linux-kernel@vger.kernel.org Cc: rtc-linux@googlegroups.com, Alessandro Zummo , John Stultz , Arnd Bergmann , Xunlei Pang , CIH , Nicolas Pitre , Andrew Christian , Richard Purdie Subject: [PATCH 5/5] drivers/rtc/sa1100: Replace deprecated rtc_tm_to_time() and rtc_time_to_tm() Date: Wed, 15 Apr 2015 17:20:11 +0800 Message-Id: <1429089611-29776-5-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--.7421S6 X-Coremail-Antispam: 1Uf129KBjvJXoW7AF45urWUWr45Zry5Cr1fCrg_yoW8urW3pF 4UCFZ8Jr4xtr93Wr1DKa1kurW3Ga18tr9Fqw4xJ3sa93WrJa1ktF1kCFy0y34Yqa4kGFy7 tF1rJry5Aw1UWaDanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jsUUUUUUUU= X-Originating-IP: [210.21.223.3] X-CM-SenderInfo: p0ost0bj6rjloofrz/1tbi6ATcv1UJPgV02QAAsF 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::233 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: CIH Cc: Nicolas Pitre Cc: Andrew Christian Cc: Richard Purdie Signed-off-by: Xunlei Pang --- drivers/rtc/rtc-sa1100.c | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/drivers/rtc/rtc-sa1100.c b/drivers/rtc/rtc-sa1100.c index b6e1ca0..625a320 100644 --- a/drivers/rtc/rtc-sa1100.c +++ b/drivers/rtc/rtc-sa1100.c @@ -157,19 +157,14 @@ static int sa1100_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled) static int sa1100_rtc_read_time(struct device *dev, struct rtc_time *tm) { - rtc_time_to_tm(RCNR, tm); + rtc_time64_to_tm(RCNR, tm); return 0; } static int sa1100_rtc_set_time(struct device *dev, struct rtc_time *tm) { - unsigned long time; - int ret; - - ret = rtc_tm_to_time(tm, &time); - if (ret == 0) - RCNR = time; - return ret; + RCNR = rtc_tm_to_time64(tm); + return 0; } static int sa1100_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm) @@ -185,23 +180,17 @@ static int sa1100_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm) static int sa1100_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm) { struct sa1100_rtc *info = dev_get_drvdata(dev); - unsigned long time; - int ret; spin_lock_irq(&info->lock); - ret = rtc_tm_to_time(&alrm->time, &time); - if (ret != 0) - goto out; RTSR = RTSR & (RTSR_HZE|RTSR_ALE|RTSR_AL); - RTAR = time; + RTAR = rtc_tm_to_time64(&alrm->time); if (alrm->enabled) RTSR |= RTSR_ALE; else RTSR &= ~RTSR_ALE; -out: spin_unlock_irq(&info->lock); - return ret; + return 0; } static int sa1100_rtc_proc(struct device *dev, struct seq_file *seq)