From patchwork Tue Jan 13 15:44:50 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xunlei Pang X-Patchwork-Id: 43058 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-we0-f200.google.com (mail-we0-f200.google.com [74.125.82.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 8555320DE8 for ; Tue, 13 Jan 2015 15:47:48 +0000 (UTC) Received: by mail-we0-f200.google.com with SMTP id u56sf2114895wes.3 for ; Tue, 13 Jan 2015 07:47:47 -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=v5En4fOgJJSNBzO5t3GUNar02RxfXb/JzD7CY11J6mc=; b=YeC/gqe6kVR9YX/MV9/PO7xJ2xIV0Y2IokhNfAD//H26PgIOiDhuXOufCw/Q42WJqx Y4bxMFFIBoB0eenZNHrzDjXjUHkWY8iHHV1NZ79dmO3cNJhgkEeZRXxM4078am+Dwzpy aao/m8X/FvDBPyqwdseOqoujRT19qAkxj1uQjfrQpuGNzP0i+SCLrwliLqleJY5QYCIG bDM04GihsW1+YSnEha7NIHY1JnTY9dOajhWc/ZvI7cQb/qqArF3ydal5sj4jWk1FixLd FwqM0tFROO/IthSutUuZxHOF52sNRP/gj7AiWLTRLILVmXazYOhr6ZpSNSOSuZjS/lfb ToIA== X-Gm-Message-State: ALoCoQmK1/EoE/6zczwy/YGh8RK754o1bjn7Re7HKB+VRBvMRMeLzuksWMJA3Y02vrcpFN5h4419 X-Received: by 10.112.133.98 with SMTP id pb2mr1976565lbb.2.1421164067719; Tue, 13 Jan 2015 07:47:47 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.87.50 with SMTP id u18ls8091laz.96.gmail; Tue, 13 Jan 2015 07:47:47 -0800 (PST) X-Received: by 10.112.47.135 with SMTP id d7mr42788732lbn.54.1421164067555; Tue, 13 Jan 2015 07:47:47 -0800 (PST) Received: from mail-la0-x22b.google.com (mail-la0-x22b.google.com. [2a00:1450:4010:c03::22b]) by mx.google.com with ESMTPS id gl8si24606224lbc.60.2015.01.13.07.47.47 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 13 Jan 2015 07:47:47 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c03::22b as permitted sender) client-ip=2a00:1450:4010:c03::22b; Received: by mail-la0-f43.google.com with SMTP id s18so3332457lam.2 for ; Tue, 13 Jan 2015 07:47:47 -0800 (PST) X-Received: by 10.152.27.8 with SMTP id p8mr43370941lag.69.1421164067390; Tue, 13 Jan 2015 07:47:47 -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 c8csp1421242lbb; Tue, 13 Jan 2015 07:47:46 -0800 (PST) X-Received: by 10.68.227.72 with SMTP id ry8mr5315090pbc.101.1421164065529; Tue, 13 Jan 2015 07:47:45 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id kf9si27455890pbc.70.2015.01.13.07.47.44; Tue, 13 Jan 2015 07:47:45 -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 S1753104AbbAMPrf (ORCPT + 27 others); Tue, 13 Jan 2015 10:47:35 -0500 Received: from m15-111.126.com ([220.181.15.111]:37349 "EHLO m15-111.126.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752841AbbAMPqj (ORCPT ); Tue, 13 Jan 2015 10:46:39 -0500 Received: from vptest-PC.zte.com.cn (unknown [182.149.91.53]) by smtp1 (Coremail) with SMTP id C8mowEAZEUVxPbVUBIRpDg--.692S5; Tue, 13 Jan 2015 23:44:57 +0800 (CST) From: Xunlei Pang To: linux-kernel@vger.kernel.org, John Stultz , Arnd Bergmann Cc: rtc-linux@googlegroups.com, Thomas Gleixner , Alessandro Zummo , Xunlei Pang Subject: [RFC PATCH v2 2/9] time: Provide y2106 safe get_seconds() replacement Date: Tue, 13 Jan 2015 23:44:50 +0800 Message-Id: <1421163897-8020-3-git-send-email-xlpang@126.com> X-Mailer: git-send-email 2.0.4 In-Reply-To: <1421163897-8020-1-git-send-email-xlpang@126.com> References: <1421163897-8020-1-git-send-email-xlpang@126.com> X-CM-TRANSID: C8mowEAZEUVxPbVUBIRpDg--.692S5 X-Coremail-Antispam: 1Uf129KBjvJXoW7trWxWrWUKryxXF4fGFykKrg_yoW8ZrWrpF ZrCwn8GF4xZFyfCws7Wwsxu34aqw4DAF4xGFyxGw1Fvr1jqFnYqr40934Yqry2yFWruFsr AayIvFyYv34UZa7anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jQUUUUUUUU= X-Originating-IP: [182.149.91.53] X-CM-SenderInfo: p0ost0bj6rjloofrz/1tbimhaAv1GfUwd18QAAst 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::22b 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 As part of addressing "y2038 problem" for in-kernel uses, this patch adds safe get_seconds64() using time64_t. After this patch, get_seconds() is deprecated and all its call sites will be fixed using get_seconds64(), after that it can be removed. Signed-off-by: Xunlei Pang --- include/linux/timekeeping.h | 10 +++++++++- kernel/time/timekeeping.c | 4 ++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h index 9b63d13..384d101 100644 --- a/include/linux/timekeeping.h +++ b/include/linux/timekeeping.h @@ -17,7 +17,7 @@ extern int do_sys_settimeofday(const struct timespec *tv, /* * Kernel time accessors */ -unsigned long get_seconds(void); +extern time64_t get_seconds64(void); struct timespec current_kernel_time(void); /* does not take xtime_lock */ struct timespec __current_kernel_time(void); @@ -34,6 +34,14 @@ extern time64_t ktime_get_real_seconds(void); extern int __getnstimeofday64(struct timespec64 *tv); extern void getnstimeofday64(struct timespec64 *tv); +/** + * Deprecated. Use get_seconds64(). + */ +static inline unsigned long get_seconds(void) +{ + return (unsigned long)get_seconds64(); +} + #if BITS_PER_LONG == 64 /** * Deprecated. Use do_settimeofday64(). diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index 6a93185..ab021a3 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -1678,13 +1678,13 @@ void getboottime(struct timespec *ts) } EXPORT_SYMBOL_GPL(getboottime); -unsigned long get_seconds(void) +time64_t get_seconds64(void) { struct timekeeper *tk = &tk_core.timekeeper; return tk->xtime_sec; } -EXPORT_SYMBOL(get_seconds); +EXPORT_SYMBOL(get_seconds64); struct timespec __current_kernel_time(void) {