qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH v9 07/20] target/riscv/cpu.c: add riscv_cpu_add_qdev_prop_arr


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH v9 07/20] target/riscv/cpu.c: add riscv_cpu_add_qdev_prop_array()
Date: Mon, 4 Sep 2023 09:59:45 +0200
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.15.0

On 1/9/23 21:46, Daniel Henrique Barboza wrote:
The code inside riscv_cpu_add_user_properties() became quite repetitive
after recent changes. Add a helper to hide the repetition away.

Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
---
  target/riscv/cpu.c | 29 +++++++++++++----------------
  1 file changed, 13 insertions(+), 16 deletions(-)

diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
index 86d536f242..d484d63bcd 100644
--- a/target/riscv/cpu.c
+++ b/target/riscv/cpu.c
@@ -1951,6 +1951,15 @@ static void cpu_set_cfg_unavailable(Object *obj, Visitor 
*v,
  }
  #endif
+static void riscv_cpu_add_qdev_prop_array(DeviceState *dev, Property *array)
+{
+    g_assert(array);
+
+    for (Property *prop = array; prop && prop->name; prop++) {
+        qdev_property_add_static(dev, prop);
+    }
+}

Worth a qdev_property_add_static_array() in "hw/qdev-properties.h".

Please do if a v10 is requested, otherwise can be done later. In any
case:
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>



reply via email to

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