From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PATCH 2/3] qdev: irq allocation in generic code.
Date: Tue, 9 Jun 2009 13:01:00 +0200 [thread overview]
Message-ID: <1244545261-23679-2-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1244545261-23679-1-git-send-email-kraxel@redhat.com>
Almost all devices have a static number of irqs, so we can easily move
the setup into generic code by adding some fields to DeviceInfo.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/qdev.c | 9 +++++++++
hw/qdev.h | 4 ++++
2 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/hw/qdev.c b/hw/qdev.c
index 9fd22cf..c70ae8f 100644
--- a/hw/qdev.c
+++ b/hw/qdev.c
@@ -99,6 +99,15 @@ DeviceState *qdev_create(BusState *bus, const char *name)
}
dev->parent_bus = bus;
LIST_INSERT_HEAD(&bus->children, dev, sibling);
+
+ if (t->info->num_gpio_in) {
+ qdev_init_gpio_in(dev, t->info->irq, t->info->num_gpio_in);
+ }
+ if (t->info->num_gpio_out) {
+ qemu_irq *irqs = qemu_mallocz(sizeof(irqs[0]) * t->info->num_gpio_out);
+ qdev_init_gpio_out(dev, irqs, t->info->num_gpio_out);
+ }
+
return dev;
}
diff --git a/hw/qdev.h b/hw/qdev.h
index 7b523b6..bed3d6a 100644
--- a/hw/qdev.h
+++ b/hw/qdev.h
@@ -82,6 +82,10 @@ struct DeviceInfo {
const char *name;
size_t size;
+ int num_gpio_in;
+ int num_gpio_out;
+ qemu_irq_handler irq;
+
/* private to qdev / bus */
qdev_initfn init;
BusType bus_type;
--
1.6.2.2
next prev parent reply other threads:[~2009-06-09 11:01 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-09 11:00 [Qemu-devel] [PATCH 1/3] qdev-ify isa pic Gerd Hoffmann
2009-06-09 11:01 ` Gerd Hoffmann [this message]
2009-06-09 11:01 ` [Qemu-devel] [PATCH 3/3] qdev: switch isa pic to generic irq allocation Gerd Hoffmann
2009-06-09 15:01 ` [Qemu-devel] [PATCH 1/3] qdev-ify isa pic Paul Brook
2009-06-09 15:24 ` Gerd Hoffmann
2009-06-09 15:32 ` Paul Brook
2009-06-09 15:51 ` Gerd Hoffmann
2009-06-09 15:58 ` Paul Brook
2009-06-10 7:32 ` Gerd Hoffmann
2009-06-10 9:43 ` Filip Navara
2009-06-10 9:50 ` Gerd Hoffmann
2009-06-10 14:29 ` Paul Brook
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=1244545261-23679-2-git-send-email-kraxel@redhat.com \
--to=kraxel@redhat.com \
--cc=qemu-devel@nongnu.org \
/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).