diff mbox series

[PULL,33/48] hyperv: make hyperv_vp_index inline

Message ID 1539894735-14232-34-git-send-email-pbonzini@redhat.com
State New
Headers show
Series [PULL,01/48] es1370: more fixes for ADC_FRAMEADR and ADC_FRAMECNT | expand

Commit Message

Paolo Bonzini Oct. 18, 2018, 8:32 p.m. UTC
From: Roman Kagan <rkagan@virtuozzo.com>

Also make the inverse function, hyperv_find_vcpu, static as it's not
used outside hyperv.c

This paves the way to making hyperv.c built optionally.

Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
Message-Id: <20180921082041.29380-3-rkagan@virtuozzo.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 target/i386/hyperv.c | 11 ++++-------
 target/i386/hyperv.h |  6 ++++--
 2 files changed, 8 insertions(+), 9 deletions(-)
diff mbox series

Patch

diff --git a/target/i386/hyperv.c b/target/i386/hyperv.c
index fc537e7..6881664 100644
--- a/target/i386/hyperv.c
+++ b/target/i386/hyperv.c
@@ -27,14 +27,11 @@  struct HvSintRoute {
     unsigned refcount;
 };
 
-uint32_t hyperv_vp_index(X86CPU *cpu)
+static X86CPU *hyperv_find_vcpu(uint32_t vp_index)
 {
-    return CPU(cpu)->cpu_index;
-}
-
-X86CPU *hyperv_find_vcpu(uint32_t vp_index)
-{
-    return X86_CPU(qemu_get_cpu(vp_index));
+    X86CPU *cpu = X86_CPU(qemu_get_cpu(vp_index));
+    assert(hyperv_vp_index(cpu) == vp_index);
+    return cpu;
 }
 
 int kvm_hv_handle_exit(X86CPU *cpu, struct kvm_hyperv_exit *exit)
diff --git a/target/i386/hyperv.h b/target/i386/hyperv.h
index 59e9f9a..8d4619c 100644
--- a/target/i386/hyperv.h
+++ b/target/i386/hyperv.h
@@ -30,7 +30,9 @@  void hyperv_sint_route_unref(HvSintRoute *sint_route);
 
 int hyperv_sint_route_set_sint(HvSintRoute *sint_route);
 
-uint32_t hyperv_vp_index(X86CPU *cpu);
-X86CPU *hyperv_find_vcpu(uint32_t vp_index);
+static inline uint32_t hyperv_vp_index(X86CPU *cpu)
+{
+    return CPU(cpu)->cpu_index;
+}
 
 #endif