From patchwork Mon Aug 17 20:41:00 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 52482 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f198.google.com (mail-lb0-f198.google.com [209.85.217.198]) by patches.linaro.org (Postfix) with ESMTPS id 8F8A42156D for ; Mon, 17 Aug 2015 20:41:31 +0000 (UTC) Received: by lbck9 with SMTP id k9sf49285492lbc.0 for ; Mon, 17 Aug 2015 13:41:30 -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:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=0R0O/c6bWLHbsEQ6gHQC6zQLPUpQvYK/r8YX6Fmxbi0=; b=m+jJg7gImE/Z3Kb5WrIpLSkq2p8xKLv3C4hJJ4CTwERxhjVaQFU3qjRE7pe1dHQb04 8M48hYbMETaaVLOr3+sIUUzRQ7ZpirT5mnPk95AnMRUPmOLTj78kMDwmYG6xF7x7XR1g 8YXCPe7eerxFczBAp2Sa7J+4qTRic5YQJCkWZfF94p8C8HG5JpIvzYfyQInOoWUHyIiy GCOAauWF8aBKCff518C2qQaDm8NeQ2kvlgSzDoKaYy0ss9jqsoNOPmNqxtKXpmuhTqnr gO947SXvT7aoiL6FrSVQ6QmiaZ9RStYFw9g4ZZizrVtvGPHktCzPHsUGY7DUsa9m0l/u WRHw== X-Gm-Message-State: ALoCoQn0bBYeuWHFmdTCtDnoy5NfV6SqM0kI3mcX7cMyN3eKFwHqru8ZC/X8UkKR2WPk1jWrOYby X-Received: by 10.180.75.49 with SMTP id z17mr5292755wiv.7.1439844090592; Mon, 17 Aug 2015 13:41:30 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.207.38 with SMTP id lt6ls687167lac.50.gmail; Mon, 17 Aug 2015 13:41:30 -0700 (PDT) X-Received: by 10.152.44.196 with SMTP id g4mr2660932lam.56.1439844090309; Mon, 17 Aug 2015 13:41:30 -0700 (PDT) Received: from mail-la0-f47.google.com (mail-la0-f47.google.com. [209.85.215.47]) by mx.google.com with ESMTPS id bw10si12367608lbc.114.2015.08.17.13.41.30 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 17 Aug 2015 13:41:30 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.47 as permitted sender) client-ip=209.85.215.47; Received: by lahi9 with SMTP id i9so86454981lah.2 for ; Mon, 17 Aug 2015 13:41:30 -0700 (PDT) X-Received: by 10.112.160.42 with SMTP id xh10mr2647794lbb.88.1439844090204; Mon, 17 Aug 2015 13:41:30 -0700 (PDT) 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.162.200 with SMTP id yc8csp85976lbb; Mon, 17 Aug 2015 13:41:29 -0700 (PDT) X-Received: by 10.66.139.193 with SMTP id ra1mr5915327pab.131.1439844077124; Mon, 17 Aug 2015 13:41:17 -0700 (PDT) Received: from mail-pa0-f48.google.com (mail-pa0-f48.google.com. [209.85.220.48]) by mx.google.com with ESMTPS id ei1si26254244pbd.173.2015.08.17.13.41.16 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 17 Aug 2015 13:41:17 -0700 (PDT) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.48 as permitted sender) client-ip=209.85.220.48; Received: by pabyb7 with SMTP id yb7so115756778pab.0 for ; Mon, 17 Aug 2015 13:41:16 -0700 (PDT) X-Received: by 10.66.162.229 with SMTP id yd5mr6169351pab.102.1439844076215; Mon, 17 Aug 2015 13:41:16 -0700 (PDT) Received: from localhost.localdomain (c-76-115-103-22.hsd1.or.comcast.net. [76.115.103.22]) by smtp.gmail.com with ESMTPSA id gu2sm85199pbc.1.2015.08.17.13.41.14 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 17 Aug 2015 13:41:15 -0700 (PDT) From: John Stultz To: lkml Cc: Baolin Wang , Prarit Bhargava , Richard Cochran , Ingo Molnar , Thomas Gleixner , John Stultz Subject: [PATCH 6/9] time: Introduce current_kernel_time64() Date: Mon, 17 Aug 2015 13:41:00 -0700 Message-Id: <1439844063-7957-7-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1439844063-7957-1-git-send-email-john.stultz@linaro.org> References: <1439844063-7957-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.215.47 as permitted sender) smtp.mailfrom=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: Baolin Wang The current_kernel_time() is not year 2038 safe on 32bit systems since it returns a timespec value. Introduce current_kernel_time64() which returns a timespec64 value. Cc: Prarit Bhargava Cc: Richard Cochran Cc: Ingo Molnar Cc: Thomas Gleixner Signed-off-by: Baolin Wang Signed-off-by: John Stultz --- include/linux/timekeeping.h | 9 ++++++++- kernel/time/timekeeping.c | 6 +++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h index 3aa72e6..657ea03 100644 --- a/include/linux/timekeeping.h +++ b/include/linux/timekeeping.h @@ -18,10 +18,17 @@ extern int do_sys_settimeofday(const struct timespec *tv, * Kernel time accessors */ unsigned long get_seconds(void); -struct timespec current_kernel_time(void); +struct timespec64 current_kernel_time64(void); /* does not take xtime_lock */ struct timespec __current_kernel_time(void); +static inline struct timespec current_kernel_time(void) +{ + struct timespec64 now = current_kernel_time64(); + + return timespec64_to_timespec(now); +} + /* * timespec based interfaces */ diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index 4cdb771..f6ee2e6 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -1881,7 +1881,7 @@ struct timespec __current_kernel_time(void) return timespec64_to_timespec(tk_xtime(tk)); } -struct timespec current_kernel_time(void) +struct timespec64 current_kernel_time64(void) { struct timekeeper *tk = &tk_core.timekeeper; struct timespec64 now; @@ -1893,9 +1893,9 @@ struct timespec current_kernel_time(void) now = tk_xtime(tk); } while (read_seqcount_retry(&tk_core.seq, seq)); - return timespec64_to_timespec(now); + return now; } -EXPORT_SYMBOL(current_kernel_time); +EXPORT_SYMBOL(current_kernel_time64); struct timespec64 get_monotonic_coarse64(void) {