From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
"Alberto Garcia" <berto@igalia.com>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Bernhard Beschow" <shentey@gmail.com>,
"Laurent Vivier" <lvivier@redhat.com>,
"Fabiano Rosas" <farosas@suse.de>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>
Subject: [PATCH 2/2] hw/ipack: Remove legacy qemu_allocate_irqs() use
Date: Tue, 21 Jan 2025 08:44:12 +0100 [thread overview]
Message-ID: <20250121074412.70292-3-philmd@linaro.org> (raw)
In-Reply-To: <20250121074412.70292-1-philmd@linaro.org>
No need to dynamically allocate IRQ when we know before hands
how many we'll use. Declare the 2 of them in IPackDevice state
and initialize them in the DeviceRealize handler.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
include/hw/ipack/ipack.h | 7 ++-----
hw/ipack/ipack.c | 7 +++----
2 files changed, 5 insertions(+), 9 deletions(-)
diff --git a/include/hw/ipack/ipack.h b/include/hw/ipack/ipack.h
index cbcdda509d3..14540281496 100644
--- a/include/hw/ipack/ipack.h
+++ b/include/hw/ipack/ipack.h
@@ -12,6 +12,7 @@
#define QEMU_IPACK_H
#include "hw/qdev-core.h"
+#include "hw/irq.h"
#include "qom/object.h"
@@ -19,10 +20,8 @@
OBJECT_DECLARE_SIMPLE_TYPE(IPackBus, IPACK_BUS)
struct IPackBus {
- /*< private >*/
BusState parent_obj;
- /* All fields are private */
uint8_t n_slots;
uint8_t free_slot;
qemu_irq_handler set_irq;
@@ -58,13 +57,11 @@ struct IPackDeviceClass {
};
struct IPackDevice {
- /*< private >*/
DeviceState parent_obj;
- /*< public >*/
int32_t slot;
/* IRQ objects for the IndustryPack INT0# and INT1# */
- qemu_irq *irq;
+ qemu_irq irq[2];
};
extern const VMStateDescription vmstate_ipack_device;
diff --git a/hw/ipack/ipack.c b/hw/ipack/ipack.c
index ed75f791832..ef59f5dcd62 100644
--- a/hw/ipack/ipack.c
+++ b/hw/ipack/ipack.c
@@ -55,22 +55,21 @@ static void ipack_device_realize(DeviceState *dev, Error **errp)
}
bus->free_slot = idev->slot + 1;
- idev->irq = qemu_allocate_irqs(bus->set_irq, idev, 2);
+ for (int i = 0; i < ARRAY_SIZE(idev->irq); i++) {
+ qemu_init_irq(idev->irq[i], bus->set_irq, idev, i);
+ }
k->realize(dev, errp);
}
static void ipack_device_unrealize(DeviceState *dev)
{
- IPackDevice *idev = IPACK_DEVICE(dev);
IPackDeviceClass *k = IPACK_DEVICE_GET_CLASS(dev);
if (k->unrealize) {
k->unrealize(dev);
return;
}
-
- qemu_free_irqs(idev->irq, 2);
}
static const Property ipack_device_props[] = {
--
2.47.1
next prev parent reply other threads:[~2025-01-21 7:45 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-21 7:44 [PATCH 0/2] hw/ipack: Minor dust removal Philippe Mathieu-Daudé
2025-01-21 7:44 ` [PATCH 1/2] hw/ipack: Clarify KConfig symbols Philippe Mathieu-Daudé
2025-01-21 13:34 ` Fabiano Rosas
2025-01-21 7:44 ` Philippe Mathieu-Daudé [this message]
2025-01-21 7:56 ` [PATCH 2/2] hw/ipack: Remove legacy qemu_allocate_irqs() use Philippe Mathieu-Daudé
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=20250121074412.70292-3-philmd@linaro.org \
--to=philmd@linaro.org \
--cc=berto@igalia.com \
--cc=farosas@suse.de \
--cc=lvivier@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=shentey@gmail.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).