qemu-arm
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v4 02/33] hw/cpu: Call object_class_is_abstract() once in cpu


From: Richard Henderson
Subject: Re: [PATCH v4 02/33] hw/cpu: Call object_class_is_abstract() once in cpu_class_by_name()
Date: Wed, 1 Nov 2023 20:46:51 -0700
User-agent: Mozilla Thunderbird

On 11/1/23 17:24, Gavin Shan wrote:
From: Philippe Mathieu-Daudé <philmd@linaro.org>

Let CPUClass::class_by_name() handlers to return abstract classes,
and filter them once in the public cpu_class_by_name() method.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Gavin Shan <gshan@redhat.com>
---


@@ -150,9 +150,15 @@ static bool cpu_common_has_work(CPUState *cs)
  ObjectClass *cpu_class_by_name(const char *typename, const char *cpu_model)
  {
      CPUClass *cc = CPU_CLASS(object_class_by_name(typename));
+    ObjectClass *oc;
assert(cpu_model && cc->class_by_name);
-    return cc->class_by_name(cpu_model);
+    oc = cc->class_by_name(cpu_model);
+    if (oc && !object_class_is_abstract(oc)) {
+        return oc;
+    }
+
+    return NULL;
  }

I wonder if cpu_model_by_name wouldn't be a better name at this point?
Anyway,

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~



reply via email to

[Prev in Thread] Current Thread [Next in Thread]