[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 05/10] hw/intc/loongarch_extioi: Add common realize interface
From: |
Bibo Mao |
Subject: |
[PATCH 05/10] hw/intc/loongarch_extioi: Add common realize interface |
Date: |
Fri, 20 Sep 2024 17:05:02 +0800 |
Add common realize function, it is only to check validity of property.
Signed-off-by: Bibo Mao <maobibo@loongson.cn>
---
hw/intc/loongarch_extioi.c | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/hw/intc/loongarch_extioi.c b/hw/intc/loongarch_extioi.c
index 409d4a85da..8ac246c2e6 100644
--- a/hw/intc/loongarch_extioi.c
+++ b/hw/intc/loongarch_extioi.c
@@ -323,14 +323,27 @@ static const MemoryRegionOps extioi_virt_ops = {
.endianness = DEVICE_LITTLE_ENDIAN,
};
+static void loongarch_extioi_common_realize(DeviceState *dev, Error **errp)
+{
+ LoongArchExtIOICommonState *s = (LoongArchExtIOICommonState *)dev;
+ SysBusDevice *sbd = SYS_BUS_DEVICE(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.39.3
- [PATCH 00/10] hw/intc/loongarch_extioi: Split into extioi common and extioi, Bibo Mao, 2024/09/20
- [PATCH 06/10] hw/intc/loongarch_extioi: Add unrealize interface, Bibo Mao, 2024/09/20
- [PATCH 02/10] include: Move struct LoongArchExtIOI to header file loongarch_extioi_common, Bibo Mao, 2024/09/20
- [PATCH 04/10] hw/intc/loongarch_extioi: Rename LoongArchExtIOI with LoongArchExtIOICommonState, Bibo Mao, 2024/09/20
- [PATCH 03/10] include: Rename LoongArchExtIOI with LoongArchExtIOICommonState, Bibo Mao, 2024/09/20
- [PATCH 05/10] hw/intc/loongarch_extioi: Add common realize interface,
Bibo Mao <=
- [PATCH 08/10] hw/intc/loongarch_extioi: Inherit from loongarch_extioi_common, Bibo Mao, 2024/09/20
- [PATCH 09/10] hw/intc/loongarch_extioi: Add pre_save interface, Bibo Mao, 2024/09/20
- [PATCH 07/10] hw/intc/loongarch_extioi: Add common file loongarch_extioi_common, Bibo Mao, 2024/09/20
- [PATCH 01/10] include: Add loongarch_extioi_common header file, Bibo Mao, 2024/09/20
- [PATCH 10/10] hw/intc/loongarch_extioi: Code cleanup about loongarch_extioi, Bibo Mao, 2024/09/20