Skip to contentSkip to conversation

kvm: reduce code duplication in config_iothread

PATCH Applied Amit Shah 2 participants 2 messages Feb 4, 2010 – Feb 10, 2010

lore
Share & tools
lore

Amit Shah

author
#0 lore raw

PATCH 1/1 kvm: reduce code duplication in config_iothread

We have some duplicated code in the CONFIG_IOTHREAD #ifdef and #else cases. Fix that.

---
 kvm-all.c |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)
kvm-all.c +3 -6
index 15ec38e..a2bd78e 100644
@@ -901,14 +901,11 @@ void kvm_setup_guest_memory(void *start, size_t size)
 static void on_vcpu(CPUState *env, void (*func)(void *data), void *data)
 {
 #ifdef CONFIG_IOTHREAD
-    if (env == cpu_single_env) {
-        func(data);
-        return;
+    if (env != cpu_single_env) {
+        abort();
     }
-    abort();
-#else
-    func(data);
 #endif
+    func(data);
 }
 
 struct kvm_sw_breakpoint *kvm_find_sw_breakpoint(CPUState *env,
Signature · 1 line
1.6.2.5
#1 lore raw
Quoted 5 lines · Amit Shah

We have some duplicated code in the CONFIG_IOTHREAD #ifdef and #else cases. Fix that.

Applied. Thanks.

Regards,

Anthony Liguori

Quoted 27 lines
---
  kvm-all.c |    9 +++------
  1 files changed, 3 insertions(+), 6 deletions(-)
kvm-all.c +3 -6
index 15ec38e..a2bd78e 100644
@@ -901,14 +901,11 @@ void kvm_setup_guest_memory(void *start, size_t size)
  static void on_vcpu(CPUState *env, void (*func)(void *data), void *data)
  {
  #ifdef CONFIG_IOTHREAD
-    if (env == cpu_single_env) {
-        func(data);
-        return;
+    if (env != cpu_single_env) {
+        abort();
      }
-    abort();
-#else
-    func(data);
  #endif
+    func(data);
  }
 
  struct kvm_sw_breakpoint *kvm_find_sw_breakpoint(CPUState *env,