From patchwork Fri Nov 21 19:44:11 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 41357 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f197.google.com (mail-lb0-f197.google.com [209.85.217.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7A19E2452C for ; Fri, 21 Nov 2014 19:44:44 +0000 (UTC) Received: by mail-lb0-f197.google.com with SMTP id b6sf3449975lbj.8 for ; Fri, 21 Nov 2014 11:44:43 -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:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=VaJnCv4uPF+NajZJ67OTT8sohYR0mfhVgmNsu/DjqSg=; b=GxSgvOGGt8sAqfNHTIn4XWTsegWFG86cWMAM2DUANyA6pyxjyK5aYwb+7Rie3jYx20 78m6GaHUwvNSeM5MFhJpPLCZnGnb9lKxxcCvniUvrNq535qwnhqUPcopq5I6M31Tzz0Q vpuacP2IHtnU0EbjYnKB9r5/uVZBwDRUyiDZPa5BWQ+4kD6z26al8T4LlY3xfpwoB7Jv wXxW2S8Ao5WpF5TxXmO2XUF2jdVjKOvfJon1LWz0PBfhtW5QLBl+VtkNRTmoB5yWnVnn MmS7H8fxtPY07iXl83KPFMTzB6vTWZjv/7SW93FCbRNraApd/a7Vs7c2y+2Qljr27wmO lBJw== X-Gm-Message-State: ALoCoQly/Q9M6RIVR3Q1Kfiw48JwVQHEAszJOxO3YgtWHKFvaxnWgX6BQxqjKKV1idjYk7jznCOa X-Received: by 10.112.89.195 with SMTP id bq3mr2142180lbb.9.1416599083411; Fri, 21 Nov 2014 11:44:43 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.153.11.131 with SMTP id ei3ls196813lad.106.gmail; Fri, 21 Nov 2014 11:44:43 -0800 (PST) X-Received: by 10.152.29.41 with SMTP id g9mr7333268lah.83.1416599083270; Fri, 21 Nov 2014 11:44:43 -0800 (PST) Received: from mail-lb0-f178.google.com (mail-lb0-f178.google.com. [209.85.217.178]) by mx.google.com with ESMTPS id o6si6958622lao.129.2014.11.21.11.44.43 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 21 Nov 2014 11:44:43 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.178 as permitted sender) client-ip=209.85.217.178; Received: by mail-lb0-f178.google.com with SMTP id f15so3513461lbj.9 for ; Fri, 21 Nov 2014 11:44:43 -0800 (PST) X-Received: by 10.152.37.69 with SMTP id w5mr7139144laj.67.1416599083066; Fri, 21 Nov 2014 11:44:43 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.112.184.201 with SMTP id ew9csp153730lbc; Fri, 21 Nov 2014 11:44:42 -0800 (PST) X-Received: by 10.66.140.8 with SMTP id rc8mr10270825pab.83.1416599080370; Fri, 21 Nov 2014 11:44:40 -0800 (PST) Received: from mail-pa0-f42.google.com (mail-pa0-f42.google.com. [209.85.220.42]) by mx.google.com with ESMTPS id s4si10402472pdj.117.2014.11.21.11.44.39 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 21 Nov 2014 11:44:40 -0800 (PST) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.42 as permitted sender) client-ip=209.85.220.42; Received: by mail-pa0-f42.google.com with SMTP id et14so5563439pad.1 for ; Fri, 21 Nov 2014 11:44:39 -0800 (PST) X-Received: by 10.66.119.105 with SMTP id kt9mr10019400pab.113.1416599079681; Fri, 21 Nov 2014 11:44:39 -0800 (PST) Received: from localhost.localdomain (c-67-170-153-23.hsd1.or.comcast.net. [67.170.153.23]) by mx.google.com with ESMTPSA id t9sm5513621pbs.75.2014.11.21.11.44.38 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 21 Nov 2014 11:44:39 -0800 (PST) From: John Stultz To: lkml Cc: "pang.xunlei" , Thomas Gleixner , Ingo Molnar , Arnd Bergmann , Miroslav Lichvar , Richard Cochran , Prarit Bhargava , Alessandro Zummo , John Stultz Subject: [PATCH 05/12] time: Provide y2038 safe timekeeping_inject_sleeptime() replacement Date: Fri, 21 Nov 2014 11:44:11 -0800 Message-Id: <1416599058-13836-6-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1416599058-13836-1-git-send-email-john.stultz@linaro.org> References: <1416599058-13836-1-git-send-email-john.stultz@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: john.stultz@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.178 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: "pang.xunlei" 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. Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Arnd Bergmann Cc: pang.xunlei Cc: Miroslav Lichvar Cc: Richard Cochran Cc: Prarit Bhargava Cc: Alessandro Zummo Signed-off-by: pang.xunlei Signed-off-by: John Stultz --- 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);