From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Peter Maydell" <peter.maydell@linaro.org>,
"Thomas Huth" <thuth@redhat.com>,
qemu-arm@nongnu.org, "Philippe Mathieu-Daudé" <philmd@linaro.org>
Subject: [PATCH v3 6/9] hw/intc/pxa2xx: Convert to Resettable interface
Date: Fri, 20 Oct 2023 15:03:27 +0200 [thread overview]
Message-ID: <20231020130331.50048-7-philmd@linaro.org> (raw)
In-Reply-To: <20231020130331.50048-1-philmd@linaro.org>
Factor reset code out of the DeviceRealize() handler.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/arm/pxa2xx_pic.c | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/hw/arm/pxa2xx_pic.c b/hw/arm/pxa2xx_pic.c
index 47132ab982..2eb869a605 100644
--- a/hw/arm/pxa2xx_pic.c
+++ b/hw/arm/pxa2xx_pic.c
@@ -271,12 +271,9 @@ static int pxa2xx_pic_post_load(void *opaque, int version_id)
return 0;
}
-DeviceState *pxa2xx_pic_init(hwaddr base, ARMCPU *cpu)
+static void pxa2xx_pic_reset_hold(Object *obj)
{
- DeviceState *dev = qdev_new(TYPE_PXA2XX_PIC);
- PXA2xxPICState *s = PXA2XX_PIC(dev);
-
- s->cpu = cpu;
+ PXA2xxPICState *s = PXA2XX_PIC(obj);
s->int_pending[0] = 0;
s->int_pending[1] = 0;
@@ -284,6 +281,14 @@ DeviceState *pxa2xx_pic_init(hwaddr base, ARMCPU *cpu)
s->int_enabled[1] = 0;
s->is_fiq[0] = 0;
s->is_fiq[1] = 0;
+}
+
+DeviceState *pxa2xx_pic_init(hwaddr base, ARMCPU *cpu)
+{
+ DeviceState *dev = qdev_new(TYPE_PXA2XX_PIC);
+ PXA2xxPICState *s = PXA2XX_PIC(dev);
+
+ s->cpu = cpu;
sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
@@ -319,9 +324,11 @@ static const VMStateDescription vmstate_pxa2xx_pic_regs = {
static void pxa2xx_pic_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
+ ResettableClass *rc = RESETTABLE_CLASS(klass);
dc->desc = "PXA2xx PIC";
dc->vmsd = &vmstate_pxa2xx_pic_regs;
+ rc->phases.hold = pxa2xx_pic_reset_hold;
}
static const TypeInfo pxa2xx_pic_info = {
--
2.41.0
next prev parent reply other threads:[~2023-10-20 13:05 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-20 13:03 [PATCH v3 0/9] hw/arm/pxa2xx: SysBus/QDev fixes Philippe Mathieu-Daudé
2023-10-20 13:03 ` [PATCH v3 1/9] hw/sd/pxa2xx: Realize sysbus device before accessing it Philippe Mathieu-Daudé
2023-10-20 13:03 ` [PATCH v3 2/9] hw/sd/pxa2xx: Do not open-code sysbus_create_simple() Philippe Mathieu-Daudé
2023-10-20 13:03 ` [PATCH v3 3/9] hw/pcmcia/pxa2xx: Realize sysbus device before accessing it Philippe Mathieu-Daudé
2023-10-20 13:03 ` [PATCH v3 4/9] hw/pcmcia/pxa2xx: Do not open-code sysbus_create_simple() Philippe Mathieu-Daudé
2023-10-20 13:03 ` [PATCH v3 5/9] hw/pcmcia/pxa2xx: Inline pxa2xx_pcmcia_init() Philippe Mathieu-Daudé
2023-10-20 13:03 ` Philippe Mathieu-Daudé [this message]
2023-10-20 13:03 ` [PATCH v3 7/9] hw/intc/pxa2xx: Pass CPU reference using QOM link property Philippe Mathieu-Daudé
2023-10-23 6:45 ` Thomas Huth
2023-10-20 13:03 ` [PATCH v3 8/9] hw/intc/pxa2xx: Factor pxa2xx_pic_realize() out of pxa2xx_pic_init() Philippe Mathieu-Daudé
2023-10-23 6:46 ` Thomas Huth
2023-10-20 13:03 ` [PATCH v3 9/9] hw/arm/pxa2xx: Realize PXA2XX_I2C device before accessing it Philippe Mathieu-Daudé
2023-10-23 6:47 ` Thomas Huth
2023-10-20 21:31 ` [PATCH v3 0/9] hw/arm/pxa2xx: SysBus/QDev fixes Richard Henderson
2023-10-27 11:49 ` 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=20231020130331.50048-7-philmd@linaro.org \
--to=philmd@linaro.org \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=thuth@redhat.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).