[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 13/18] hw/intc/loongarch_extioi: Add common realize interface
From: |
Bibo Mao |
Subject: |
[PULL 13/18] hw/intc/loongarch_extioi: Add common realize interface |
Date: |
Mon, 16 Dec 2024 09:56:02 +0800 |
Add common realize function, it is only to check validity of property.
Signed-off-by: Bibo Mao <maobibo@loongson.cn>
Reviewed-by: Song Gao <gaosong@loongson.cn>
---
hw/intc/loongarch_extioi.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/hw/intc/loongarch_extioi.c b/hw/intc/loongarch_extioi.c
index 2ec5a75817..c88e99974a 100644
--- a/hw/intc/loongarch_extioi.c
+++ b/hw/intc/loongarch_extioi.c
@@ -318,14 +318,26 @@ static const MemoryRegionOps extioi_virt_ops = {
.endianness = DEVICE_LITTLE_ENDIAN,
};
+static void loongarch_extioi_common_realize(DeviceState *dev, Error **errp)
+{
+ LoongArchExtIOICommonState *s = (LoongArchExtIOICommonState *)dev;
+
+ if (s->num_cpu == 0) {
+ error_setg(errp, "num-cpu must be at least 1");
+ return;
+ }
+}
+
static void loongarch_extioi_realize(DeviceState *dev, Error **errp)
{
LoongArchExtIOI *s = LOONGARCH_EXTIOI(dev);
SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
+ Error *local_err = NULL;
int i, pin;
- if (s->num_cpu == 0) {
- error_setg(errp, "num-cpu must be at least 1");
+ loongarch_extioi_common_realize(dev, &local_err);
+ if (local_err) {
+ error_propagate(errp, local_err);
return;
}
--
2.43.5
- [PULL 05/18] hw/intc/loongarch_pch: Move some functions to file loongarch_pic_common, (continued)
- [PULL 05/18] hw/intc/loongarch_pch: Move some functions to file loongarch_pic_common, Bibo Mao, 2024/12/15
- [PULL 02/18] include: Move struct LoongArchPCHPIC to loongarch_pic_common header file, Bibo Mao, 2024/12/15
- [PULL 04/18] hw/intc/loongarch_pch: Rename LoongArchPCHPIC with LoongArchPICCommonState, Bibo Mao, 2024/12/15
- [PULL 07/18] hw/intc/loongarch_pch: Add pre_save and post_load interfaces, Bibo Mao, 2024/12/15
- [PULL 06/18] hw/intc/loongarch_pch: Inherit from loongarch_pic_common, Bibo Mao, 2024/12/15
- [PULL 10/18] include: Move struct LoongArchExtIOI to header file loongarch_extioi_common, Bibo Mao, 2024/12/15
- [PULL 09/18] include: Add loongarch_extioi_common header file, Bibo Mao, 2024/12/15
- [PULL 11/18] include: Rename LoongArchExtIOI with LoongArchExtIOICommonState, Bibo Mao, 2024/12/15
- [PULL 14/18] hw/intc/loongarch_extioi: Add unrealize interface, Bibo Mao, 2024/12/15
- [PULL 12/18] hw/intc/loongarch_extioi: Rename LoongArchExtIOI with LoongArchExtIOICommonState, Bibo Mao, 2024/12/15
- [PULL 13/18] hw/intc/loongarch_extioi: Add common realize interface,
Bibo Mao <=
- [PULL 15/18] hw/intc/loongarch_extioi: Add common file loongarch_extioi_common, Bibo Mao, 2024/12/15
- Re: [PULL 00/18] loongarch-to-apply queue, Stefan Hajnoczi, 2024/12/16
- [PULL 00/18] loongarch-to-apply queue, Bibo Mao, 2024/12/19