Move kvm_sched_clock_init() "down" so that it can reference the global
kvm_clock structure without needing a forward declaration.

Opportunistically mark the helper as "__init" instead of "inline" to make
its usage more obvious; modern compilers don't need a hint to inline a
single-use function, and an extra CALL+RET pair during boot is a complete
non-issue.  And, if the compiler ignores the hint and does NOT inline the
function, the resulting code may not get discarded after boot due lack of
an __init annotation.

No functional change intended.

Signed-off-by: Sean Christopherson <sea...@google.com>
---
 arch/x86/kernel/kvmclock.c | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/arch/x86/kernel/kvmclock.c b/arch/x86/kernel/kvmclock.c
index 1ad3878cc1d9..934ee4a4c6d4 100644
--- a/arch/x86/kernel/kvmclock.c
+++ b/arch/x86/kernel/kvmclock.c
@@ -133,19 +133,6 @@ static void kvm_restore_sched_clock_state(void)
        kvm_register_clock("primary cpu clock, resume");
 }
 
-static inline void kvm_sched_clock_init(bool stable)
-{
-       kvm_sched_clock_offset = kvm_clock_read();
-       __paravirt_set_sched_clock(kvm_sched_clock_read, stable,
-                                  kvm_save_sched_clock_state, 
kvm_restore_sched_clock_state);
-
-       pr_info("kvm-clock: using sched offset of %llu cycles",
-               kvm_sched_clock_offset);
-
-       BUILD_BUG_ON(sizeof(kvm_sched_clock_offset) >
-               sizeof(((struct pvclock_vcpu_time_info *)NULL)->system_time));
-}
-
 void kvmclock_cpu_action(enum kvm_guest_cpu_action action)
 {
        /*
@@ -302,6 +289,19 @@ static int kvmclock_setup_percpu(unsigned int cpu)
        return p ? 0 : -ENOMEM;
 }
 
+static void __init kvm_sched_clock_init(bool stable)
+{
+       kvm_sched_clock_offset = kvm_clock_read();
+       __paravirt_set_sched_clock(kvm_sched_clock_read, stable,
+                                  kvm_save_sched_clock_state, 
kvm_restore_sched_clock_state);
+
+       pr_info("kvm-clock: using sched offset of %llu cycles",
+               kvm_sched_clock_offset);
+
+       BUILD_BUG_ON(sizeof(kvm_sched_clock_offset) >
+               sizeof(((struct pvclock_vcpu_time_info *)NULL)->system_time));
+}
+
 void __init kvmclock_init(void)
 {
        u8 flags;
-- 
2.48.1.711.g2feabab25a-goog


Reply via email to