From patchwork Fri Jun 12 02:04: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: 49780 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 7975C2460E for ; Fri, 12 Jun 2015 02:07:51 +0000 (UTC) Received: by wgv5 with SMTP id 5sf5886624wgv.0 for ; Thu, 11 Jun 2015 19: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: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=2H+CGxWyJOrAx3GVLNFf+VYnDZGJAjP9RoYOVkIljEk=; b=KchjmTpWEHNqePVgZp1RMo1mF16/S+CThJHt4El1Dlhuwc8uFlowGiyWL+7dWu6yb7 FYEcJNeJM1oupIFV8Fhm3EXP9Dbf5wP5S1APfcCyROv7liXDk1GKIOBT+8AgrQzJaGN9 YIAODM+4F8pQ2WIxeVwpVg2IP2alt/QU6fYflArF25e7AYK5o9/6jo9Q0DcaiQqhnPWB i3+jI0zXrFEaVwp7r1MBWCV9fDJrNEU5vqbP3wM5+AYYWbF+r14NAFZ+pr9Z6W2sB3P3 mtim1DlYZcT967lvS3mKkLIKojWW6B315GK0o8SSatACbGx6TO3+j7WywOQuQLMLtftg cuKQ== X-Gm-Message-State: ALoCoQkgD349THIMfhX8FzZEak8NOJQyG53vjCpJ+unJ4SxWGO04A5Q3bwKMSFYi4pQNkwewfKEn X-Received: by 10.180.97.9 with SMTP id dw9mr1460375wib.2.1434074870824; Thu, 11 Jun 2015 19:07:50 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.20.201 with SMTP id p9ls518254lae.42.gmail; Thu, 11 Jun 2015 19:07:50 -0700 (PDT) X-Received: by 10.152.5.164 with SMTP id t4mr12713438lat.16.1434074870531; Thu, 11 Jun 2015 19:07:50 -0700 (PDT) Received: from mail-la0-x22d.google.com (mail-la0-x22d.google.com. [2a00:1450:4010:c03::22d]) by mx.google.com with ESMTPS id wx3si2124081lbb.142.2015.06.11.19.07.50 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 11 Jun 2015 19:07:50 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c03::22d as permitted sender) client-ip=2a00:1450:4010:c03::22d; Received: by labko7 with SMTP id ko7so13158852lab.2 for ; Thu, 11 Jun 2015 19:07:50 -0700 (PDT) X-Received: by 10.152.87.33 with SMTP id u1mr13044004laz.35.1434074870406; Thu, 11 Jun 2015 19: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 hn6csp217691lbb; Thu, 11 Jun 2015 19:07:49 -0700 (PDT) X-Received: by 10.68.195.233 with SMTP id ih9mr18677780pbc.74.1434074868609; Thu, 11 Jun 2015 19:07:48 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id gs10si3194394pac.124.2015.06.11.19.07.47; Thu, 11 Jun 2015 19: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 S1752293AbbFLCHn (ORCPT + 29 others); Thu, 11 Jun 2015 22:07:43 -0400 Received: from m50-112.126.com ([123.125.50.112]:52482 "EHLO m50-112.126.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751286AbbFLCHm (ORCPT ); Thu, 11 Jun 2015 22:07:42 -0400 Received: from localhost.localdomain (unknown [210.21.223.3]) by smtp6 (Coremail) with SMTP id j9KowAAnryswPnpVKTVCAA--.101S4; Fri, 12 Jun 2015 10:04:46 +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 , Herbert Valerio Riedel Subject: [PATCH v3 3/4] drivers/rtc/isl1208: Replace deprecated rtc_tm_to_time() Date: Fri, 12 Jun 2015 10:04:11 +0800 Message-Id: <1434074652-16054-3-git-send-email-xlpang@126.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1434074652-16054-1-git-send-email-xlpang@126.com> References: <1434074652-16054-1-git-send-email-xlpang@126.com> X-CM-TRANSID: j9KowAAnryswPnpVKTVCAA--.101S4 X-Coremail-Antispam: 1Uf129KBjvJXoW7Zw4kGr4kKF4DGw4UXFy7Wrg_yoW8Gw15pF 43K3s0vr4vgr9agwnrAF18uFWrGa1UtaykGFZrJ39a9w1fX3WDKFy0kw409Fy5XaykC3y3 WF1SkF15Kr1UG3JanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jvUDJUUUUU= X-Originating-IP: [210.21.223.3] X-CM-SenderInfo: p0ost0bj6rjloofrz/1tbimhEXv1GfW36ZlgABsG 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::22d as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org; dkim=neutral (body hash did not verify) header.i=@126.com; 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 isl1208_i2c_set_alarm() uses deprecated rtc_tm_to_time(), which will overflow in year 2106 on 32-bit machines. This patch solves this by: - Replacing rtc_tm_to_time() with rtc_tm_sub() Cc: Herbert Valerio Riedel Signed-off-by: Xunlei Pang --- v2->v3: Rename rtc_tm_subtract() to rtc_tm_sub(). drivers/rtc/rtc-isl1208.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/drivers/rtc/rtc-isl1208.c b/drivers/rtc/rtc-isl1208.c index c3c549d..aa3b8f1 100644 --- a/drivers/rtc/rtc-isl1208.c +++ b/drivers/rtc/rtc-isl1208.c @@ -370,22 +370,15 @@ isl1208_i2c_set_alarm(struct i2c_client *client, struct rtc_wkalrm *alarm) struct rtc_time *alarm_tm = &alarm->time; u8 regs[ISL1208_ALARM_SECTION_LEN] = { 0, }; const int offs = ISL1208_REG_SCA; - unsigned long rtc_secs, alarm_secs; struct rtc_time rtc_tm; int err, enable; err = isl1208_i2c_read_time(client, &rtc_tm); if (err) return err; - err = rtc_tm_to_time(&rtc_tm, &rtc_secs); - if (err) - return err; - err = rtc_tm_to_time(alarm_tm, &alarm_secs); - if (err) - return err; /* If the alarm time is before the current time disable the alarm */ - if (!alarm->enabled || alarm_secs <= rtc_secs) + if (!alarm->enabled || rtc_tm_sub(alarm_tm, &rtc_tm) <= 0) enable = 0x00; else enable = 0x80;