From patchwork Tue Nov 18 11:15:17 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "pang.xunlei" X-Patchwork-Id: 41009 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f69.google.com (mail-la0-f69.google.com [209.85.215.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id CACB8241C9 for ; Tue, 18 Nov 2014 11:20:33 +0000 (UTC) Received: by mail-la0-f69.google.com with SMTP id gd6sf85137lab.8 for ; Tue, 18 Nov 2014 03:20:32 -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=ha0oXbNMbYinl3+tTzTZnJxaVrjFA+BDFkkhASWTWaY=; b=BQcY99g9eBkdbMLDnrdE7gQA4EdBwUHSz9kGxn9bAX4w1uCWUxgV1HnW2luAxUjJNt HzIx0p/ZRCQRBoDVm7JOPmyfwQnew2UusQYVMs2xwVnDqBJX6A3lXZnl17vjx8Xhw/ER mCoU8uYUxVrdNdK8v9OlDUAKHu3rXObkswEvuV/xe8L5SzUJ0GNWeHy+9V8qSfd6Y6h5 MpYb1b0hAJrPQWeo7I4ALmxBvARhcRXDskIsJKIXhe0P3I2AWB37GNoKVC53SEuIfc3l p5BOA+xIgNA3LAfSfCx7O7Z8lz3jEetcSOuZ2XRJXxBQ3Y3Np+vW4l8xjN38YnM05ynG cg/g== X-Gm-Message-State: ALoCoQkekEAEnqQY4iI1SH8x1joAM02TZ0HZlzcyrVCvblzZBIzVOVOLyykbwb+sg7+kXnRmABtN X-Received: by 10.112.154.194 with SMTP id vq2mr1699806lbb.10.1416309632841; Tue, 18 Nov 2014 03:20:32 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.29.5 with SMTP id f5ls1265616lah.62.gmail; Tue, 18 Nov 2014 03:20:32 -0800 (PST) X-Received: by 10.152.87.18 with SMTP id t18mr35479233laz.0.1416309632536; Tue, 18 Nov 2014 03:20:32 -0800 (PST) Received: from mail-lb0-f173.google.com (mail-lb0-f173.google.com. [209.85.217.173]) by mx.google.com with ESMTPS id kw6si28338263lac.24.2014.11.18.03.20.32 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 18 Nov 2014 03:20:32 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.173 as permitted sender) client-ip=209.85.217.173; Received: by mail-lb0-f173.google.com with SMTP id n15so17492460lbi.4 for ; Tue, 18 Nov 2014 03:20:32 -0800 (PST) X-Received: by 10.112.62.166 with SMTP id z6mr17829983lbr.74.1416309632298; Tue, 18 Nov 2014 03:20:32 -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.184.201 with SMTP id ew9csp1310473lbc; Tue, 18 Nov 2014 03:20:30 -0800 (PST) X-Received: by 10.68.197.41 with SMTP id ir9mr36554943pbc.116.1416309630054; Tue, 18 Nov 2014 03:20:30 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q5si37781941pdm.153.2014.11.18.03.20.29 for ; Tue, 18 Nov 2014 03:20:30 -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 S1753969AbaKRLUZ (ORCPT + 26 others); Tue, 18 Nov 2014 06:20:25 -0500 Received: from mail-pd0-f173.google.com ([209.85.192.173]:63744 "EHLO mail-pd0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752917AbaKRLUT (ORCPT ); Tue, 18 Nov 2014 06:20:19 -0500 Received: by mail-pd0-f173.google.com with SMTP id ft15so2256461pdb.18 for ; Tue, 18 Nov 2014 03:20:19 -0800 (PST) X-Received: by 10.68.135.33 with SMTP id pp1mr10823822pbb.120.1416309618980; Tue, 18 Nov 2014 03:20:18 -0800 (PST) Received: from wangdeqiang.com ([210.21.223.3]) by mx.google.com with ESMTPSA id l13sm7556923pbq.40.2014.11.18.03.20.14 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 18 Nov 2014 03:20:18 -0800 (PST) From: "pang.xunlei" To: linux-kernel@vger.kernel.org Cc: rtc-linux@googlegroups.com, Thomas Gleixner , Alessandro Zummo , John Stultz , Arnd Bergmann , "pang.xunlei" Subject: [RFC PATCH v3 2/5] time: Provide y2038 safe timekeeping_inject_sleeptime() replacement Date: Tue, 18 Nov 2014 19:15:17 +0800 Message-Id: <1416309320-7498-3-git-send-email-pang.xunlei@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1416309320-7498-1-git-send-email-pang.xunlei@linaro.org> References: <1416309320-7498-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.217.173 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: , As part of addressing "y2038 problem" for in-kernel uses, this patch adds timekeeping_inject_sleeptime64() using timespec64. After this patch, timekeeping_inject_sleeptime() is deprecated and all its call sites will be fixed using the new interface, after that it can be removed. NOTE: timekeeping_inject_sleeptime() is safe actually, but we want to eliminate timespec eventually, so comes this patch. Signed-off-by: pang.xunlei --- include/linux/timekeeping.h | 13 ++++++++++++- kernel/time/timekeeping.c | 10 ++++------ 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h index 071ad7e..6d76c65 100644 --- a/include/linux/timekeeping.h +++ b/include/linux/timekeeping.h @@ -201,7 +201,18 @@ static inline void timekeeping_clocktai(struct timespec *ts) /* * RTC specific */ -extern void timekeeping_inject_sleeptime(struct timespec *delta); +extern void timekeeping_inject_sleeptime64(struct timespec64 *delta); + +/** + * Deprecated. Use timekeeping_inject_sleeptime64(). + */ +static inline void timekeeping_inject_sleeptime(struct timespec *delta) +{ + struct timespec64 delta64; + + delta64 = timespec_to_timespec64(*delta); + timekeeping_inject_sleeptime64(&delta64); +} /* * PPS accessor diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index 1d33550..d37f775 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -1067,8 +1067,8 @@ static void __timekeeping_inject_sleeptime(struct timekeeper *tk, } /** - * timekeeping_inject_sleeptime - Adds suspend interval to timeekeeping values - * @delta: pointer to a timespec delta value + * timekeeping_inject_sleeptime64 - Adds suspend interval to timeekeeping values + * @delta: pointer to a timespec64 delta value * * This hook is for architectures that cannot support read_persistent_clock * because their RTC/persistent clock is only accessible when irqs are enabled. @@ -1076,10 +1076,9 @@ static void __timekeeping_inject_sleeptime(struct timekeeper *tk, * This function should only be called by rtc_resume(), and allows * a suspend offset to be injected into the timekeeping values. */ -void timekeeping_inject_sleeptime(struct timespec *delta) +void timekeeping_inject_sleeptime64(struct timespec64 *delta) { struct timekeeper *tk = &tk_core.timekeeper; - struct timespec64 tmp; unsigned long flags; /* @@ -1094,8 +1093,7 @@ void timekeeping_inject_sleeptime(struct timespec *delta) timekeeping_forward_now(tk); - tmp = timespec_to_timespec64(*delta); - __timekeeping_inject_sleeptime(tk, &tmp); + __timekeeping_inject_sleeptime(tk, delta); timekeeping_update(tk, TK_CLEAR_NTP | TK_MIRROR | TK_CLOCK_WAS_SET);