From: Anatol Pomozov <anatol.pomozov@gmail.com>
To: marc.zyngier@arm.com, mark.rutland@arm.com
Cc: lorenzo.pieralisi@arm.com, linux-kernel@vger.kernel.org,
Anatol Pomozov <anatol.pomozov@gmail.com>
Subject: [PATCH] arm64: kernel: Copy register_persistent_clock() to arm64 source subtree
Date: Thu, 6 Nov 2014 16:21:05 -0800 [thread overview]
Message-ID: <1415319665-21701-1-git-send-email-anatol.pomozov@gmail.com> (raw)
This allows to port code that needs register_persistent_clock() to arm64
Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com>
---
arch/arm64/include/asm/time.h | 17 +++++++++++++++++
arch/arm64/kernel/time.c | 37 +++++++++++++++++++++++++++++++++++++
2 files changed, 54 insertions(+)
create mode 100644 arch/arm64/include/asm/time.h
diff --git a/arch/arm64/include/asm/time.h b/arch/arm64/include/asm/time.h
new file mode 100644
index 0000000..28015b8
--- /dev/null
+++ b/arch/arm64/include/asm/time.h
@@ -0,0 +1,17 @@
+/*
+ * Copyright (C) 2004 MontaVista Software, Inc.
+ * Copyright (C) 2014 The Chromium OS Authors.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#ifndef __ASM_TIME_H
+#define __ASM_TIME_H
+
+struct timespec;
+typedef void (*clock_access_fn)(struct timespec *);
+extern int register_persistent_clock(clock_access_fn read_boot,
+ clock_access_fn read_persistent);
+
+#endif
diff --git a/arch/arm64/kernel/time.c b/arch/arm64/kernel/time.c
index 1a7125c..71a907e 100644
--- a/arch/arm64/kernel/time.c
+++ b/arch/arm64/kernel/time.c
@@ -40,6 +40,7 @@
#include <asm/thread_info.h>
#include <asm/stacktrace.h>
+#include <asm/time.h>
#ifdef CONFIG_SMP
unsigned long profile_pc(struct pt_regs *regs)
@@ -79,3 +80,39 @@ void __init time_init(void)
/* Calibrate the delay loop directly */
lpj_fine = arch_timer_rate / HZ;
}
+
+static void dummy_clock_access(struct timespec *ts)
+{
+ ts->tv_sec = 0;
+ ts->tv_nsec = 0;
+}
+
+static clock_access_fn __read_persistent_clock = dummy_clock_access;
+static clock_access_fn __read_boot_clock = dummy_clock_access;
+
+void read_persistent_clock(struct timespec *ts)
+{
+ __read_persistent_clock(ts);
+}
+
+void read_boot_clock(struct timespec *ts)
+{
+ __read_boot_clock(ts);
+}
+
+int __init register_persistent_clock(clock_access_fn read_boot,
+ clock_access_fn read_persistent)
+{
+ /* Only allow the clockaccess functions to be registered once */
+ if (__read_persistent_clock == dummy_clock_access &&
+ __read_boot_clock == dummy_clock_access) {
+ if (read_boot)
+ __read_boot_clock = read_boot;
+ if (read_persistent)
+ __read_persistent_clock = read_persistent;
+
+ return 0;
+ }
+
+ return -EINVAL;
+}
--
2.1.0.rc2.206.gedb03e5
next reply other threads:[~2014-11-07 0:21 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-07 0:21 Anatol Pomozov [this message]
2014-11-07 0:25 ` Anatol Pomozov
2014-11-07 4:16 ` Stephen Warren
2014-11-07 10:40 ` Mark Rutland
2014-11-07 16:24 ` Anatol Pomozov
2014-11-07 16:38 ` Mark Rutland
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=1415319665-21701-1-git-send-email-anatol.pomozov@gmail.com \
--to=anatol.pomozov@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lorenzo.pieralisi@arm.com \
--cc=marc.zyngier@arm.com \
--cc=mark.rutland@arm.com \
/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®