All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [Patch] Simplify cpu_can_run()
@ 2010-04-12  6:24 Jun Koi
  2010-04-12  7:03 ` [Qemu-devel] " Paolo Bonzini
  0 siblings, 1 reply; 2+ messages in thread
From: Jun Koi @ 2010-04-12  6:24 UTC (permalink / raw)
  To: qemu-devel

This patch simplifies cpu_can_run().

Signed-off-by: Jun Koi <junkoi2004@gmail.com>


diff --git a/cpus.c b/cpus.c
index 0debe77..4adb66d 100644
--- a/cpus.c
+++ b/cpus.c
@@ -98,9 +98,7 @@ static void do_vm_stop(int reason)

 static int cpu_can_run(CPUState *env)
 {
-    if (env->stop)
-        return 0;
-    if (env->stopped || !vm_running)
+    if (env->stop || env->stopped || !vm_running)
         return 0;
     return 1;
 }

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [Qemu-devel] Re: [Patch] Simplify cpu_can_run()
  2010-04-12  6:24 [Qemu-devel] [Patch] Simplify cpu_can_run() Jun Koi
@ 2010-04-12  7:03 ` Paolo Bonzini
  0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2010-04-12  7:03 UTC (permalink / raw)
  To: Jun Koi; +Cc: qemu-devel

On 04/12/2010 08:24 AM, Jun Koi wrote:
> diff --git a/cpus.c b/cpus.c
> index 0debe77..4adb66d 100644
> --- a/cpus.c
> +++ b/cpus.c
> @@ -98,9 +98,7 @@ static void do_vm_stop(int reason)
>
>   static int cpu_can_run(CPUState *env)
>   {
> -    if (env->stop)
> -        return 0;
> -    if (env->stopped || !vm_running)
> +    if (env->stop || env->stopped || !vm_running)
>           return 0;
>       return 1;
>   }

I left it this way on purpose to help comparison with cpu_has_work.


static int cpu_can_run(CPUState *env)
{
     if (env->stop)
         return 0;
     if (env->stopped || !vm_running)
         return 0;
     return 1;
}

static int cpu_has_work(CPUState *env)
{
     if (env->stop)
         return 1;
     if (env->stopped || !vm_running)
         return 0;

Paolo

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-04-12  7:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-12  6:24 [Qemu-devel] [Patch] Simplify cpu_can_run() Jun Koi
2010-04-12  7:03 ` [Qemu-devel] " Paolo Bonzini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.