[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v6 04/12] target/riscv/cpu.c: del DEFINE_PROP_END_OF_LIST() from
From: |
Daniel Henrique Barboza |
Subject: |
[PATCH v6 04/12] target/riscv/cpu.c: del DEFINE_PROP_END_OF_LIST() from riscv_cpu_extensions |
Date: |
Thu, 27 Jul 2023 19:09:19 -0300 |
This last blank element is used by the 'for' loop to check if a property
has a valid name.
Remove it and use ARRAY_SIZE() instead like riscv_cpu_options is already
using. All future arrays will also do the same and we'll able to
encapsulate more repetitions in macros later on.
Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Reviewed-by: Weiwei Li <liweiwei@iscas.ac.cn>
---
target/riscv/cpu.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
index f1a292d967..33a2e9328c 100644
--- a/target/riscv/cpu.c
+++ b/target/riscv/cpu.c
@@ -1842,8 +1842,6 @@ static Property riscv_cpu_extensions[] = {
DEFINE_PROP_BOOL("x-zfbfmin", RISCVCPU, cfg.ext_zfbfmin, false),
DEFINE_PROP_BOOL("x-zvfbfmin", RISCVCPU, cfg.ext_zvfbfmin, false),
DEFINE_PROP_BOOL("x-zvfbfwma", RISCVCPU, cfg.ext_zvfbfwma, false),
-
- DEFINE_PROP_END_OF_LIST(),
};
static Property riscv_cpu_options[] = {
@@ -1901,14 +1899,13 @@ static void riscv_cpu_add_kvm_unavail_prop(Object *obj,
const char *prop_name)
static void riscv_cpu_add_kvm_properties(Object *obj)
{
- Property *prop;
DeviceState *dev = DEVICE(obj);
kvm_riscv_init_user_properties(obj);
riscv_cpu_add_misa_properties(obj);
- for (prop = riscv_cpu_extensions; prop && prop->name; prop++) {
- riscv_cpu_add_kvm_unavail_prop(obj, prop->name);
+ for (int i = 0; i < ARRAY_SIZE(riscv_cpu_extensions); i++) {
+ riscv_cpu_add_kvm_unavail_prop(obj, riscv_cpu_extensions[i].name);
}
for (int i = 0; i < ARRAY_SIZE(riscv_cpu_options); i++) {
@@ -1929,7 +1926,6 @@ static void riscv_cpu_add_kvm_properties(Object *obj)
*/
static void riscv_cpu_add_user_properties(Object *obj)
{
- Property *prop;
DeviceState *dev = DEVICE(obj);
#ifndef CONFIG_USER_ONLY
@@ -1943,8 +1939,8 @@ static void riscv_cpu_add_user_properties(Object *obj)
riscv_cpu_add_misa_properties(obj);
- for (prop = riscv_cpu_extensions; prop && prop->name; prop++) {
- qdev_property_add_static(dev, prop);
+ for (int i = 0; i < ARRAY_SIZE(riscv_cpu_extensions); i++) {
+ qdev_property_add_static(dev, &riscv_cpu_extensions[i]);
}
for (int i = 0; i < ARRAY_SIZE(riscv_cpu_options); i++) {
--
2.41.0
- [PATCH v6 00/12] riscv: add 'max' CPU, deprecate 'any', Daniel Henrique Barboza, 2023/07/27
- [PATCH v6 01/12] target/riscv/cpu.c: split CPU options from riscv_cpu_extensions[], Daniel Henrique Barboza, 2023/07/27
- [PATCH v6 02/12] target/riscv/cpu.c: skip 'bool' check when filtering KVM props, Daniel Henrique Barboza, 2023/07/27
- [PATCH v6 03/12] target/riscv/cpu.c: split kvm prop handling to its own helper, Daniel Henrique Barboza, 2023/07/27
- [PATCH v6 04/12] target/riscv/cpu.c: del DEFINE_PROP_END_OF_LIST() from riscv_cpu_extensions,
Daniel Henrique Barboza <=
- [PATCH v6 05/12] target/riscv/cpu.c: split vendor exts from riscv_cpu_extensions[], Daniel Henrique Barboza, 2023/07/27
- [PATCH v6 06/12] target/riscv/cpu.c: split non-ratified exts from riscv_cpu_extensions[], Daniel Henrique Barboza, 2023/07/27
- [PATCH v6 07/12] target/riscv/cpu.c: add ADD_CPU_QDEV_PROPERTIES_ARRAY() macro, Daniel Henrique Barboza, 2023/07/27
- [PATCH v6 08/12] target/riscv/cpu.c: add ADD_UNAVAIL_KVM_PROP_ARRAY() macro, Daniel Henrique Barboza, 2023/07/27
- [PATCH v6 09/12] target/riscv/cpu.c: limit cfg->vext_spec log message, Daniel Henrique Barboza, 2023/07/27
- [PATCH v6 10/12] target/riscv: add 'max' CPU type, Daniel Henrique Barboza, 2023/07/27
- [PATCH v6 11/12] avocado, risc-v: add opensbi tests for 'max' CPU, Daniel Henrique Barboza, 2023/07/27
- [PATCH v6 12/12] target/riscv: deprecate the 'any' CPU type, Daniel Henrique Barboza, 2023/07/27