[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 03/15] hw/timer/arm_timer: Add missing sp804_unrealize() handler
|
From: |
Philippe Mathieu-Daudé |
|
Subject: |
[PATCH 03/15] hw/timer/arm_timer: Add missing sp804_unrealize() handler |
|
Date: |
Wed, 31 May 2023 22:35:47 +0200 |
Release the IRQs allocated in sp804_realize() in the
corresponding sp804_unrealize() handler.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/timer/arm_timer.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/hw/timer/arm_timer.c b/hw/timer/arm_timer.c
index 36f6586f80..5caf42649a 100644
--- a/hw/timer/arm_timer.c
+++ b/hw/timer/arm_timer.c
@@ -309,6 +309,15 @@ static void sp804_realize(DeviceState *dev, Error **errp)
s->timer[1]->irq = qemu_allocate_irq(sp804_set_irq, s, 1);
}
+static void sp804_unrealize(DeviceState *dev)
+{
+ SP804State *s = SP804(dev);
+
+ for (unsigned i = 0; i < ARRAY_SIZE(s->timer); i++) {
+ qemu_free_irq(s->timer[i]->irq);
+ }
+}
+
static Property sp804_properties[] = {
DEFINE_PROP_UINT32("freq0", SP804State, freq0, 1000000),
DEFINE_PROP_UINT32("freq1", SP804State, freq1, 1000000),
@@ -320,6 +329,7 @@ static void sp804_class_init(ObjectClass *klass, void *data)
DeviceClass *k = DEVICE_CLASS(klass);
k->realize = sp804_realize;
+ k->unrealize = sp804_unrealize;
device_class_set_props(k, sp804_properties);
k->vmsd = &vmstate_sp804;
}
--
2.38.1
- [PATCH 00/15] hw/timer/arm_timer: QOM'ify ARM_TIMER and correct sysbus/irq in ICP_PIT, Philippe Mathieu-Daudé, 2023/05/31
- [PATCH 01/15] hw/timer/arm_timer: Declare QOM types using DEFINE_TYPES() macro, Philippe Mathieu-Daudé, 2023/05/31
- [PATCH 02/15] hw/timer/arm_timer: Move SP804 code around, Philippe Mathieu-Daudé, 2023/05/31
- [PATCH 03/15] hw/timer/arm_timer: Add missing sp804_unrealize() handler,
Philippe Mathieu-Daudé <=
- [PATCH 04/15] hw/timer/arm_timer: Remove pointless cast from void *, Philippe Mathieu-Daudé, 2023/05/31
- [PATCH 05/15] hw/timer/arm_timer: CamelCase rename icp_pit_state -> IntegratorPitState, Philippe Mathieu-Daudé, 2023/05/31
- [PATCH 06/15] hw/timer/arm_timer: CamelCase rename arm_timer_state -> ArmTimerState, Philippe Mathieu-Daudé, 2023/05/31
- [PATCH 07/15] hw/timer/arm_timer: Extract arm_timer_reset(), Philippe Mathieu-Daudé, 2023/05/31
- [PATCH 08/15] hw/timer/arm_timer: Rename arm_timer_init() -> arm_timer_new(), Philippe Mathieu-Daudé, 2023/05/31
- [PATCH 09/15] hw/timer/arm_timer: Convert ArmTimerState::freq to uint32_t type, Philippe Mathieu-Daudé, 2023/05/31
- [PATCH 10/15] hw/timer/arm_timer: Use array of frequency in SP804State, Philippe Mathieu-Daudé, 2023/05/31
- [PATCH 11/15] hw/timer/arm_timer: Iterate on timers using for() loop statement, Philippe Mathieu-Daudé, 2023/05/31
- [PATCH 12/15] hw/timer/arm_timer: Pass timer output IRQ as parameter to arm_timer_new, Philippe Mathieu-Daudé, 2023/05/31
- [PATCH 13/15] hw/timer/arm_timer: Fix misuse of SysBus IRQ in IcpPitState, Philippe Mathieu-Daudé, 2023/05/31