From patchwork Thu Jan 22 02:31:52 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "pang.xunlei" X-Patchwork-Id: 43484 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 5C608240D5 for ; Thu, 22 Jan 2015 02:32:27 +0000 (UTC) Received: by mail-wi0-f200.google.com with SMTP id fb4sf150341wid.3 for ; Wed, 21 Jan 2015 18:32:26 -0800 (PST) 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=kzUa/ccw66ATPEbWE0f5s040jwlSOmpvfOiBjX4sD1s=; b=SmKiIzKR/eFe5vFk4qAXWdv5fbzpdzgpTjcUuGov/3VNxE3WELNTiemzxSBtlt42ya TaUQL2LXQpFbTY/ZmHkZE8plzVwTwRJ6cmwKZrT/+WyFR4T0pExWEGPUmeF6anu9Xub0 CBBl2RkL9T+x7mOzvxybS1p+bdxpAp1RCIKrq0CR14cSuyrS/m3f1tGTwrPS8GSGo/zr Adtnw3+6ldjGI+F92vj7vEPiLxq8LwthzC1ebSf/fVQAw5fFfwFLzZ/NDeIuehO+34QH mbdQcuJ+NqBWcG5Q2yxwFOBzs51N4eq+ceiI/KAGZZyCGf6mFfnJ2dx/h4ctP0W6gwmw ZPhQ== X-Gm-Message-State: ALoCoQkr8Jrk/cVccqA4lo0MK4rpQjFfJA9ucWUojVFODf56O4QkGKQip9P/zDlAzBvyRWSa20uY X-Received: by 10.180.84.7 with SMTP id u7mr30406wiy.0.1421893946691; Wed, 21 Jan 2015 18:32:26 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.178.195 with SMTP id da3ls125990lac.32.gmail; Wed, 21 Jan 2015 18:32:26 -0800 (PST) X-Received: by 10.112.56.142 with SMTP id a14mr46551999lbq.16.1421893946320; Wed, 21 Jan 2015 18:32:26 -0800 (PST) Received: from mail-la0-f41.google.com (mail-la0-f41.google.com. [209.85.215.41]) by mx.google.com with ESMTPS id q13si13733484lal.79.2015.01.21.18.32.26 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 21 Jan 2015 18:32:26 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.41 as permitted sender) client-ip=209.85.215.41; Received: by mail-la0-f41.google.com with SMTP id gm9so17560488lab.0 for ; Wed, 21 Jan 2015 18:32:26 -0800 (PST) X-Received: by 10.112.98.99 with SMTP id eh3mr46756113lbb.32.1421893946189; Wed, 21 Jan 2015 18:32:26 -0800 (PST) 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.9.200 with SMTP id c8csp109891lbb; Wed, 21 Jan 2015 18:32:25 -0800 (PST) X-Received: by 10.68.130.66 with SMTP id oc2mr67985490pbb.134.1421893944413; Wed, 21 Jan 2015 18:32:24 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id mb2si2608674pdb.250.2015.01.21.18.32.23; Wed, 21 Jan 2015 18:32:24 -0800 (PST) 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 S1754576AbbAVCcS (ORCPT + 28 others); Wed, 21 Jan 2015 21:32:18 -0500 Received: from mail-qg0-f48.google.com ([209.85.192.48]:53867 "EHLO mail-qg0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754309AbbAVCcH (ORCPT ); Wed, 21 Jan 2015 21:32:07 -0500 Received: by mail-qg0-f48.google.com with SMTP id z60so6006528qgd.7 for ; Wed, 21 Jan 2015 18:32:07 -0800 (PST) X-Received: by 10.229.249.137 with SMTP id mk9mr74625599qcb.4.1421893926945; Wed, 21 Jan 2015 18:32:06 -0800 (PST) Received: from ip-10-181-65-231.ec2.internal ([54.235.93.228]) by mx.google.com with ESMTPSA id w9sm5174891qab.18.2015.01.21.18.32.06 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 21 Jan 2015 18:32:06 -0800 (PST) From: Xunlei Pang To: linux-kernel@vger.kernel.org Cc: rtc-linux@googlegroups.com, Thomas Gleixner , Alessandro Zummo , John Stultz , Arnd Bergmann , Xunlei Pang Subject: [PATCH 2/5] drivers/rtc/rtc-dev.c: Update code to use y2038-safe time interfaces Date: Thu, 22 Jan 2015 02:31:52 +0000 Message-Id: <1421893915-19309-2-git-send-email-pang.xunlei@linaro.org> X-Mailer: git-send-email 2.2.1 In-Reply-To: <1421893915-19309-1-git-send-email-pang.xunlei@linaro.org> References: <1421893915-19309-1-git-send-email-pang.xunlei@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: pang.xunlei@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.41 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org 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: , Currently, rtc-dev.c uses y2038 problematic rtc_tm_to_time() and rtc_time_to_tm(). So replace them with their corresponding y2038-safe versions: rtc_tm_to_time64() and rtc_time64_to_tm(). Reviewed-by: John Stultz Reviewed-by: Arnd Bergmann Signed-off-by: Xunlei Pang --- drivers/rtc/rtc-dev.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/rtc/rtc-dev.c b/drivers/rtc/rtc-dev.c index d049393..799c34b 100644 --- a/drivers/rtc/rtc-dev.c +++ b/drivers/rtc/rtc-dev.c @@ -304,12 +304,12 @@ static long rtc_dev_ioctl(struct file *file, * Not supported here. */ { - unsigned long now, then; + time64_t now, then; err = rtc_read_time(rtc, &tm); if (err < 0) return err; - rtc_tm_to_time(&tm, &now); + now = rtc_tm_to_time64(&tm); alarm.time.tm_mday = tm.tm_mday; alarm.time.tm_mon = tm.tm_mon; @@ -317,11 +317,11 @@ static long rtc_dev_ioctl(struct file *file, err = rtc_valid_tm(&alarm.time); if (err < 0) return err; - rtc_tm_to_time(&alarm.time, &then); + then = rtc_tm_to_time64(&alarm.time); /* alarm may need to wrap into tomorrow */ if (then < now) { - rtc_time_to_tm(now + 24 * 60 * 60, &tm); + rtc_time64_to_tm(now + 24 * 60 * 60, &tm); alarm.time.tm_mday = tm.tm_mday; alarm.time.tm_mon = tm.tm_mon; alarm.time.tm_year = tm.tm_year;