qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jia Liu <proljc@gmail.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 4/4] target-openrisc: Fix cpu_model by name
Date: Tue, 16 Jul 2013 10:00:29 +0800	[thread overview]
Message-ID: <1373940029-7455-5-git-send-email-proljc@gmail.com> (raw)
In-Reply-To: <1373940029-7455-1-git-send-email-proljc@gmail.com>

Fix cpu_model by name, make any and or1200 works both OK.

Signed-off-by: Jia Liu <proljc@gmail.com>
---
 target-openrisc/cpu.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/target-openrisc/cpu.c b/target-openrisc/cpu.c
index e348df0..6637166 100644
--- a/target-openrisc/cpu.c
+++ b/target-openrisc/cpu.c
@@ -100,11 +100,19 @@ static ObjectClass *openrisc_cpu_class_by_name(const char *cpu_model)
     typename = g_strdup_printf("%s-" TYPE_OPENRISC_CPU, cpu_model);
     oc = object_class_by_name(typename);
     g_free(typename);
-    if (oc != NULL && (!object_class_dynamic_cast(oc, TYPE_OPENRISC_CPU) ||
-                       object_class_is_abstract(oc))) {
-        return NULL;
+
+    if (oc != NULL && object_class_dynamic_cast(oc, TYPE_OPENRISC_CPU) != NULL
+        && !object_class_is_abstract(oc)) {
+        return oc;
     }
-    return oc;
+
+    oc = object_class_by_name(cpu_model);
+    if (oc != NULL && object_class_dynamic_cast(oc, TYPE_OPENRISC_CPU) != NULL
+        && !object_class_is_abstract(oc)) {
+        return oc;
+    }
+
+    return NULL;
 }
 
 static void or1200_initfn(Object *obj)
-- 
1.7.12.4 (Apple Git-37)

  parent reply	other threads:[~2013-07-16  2:03 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-16  2:00 [Qemu-devel] [PATCH V2 0/4] target-openrisc hw/openrisc: Some OpenRISC fix Jia Liu
2013-07-16  2:00 ` [Qemu-devel] [PATCH V2 1/4] hw/openrisc: Indent typo Jia Liu
2013-07-16  2:00 ` [Qemu-devel] [PATCH V2 2/4] hw/openrisc: Use stderr output instead of qemu_log Jia Liu
2013-07-16  2:00 ` [Qemu-devel] [PATCH 3/4] target-openrisc: Free typename Jia Liu
2013-07-16  2:05   ` Jia Liu
2013-07-16 14:19   ` Andreas Färber
2013-07-17  1:34     ` Jia Liu
2013-07-16  2:00 ` Jia Liu [this message]
2013-07-16  2:06   ` [Qemu-devel] [PATCH 4/4] target-openrisc: Fix cpu_model by name Jia Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1373940029-7455-5-git-send-email-proljc@gmail.com \
    --to=proljc@gmail.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).