From patchwork Mon May 11 11:12:14 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "\(Exiting\) Baolin Wang" X-Patchwork-Id: 48238 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 C044621550 for ; Mon, 11 May 2015 11:12:34 +0000 (UTC) Received: by wiz9 with SMTP id 9sf9142909wiz.3 for ; Mon, 11 May 2015 04:12:34 -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:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=9bHa57gRudCIafh2Lxxbz+AfzQn95AXtak9bSVeHB3U=; b=f+40tonjVNsef8dTFko7q/Uo0RGvXiU2nTPjcNgQ5nPCQQ/B9DmdidT7WZZR2iO9LN Ya1mS3o/gZ8oMSOqX2MPimDeFtWJx+1Hwf1Fj5GeZl654eocks6VH8tGhAhgeM9iSnLW tdNH4sSysKXI0N9pUTKkmEK9PbuBbBHjSU0p3ybTg2i0SCOY91KVYYhu+WQYeS2Dyrnh MMBqsofuJkcLpoa6QXgDbBQEZ/TjWZq87Zrvz1bAgRQl0x8OwH7YMeooGYm0hqv8j5Q7 +Sm6OgsULQzBRIEypELJ1Na7Q6X6XB6hLibZKtYW5ocRNzNEmgNvm7zy/9Hjo5tCRv4Y +CAw== X-Gm-Message-State: ALoCoQncCHZtt14GD1Boj5LbR9HQUPVmkjplMI7t98xpnWWi9V5aPqnStqRdr0eIx2qVbEhaDzYz X-Received: by 10.180.97.9 with SMTP id dw9mr7303856wib.2.1431342754062; Mon, 11 May 2015 04:12:34 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.178.195 with SMTP id da3ls621478lac.43.gmail; Mon, 11 May 2015 04:12:33 -0700 (PDT) X-Received: by 10.152.115.173 with SMTP id jp13mr7558093lab.119.1431342753871; Mon, 11 May 2015 04:12:33 -0700 (PDT) Received: from mail-la0-f42.google.com (mail-la0-f42.google.com. [209.85.215.42]) by mx.google.com with ESMTPS id pa8si8173237lbb.88.2015.05.11.04.12.33 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 May 2015 04:12:33 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.42 as permitted sender) client-ip=209.85.215.42; Received: by labbd9 with SMTP id bd9so90667912lab.2 for ; Mon, 11 May 2015 04:12:33 -0700 (PDT) X-Received: by 10.153.6.36 with SMTP id cr4mr7903275lad.56.1431342753739; Mon, 11 May 2015 04:12:33 -0700 (PDT) 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.108.230 with SMTP id hn6csp1441341lbb; Mon, 11 May 2015 04:12:32 -0700 (PDT) X-Received: by 10.70.127.171 with SMTP id nh11mr18187903pdb.142.1431342752688; Mon, 11 May 2015 04:12:32 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ii3si5476958pbb.205.2015.05.11.04.12.31; Mon, 11 May 2015 04:12:32 -0700 (PDT) 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 S1753816AbbEKLM1 (ORCPT + 28 others); Mon, 11 May 2015 07:12:27 -0400 Received: from mail-pd0-f174.google.com ([209.85.192.174]:35857 "EHLO mail-pd0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751647AbbEKLMX (ORCPT ); Mon, 11 May 2015 07:12:23 -0400 Received: by pdea3 with SMTP id a3so145634503pde.3 for ; Mon, 11 May 2015 04:12:22 -0700 (PDT) X-Received: by 10.66.119.239 with SMTP id kx15mr18637923pab.156.1431342742636; Mon, 11 May 2015 04:12:22 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([175.111.195.49]) by mx.google.com with ESMTPSA id xv9sm12797613pbc.2.2015.05.11.04.12.19 (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 11 May 2015 04:12:22 -0700 (PDT) From: Baolin Wang To: tglx@linutronix.de Cc: arnd@arndb.de, john.stultz@linaro.org, heenasirwani@gmail.com, pang.xunlei@linaro.org, linux-kernel@vger.kernel.org, baolin.wang@linaro.org, y2038@lists.linaro.org Subject: [PATCH v3 02/22] timekeeping:Introduce the current_kernel_time64() function with timespec64 type Date: Mon, 11 May 2015 19:12:14 +0800 Message-Id: <1431342734-29444-1-git-send-email-baolin.wang@linaro.org> X-Mailer: git-send-email 1.7.9.5 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: baolin.wang@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.42 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: , This patch adds current_kernel_time64() function with timespec64 type, and makes current_kernel_time() 'static inline' and moves it to timekeeping.h file. It is convenient for user to get the current kernel time with timespec64 type, and delete the current_kernel_time() function easily in timekeeping.h file. That is ready for 2038 when get the current time. Signed-off-by: Baolin Wang --- include/linux/timekeeping.h | 10 +++++++++- kernel/time/timekeeping.c | 6 +++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h index 3eaae47..c6d5ae9 100644 --- a/include/linux/timekeeping.h +++ b/include/linux/timekeeping.h @@ -18,10 +18,18 @@ 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; + + 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 91db941..8ccc02c 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -1721,7 +1721,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; @@ -1733,9 +1733,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) {