From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Subbaraya Sundeep" <sundeep.lkml@gmail.com>,
"Arnaud Minier" <arnaud.minier@telecom-paris.fr>,
"Igor Mammedov" <imammedo@redhat.com>,
"Laurent Vivier" <laurent@vivier.eu>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Tyrone Ting" <kfting@nuvoton.com>,
"Hao Wu" <wuhaotsh@google.com>,
"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
"Felipe Balbi" <balbi@kernel.org>,
qemu-arm@nongnu.org, "Inès Varhol" <ines.varhol@telecom-paris.fr>,
"Alistair Francis" <alistair@alistair23.me>,
"Yanan Wang" <wangyanan55@huawei.com>,
"Richard Henderson" <richard.henderson@linaro.org>,
"Eduardo Habkost" <eduardo@habkost.net>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Helge Deller" <deller@gmx.de>,
"Subbaraya Sundeep" <sbhatta@marvell.com>,
"Alexandre Iooss" <erdnaxe@crans.org>,
"Gavin Shan" <gshan@redhat.com>
Subject: [PATCH-for-8.2? v2 1/4] hw/core/machine: Constify MachineClass::valid_cpu_types[]
Date: Fri, 17 Nov 2023 08:17:01 +0100 [thread overview]
Message-ID: <20231117071704.35040-2-philmd@linaro.org> (raw)
In-Reply-To: <20231117071704.35040-1-philmd@linaro.org>
From: Gavin Shan <gshan@redhat.com>
Constify MachineClass::valid_cpu_types[i], as suggested by Richard
Henderson.
Suggested-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Gavin Shan <gshan@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
[PMD: Constify HPPA machines,
restrict valid_cpu_types to machine_class_init() handlers]
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
include/hw/boards.h | 2 +-
hw/hppa/machine.c | 22 ++++++++++------------
hw/m68k/q800.c | 11 +++++------
3 files changed, 16 insertions(+), 19 deletions(-)
diff --git a/include/hw/boards.h b/include/hw/boards.h
index a735999298..da85f86efb 100644
--- a/include/hw/boards.h
+++ b/include/hw/boards.h
@@ -273,7 +273,7 @@ struct MachineClass {
bool has_hotpluggable_cpus;
bool ignore_memory_transaction_failures;
int numa_mem_align_shift;
- const char **valid_cpu_types;
+ const char * const *valid_cpu_types;
strList *allowed_dynamic_sysbus_devices;
bool auto_enable_numa_with_memhp;
bool auto_enable_numa_with_memdev;
diff --git a/hw/hppa/machine.c b/hw/hppa/machine.c
index 9d08f39490..c8da7c18d5 100644
--- a/hw/hppa/machine.c
+++ b/hw/hppa/machine.c
@@ -672,19 +672,18 @@ static void hppa_nmi(NMIState *n, int cpu_index, Error **errp)
}
}
-static const char *HP_B160L_machine_valid_cpu_types[] = {
- TYPE_HPPA_CPU,
- NULL
-};
-
static void HP_B160L_machine_init_class_init(ObjectClass *oc, void *data)
{
+ static const char * const valid_cpu_types[] = {
+ TYPE_HPPA_CPU,
+ NULL
+ };
MachineClass *mc = MACHINE_CLASS(oc);
NMIClass *nc = NMI_CLASS(oc);
mc->desc = "HP B160L workstation";
mc->default_cpu_type = TYPE_HPPA_CPU;
- mc->valid_cpu_types = HP_B160L_machine_valid_cpu_types;
+ mc->valid_cpu_types = valid_cpu_types;
mc->init = machine_HP_B160L_init;
mc->reset = hppa_machine_reset;
mc->block_default_type = IF_SCSI;
@@ -709,19 +708,18 @@ static const TypeInfo HP_B160L_machine_init_typeinfo = {
},
};
-static const char *HP_C3700_machine_valid_cpu_types[] = {
- TYPE_HPPA64_CPU,
- NULL
-};
-
static void HP_C3700_machine_init_class_init(ObjectClass *oc, void *data)
{
+ static const char * const valid_cpu_types[] = {
+ TYPE_HPPA64_CPU,
+ NULL
+ };
MachineClass *mc = MACHINE_CLASS(oc);
NMIClass *nc = NMI_CLASS(oc);
mc->desc = "HP C3700 workstation";
mc->default_cpu_type = TYPE_HPPA64_CPU;
- mc->valid_cpu_types = HP_C3700_machine_valid_cpu_types;
+ mc->valid_cpu_types = valid_cpu_types;
mc->init = machine_HP_C3700_init;
mc->reset = hppa_machine_reset;
mc->block_default_type = IF_SCSI;
diff --git a/hw/m68k/q800.c b/hw/m68k/q800.c
index 1d7cd5ff1c..83d1571d02 100644
--- a/hw/m68k/q800.c
+++ b/hw/m68k/q800.c
@@ -726,19 +726,18 @@ static GlobalProperty hw_compat_q800[] = {
};
static const size_t hw_compat_q800_len = G_N_ELEMENTS(hw_compat_q800);
-static const char *q800_machine_valid_cpu_types[] = {
- M68K_CPU_TYPE_NAME("m68040"),
- NULL
-};
-
static void q800_machine_class_init(ObjectClass *oc, void *data)
{
+ static const char * const valid_cpu_types[] = {
+ M68K_CPU_TYPE_NAME("m68040"),
+ NULL
+ };
MachineClass *mc = MACHINE_CLASS(oc);
mc->desc = "Macintosh Quadra 800";
mc->init = q800_machine_init;
mc->default_cpu_type = M68K_CPU_TYPE_NAME("m68040");
- mc->valid_cpu_types = q800_machine_valid_cpu_types;
+ mc->valid_cpu_types = valid_cpu_types;
mc->max_cpus = 1;
mc->block_default_type = IF_SCSI;
mc->default_ram_id = "m68k_mac.ram";
--
2.41.0
next prev parent reply other threads:[~2023-11-17 7:18 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-17 7:17 [PATCH-for-8.2? v2 0/4] hw/arm/stm32xxx: Report error when incorrect CPU is used Philippe Mathieu-Daudé
2023-11-17 7:17 ` Philippe Mathieu-Daudé [this message]
2023-11-17 7:17 ` [PATCH-for-8.2? v2 2/4] hw/arm/stm32f405: " Philippe Mathieu-Daudé
2023-11-20 7:16 ` Gavin Shan
2023-11-24 13:13 ` Igor Mammedov
2023-11-24 13:21 ` Philippe Mathieu-Daudé
2023-12-06 0:12 ` Alistair Francis
2023-11-17 7:17 ` [PATCH-for-8.2? v2 3/4] hw/arm/stm32f205: " Philippe Mathieu-Daudé
2023-11-20 7:16 ` Gavin Shan
2023-11-17 7:17 ` [PATCH-for-8.2? v2 4/4] hw/arm/stm32f100: " Philippe Mathieu-Daudé
2023-11-20 7:17 ` Gavin Shan
2023-11-20 15:31 ` [PATCH-for-8.2? v2 0/4] hw/arm/stm32xxx: " Peter Maydell
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=20231117071704.35040-2-philmd@linaro.org \
--to=philmd@linaro.org \
--cc=alistair@alistair23.me \
--cc=arnaud.minier@telecom-paris.fr \
--cc=balbi@kernel.org \
--cc=deller@gmx.de \
--cc=eduardo@habkost.net \
--cc=erdnaxe@crans.org \
--cc=gshan@redhat.com \
--cc=imammedo@redhat.com \
--cc=ines.varhol@telecom-paris.fr \
--cc=kfting@nuvoton.com \
--cc=laurent@vivier.eu \
--cc=marcel.apfelbaum@gmail.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=sbhatta@marvell.com \
--cc=sundeep.lkml@gmail.com \
--cc=wangyanan55@huawei.com \
--cc=wuhaotsh@google.com \
/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).