All of lore.kernel.org
 help / color / mirror / Atom feed
* kdbus: avoid the use of struct timespec
@ 2015-04-10 11:43 Arnd Bergmann
  2015-04-10 12:35 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2015-04-10 11:43 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Daniel Mack, David Herrmann, Djalal Harouni, linux-kernel

I did a routine check for new users of 'timespec', which we are trying to remove
from the kernel in order to survive y2038. kdbus came up and looks particularly
trivial to clean up.

This changes the three ktime_get_ts() variants used in kdbus to ktime_get_ns(),
which aside from removing timespec also simplifies the code and makes it
slightly more efficient by avoiding a two-way conversion.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>

diff --git a/ipc/kdbus/metadata.c b/ipc/kdbus/metadata.c
index 06e0a54a276a..3adc6c2c2e76 100644
--- a/ipc/kdbus/metadata.c
+++ b/ipc/kdbus/metadata.c
@@ -678,13 +678,8 @@ struct kdbus_meta_conn *kdbus_meta_conn_unref(struct kdbus_meta_conn *mc)
 static void kdbus_meta_conn_collect_timestamp(struct kdbus_meta_conn *mc,
 					      struct kdbus_kmsg *kmsg)
 {
-	struct timespec ts;
-
-	ktime_get_ts(&ts);
-	mc->ts.monotonic_ns = timespec_to_ns(&ts);
-
-	ktime_get_real_ts(&ts);
-	mc->ts.realtime_ns = timespec_to_ns(&ts);
+	mc->ts.monotonic_ns = ktime_get_ns();
+	mc->ts.realtime_ns = ktime_get_real_ns();
 
 	if (kmsg)
 		mc->ts.seqnum = kmsg->seq;
diff --git a/ipc/kdbus/reply.c b/ipc/kdbus/reply.c
index 6b3bd81bbb4d..008dca801627 100644
--- a/ipc/kdbus/reply.c
+++ b/ipc/kdbus/reply.c
@@ -204,11 +204,9 @@ void kdbus_reply_list_scan_work(struct work_struct *work)
 		container_of(work, struct kdbus_conn, work.work);
 	struct kdbus_reply *reply, *reply_tmp;
 	u64 deadline = ~0ULL;
-	struct timespec64 ts;
 	u64 now;
 
-	ktime_get_ts64(&ts);
-	now = timespec64_to_ns(&ts);
+	now = ktime_get_ns();
 
 	mutex_lock(&conn->lock);
 	if (!kdbus_conn_active(conn)) {


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: kdbus: avoid the use of struct timespec
  2015-04-10 11:43 kdbus: avoid the use of struct timespec Arnd Bergmann
@ 2015-04-10 12:35 ` Greg Kroah-Hartman
  0 siblings, 0 replies; 2+ messages in thread
From: Greg Kroah-Hartman @ 2015-04-10 12:35 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: Daniel Mack, David Herrmann, Djalal Harouni, linux-kernel

On Fri, Apr 10, 2015 at 01:43:37PM +0200, Arnd Bergmann wrote:
> I did a routine check for new users of 'timespec', which we are trying to remove
> from the kernel in order to survive y2038. kdbus came up and looks particularly
> trivial to clean up.
> 
> This changes the three ktime_get_ts() variants used in kdbus to ktime_get_ns(),
> which aside from removing timespec also simplifies the code and makes it
> slightly more efficient by avoiding a two-way conversion.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Applied, thanks.

greg k-h

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-04-10 12:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-10 11:43 kdbus: avoid the use of struct timespec Arnd Bergmann
2015-04-10 12:35 ` Greg Kroah-Hartman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.