From: Baolin Wang <baolin.wang@linaro.org>
To: tglx@linutronix.de
Cc: arnd@arndb.de, john.stultz@linaro.org, ahh@google.com,
pjt@google.com, linux-kernel@vger.kernel.org,
baolin.wang@linaro.org, y2038@lists.linaro.org
Subject: [PATCH v2 12/15] time/time:Introduce the timespec64_to_jiffies/jiffies_to_timespec64 function
Date: Thu, 30 Apr 2015 16:20:02 +0800 [thread overview]
Message-ID: <1430382002-26666-1-git-send-email-baolin.wang@linaro.org> (raw)
This patch introduces the timespec64_to_jiffies() and jiffies_to_timespec64()
functions, that implement the conversion between cputime and timespec64. And
remove the old functions timespec64_to_jiffies()/jiffies_to_timespec64() to
jiffies.h file.
Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
---
include/linux/jiffies.h | 21 ++++++++++++++++++---
kernel/time/time.c | 12 ++++++------
2 files changed, 24 insertions(+), 9 deletions(-)
diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h
index c367cbd..16a30c1 100644
--- a/include/linux/jiffies.h
+++ b/include/linux/jiffies.h
@@ -290,9 +290,24 @@ static inline u64 jiffies_to_nsecs(const unsigned long j)
extern unsigned long msecs_to_jiffies(const unsigned int m);
extern unsigned long usecs_to_jiffies(const unsigned int u);
-extern unsigned long timespec_to_jiffies(const struct timespec *value);
-extern void jiffies_to_timespec(const unsigned long jiffies,
- struct timespec *value);
+extern unsigned long __timespec_to_jiffies(unsigned long sec, long nsec);
+extern unsigned long timespec64_to_jiffies(const struct timespec64 *value);
+extern void jiffies_to_timespec64(const unsigned long jiffies,
+ struct timespec64 *value);
+static inline unsigned long timespec_to_jiffies(const struct timespec *value)
+{
+ return __timespec_to_jiffies(value->tv_sec, value->tv_nsec);
+}
+
+static inline void jiffies_to_timespec(const unsigned long jiffies,
+ struct timespec *value)
+{
+ struct timespec64 *ts;
+
+ *ts = timespec_to_timespec64(*value);
+ jiffies_to_timespec64(jiffies, ts);
+}
+
extern unsigned long timeval_to_jiffies(const struct timeval *value);
extern void jiffies_to_timeval(const unsigned long jiffies,
struct timeval *value);
diff --git a/kernel/time/time.c b/kernel/time/time.c
index f43011b..3aba16f 100644
--- a/kernel/time/time.c
+++ b/kernel/time/time.c
@@ -571,7 +571,7 @@ EXPORT_SYMBOL(usecs_to_jiffies);
* The >> (NSEC_JIFFIE_SC - SEC_JIFFIE_SC) converts the scaled nsec
* value to a scaled second value.
*/
-static unsigned long
+unsigned long
__timespec_to_jiffies(unsigned long sec, long nsec)
{
nsec = nsec + TICK_NSEC - 1;
@@ -585,17 +585,17 @@ __timespec_to_jiffies(unsigned long sec, long nsec)
(NSEC_JIFFIE_SC - SEC_JIFFIE_SC))) >> SEC_JIFFIE_SC;
}
+EXPORT_SYMBOL(__timespec_to_jiffies);
unsigned long
-timespec_to_jiffies(const struct timespec *value)
+timespec64_to_jiffies(const struct timespec64 *value)
{
return __timespec_to_jiffies(value->tv_sec, value->tv_nsec);
}
-
-EXPORT_SYMBOL(timespec_to_jiffies);
+EXPORT_SYMBOL(timespec64_to_jiffies);
void
-jiffies_to_timespec(const unsigned long jiffies, struct timespec *value)
+jiffies_to_timespec64(const unsigned long jiffies, struct timespec64 *value)
{
/*
* Convert jiffies to nanoseconds and separate with
@@ -606,7 +606,7 @@ jiffies_to_timespec(const unsigned long jiffies, struct timespec *value)
NSEC_PER_SEC, &rem);
value->tv_nsec = rem;
}
-EXPORT_SYMBOL(jiffies_to_timespec);
+EXPORT_SYMBOL(jiffies_to_timespec64);
/*
* We could use a similar algorithm to timespec_to_jiffies (with a
--
1.7.9.5
reply other threads:[~2015-04-30 8:20 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1430382002-26666-1-git-send-email-baolin.wang@linaro.org \
--to=baolin.wang@linaro.org \
--cc=ahh@google.com \
--cc=arnd@arndb.de \
--cc=john.stultz@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pjt@google.com \
--cc=tglx@linutronix.de \
--cc=y2038@lists.linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®