From patchwork Tue Jun 2 09:04:19 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xunlei Pang X-Patchwork-Id: 49347 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 94F592052D for ; Tue, 2 Jun 2015 09:07:51 +0000 (UTC) Received: by wibbk2 with SMTP id bk2sf29254806wib.2 for ; Tue, 02 Jun 2015 02:07:50 -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:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=52wA+lBSoz6aj/q2Ok7Hqdhs+03AvUJHdY+7QwsCO6k=; b=kdYaFsfoutN19tpBZmbzlTQ388+Dha/1zuCz49l7DJzrblTpjeCFzlinAvsGkcCfJN pR/s9XGQ8zKIHA5XEEvsbtFAYCuVnNylOwzoU34OSGNXxQ3KYuiUww9uT4Fg5ofa1uGN arukTF0ni1Wm3Q+MCOkne8Ombc+05dAQSHaTbZWPQbsnlRny08CK/x5lE1xVjXsR8z8g lvUCGjQ5C7pqvAHPWnS08zH6JCIsztzOrxN3gv5qIExS1/Dc8/Q8ZOSyDcXWqSb0ywQG B8wPI4i1YunxOYBq4Sv39BNgpPksm1btFo5ZyKOtS2J3lHILtOCHtTZMOS5rV6bMgqSw 31Wg== X-Gm-Message-State: ALoCoQkUd4tqyqeXMW6DxKSCtlzfYGZ0qofQJczzVeqJcI3RIbrxn6R100gvTDjbustUJ4Gn/F3B X-Received: by 10.181.5.7 with SMTP id ci7mr1207511wid.1.1433236070921; Tue, 02 Jun 2015 02:07:50 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.87.130 with SMTP id ay2ls819663lab.89.gmail; Tue, 02 Jun 2015 02:07:50 -0700 (PDT) X-Received: by 10.112.204.6 with SMTP id ku6mr25114277lbc.73.1433236070719; Tue, 02 Jun 2015 02:07:50 -0700 (PDT) Received: from mail-la0-x230.google.com (mail-la0-x230.google.com. [2a00:1450:4010:c03::230]) by mx.google.com with ESMTPS id pd4si14568433lbc.40.2015.06.02.02.07.50 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 02 Jun 2015 02:07:50 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c03::230 as permitted sender) client-ip=2a00:1450:4010:c03::230; Received: by laew7 with SMTP id w7so28353571lae.1 for ; Tue, 02 Jun 2015 02:07:50 -0700 (PDT) X-Received: by 10.112.131.98 with SMTP id ol2mr9175094lbb.56.1433236070549; Tue, 02 Jun 2015 02:07:50 -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.108.230 with SMTP id hn6csp2909790lbb; Tue, 2 Jun 2015 02:07:49 -0700 (PDT) X-Received: by 10.68.68.161 with SMTP id x1mr10851976pbt.49.1433236068738; Tue, 02 Jun 2015 02:07:48 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id of3si17207907pbc.252.2015.06.02.02.07.47; Tue, 02 Jun 2015 02:07:48 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756325AbbFBJHm (ORCPT + 28 others); Tue, 2 Jun 2015 05:07:42 -0400 Received: from m50-110.126.com ([123.125.50.110]:44737 "EHLO m50-110.126.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754884AbbFBJHf (ORCPT ); Tue, 2 Jun 2015 05:07:35 -0400 Received: from localhost.localdomain (unknown [210.21.223.3]) by smtp4 (Coremail) with SMTP id jdKowADHAkWqcW1V1JEqAQ--.1798S2; Tue, 02 Jun 2015 17:04:48 +0800 (CST) From: Xunlei Pang To: linux-kernel@vger.kernel.org Cc: rtc-linux@googlegroups.com, Alessandro Zummo , Alexandre Belloni , John Stultz , Arnd Bergmann , Xunlei Pang Subject: [PATCH v2 1/4] drivers/rtc/pcf8563: Replace deprecated rtc_time_to_tm() and rtc_tm_to_time() Date: Tue, 2 Jun 2015 17:04:19 +0800 Message-Id: <1433235862-1638-1-git-send-email-xlpang@126.com> X-Mailer: git-send-email 1.9.1 X-CM-TRANSID: jdKowADHAkWqcW1V1JEqAQ--.1798S2 X-Coremail-Antispam: 1Uf129KBjvJXoW7AF45urWUXw43Aw13Jw4xWFg_yoW8Gr4xpF 4rGa4Dtrs2qryFgwn2yFykuF4rJ3WkJaykWF4DG39Y9F1rXasrKF9YkFyUK34UXa95CF12 vF4rZF15Ww1DCa7anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jVzuXUUUUU= X-Originating-IP: [210.21.223.3] X-CM-SenderInfo: p0ost0bj6rjloofrz/1tbimhYNv1GfWsA84gAAs0 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:c03::230 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 pcf8563_rtc_set_alarm() 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_time_to_tm() with rtc_time64_to_tm() - Replacing rtc_tm_to_time() with rtc_tm_to_time64() Acked-by: Arnd Bergmann Signed-off-by: Xunlei Pang --- drivers/rtc/rtc-pcf8563.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/rtc/rtc-pcf8563.c b/drivers/rtc/rtc-pcf8563.c index 0ba7e59..5f87f84 100644 --- a/drivers/rtc/rtc-pcf8563.c +++ b/drivers/rtc/rtc-pcf8563.c @@ -363,13 +363,13 @@ static int pcf8563_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *tm) struct i2c_client *client = to_i2c_client(dev); unsigned char buf[4]; int err; - unsigned long alarm_time; /* The alarm has no seconds, round up to nearest minute */ if (tm->time.tm_sec) { - rtc_tm_to_time(&tm->time, &alarm_time); - alarm_time += 60-tm->time.tm_sec; - rtc_time_to_tm(alarm_time, &tm->time); + time64_t alarm_time = rtc_tm_to_time64(&tm->time); + + alarm_time += 60 - tm->time.tm_sec; + rtc_time64_to_tm(alarm_time, &tm->time); } dev_dbg(dev, "%s, min=%d hour=%d wday=%d mday=%d "