Patchwork kvm: reduce code duplication in config_iothread

login
register
mail settings
Submitter Amit Shah
Date Feb. 4, 2010, 2:46 p.m.
Message ID <1265294782-28112-1-git-send-email-amit.shah@redhat.com>
Download mbox | patch
Permalink /patch/44502/
State New
Headers show

Comments

Amit Shah - Feb. 4, 2010, 2:46 p.m.
We have some duplicated code in the CONFIG_IOTHREAD #ifdef and #else
cases. Fix that.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
---
 kvm-all.c |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)
Anthony Liguori - Feb. 10, 2010, 7:28 p.m.
On 02/04/2010 08:46 AM, Amit Shah wrote:
> We have some duplicated code in the CONFIG_IOTHREAD #ifdef and #else
> cases. Fix that.
>
> Signed-off-by: Amit Shah<amit.shah@redhat.com>
>    

Applied.  Thanks.

Regards,

Anthony Liguori
> ---
>   kvm-all.c |    9 +++------
>   1 files changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/kvm-all.c b/kvm-all.c
> index 15ec38e..a2bd78e 100644
> --- a/kvm-all.c
> +++ b/kvm-all.c
> @@ -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,
>

Patch

diff --git a/kvm-all.c b/kvm-all.c
index 15ec38e..a2bd78e 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -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,