From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PATCH 6/7] qdev: convert es1370.
Date: Tue, 30 Jun 2009 14:12:12 +0200 [thread overview]
Message-ID: <1246363933-29564-7-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1246363933-29564-1-git-send-email-kraxel@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/es1370.c | 41 ++++++++++++++++++++++-------------------
1 files changed, 22 insertions(+), 19 deletions(-)
diff --git a/hw/es1370.c b/hw/es1370.c
index f730766..9e860f9 100644
--- a/hw/es1370.c
+++ b/hw/es1370.c
@@ -1005,27 +1005,12 @@ static void es1370_on_reset (void *opaque)
es1370_reset (s);
}
-int es1370_init (PCIBus *bus)
+static void es1370_initfn(PCIDevice *dev)
{
- PCIES1370State *d;
- ES1370State *s;
- uint8_t *c;
-
- if (!bus) {
- dolog ("No PCI bus\n");
- return -1;
- }
-
- d = (PCIES1370State *) pci_register_device (bus, "ES1370",
- sizeof (PCIES1370State),
- -1, NULL, NULL);
-
- if (!d) {
- AUD_log (NULL, "Failed to register PCI device for ES1370\n");
- return -1;
- }
+ PCIES1370State *d = DO_UPCAST(PCIES1370State, dev, dev);
+ ES1370State *s = &d->es1370;
+ uint8_t *c = d->dev.config;
- c = d->dev.config;
pci_config_set_vendor_id (c, PCI_VENDOR_ID_ENSONIQ);
pci_config_set_device_id (c, PCI_DEVICE_ID_ENSONIQ_ES1370);
c[0x07] = 2 << 1;
@@ -1059,5 +1044,23 @@ int es1370_init (PCIBus *bus)
AUD_register_card ("es1370", &s->card);
es1370_reset (s);
+}
+
+int es1370_init (PCIBus *bus)
+{
+ pci_create_simple(bus, -1, "ES1370");
return 0;
}
+
+static PCIDeviceInfo es1370_info = {
+ .qdev.name = "ES1370",
+ .qdev.size = sizeof(PCIES1370State),
+ .init = es1370_initfn,
+};
+
+static void es1370_register(void)
+{
+ pci_qdev_register(&es1370_info);
+}
+device_init(es1370_register);
+
--
1.6.2.5
next prev parent reply other threads:[~2009-06-30 12:16 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-30 12:12 [Qemu-devel] [PATCH 0/7] qdev patches, batch #1 Gerd Hoffmann
2009-06-30 12:12 ` [Qemu-devel] [PATCH 1/7] qdev: update pci device registration Gerd Hoffmann
2009-06-30 12:12 ` [Qemu-devel] [PATCH 2/7] qdev: replace bus_type enum with bus_info struct Gerd Hoffmann
2009-06-30 12:12 ` [Qemu-devel] [PATCH 3/7] qdev: remove DeviceType Gerd Hoffmann
2009-06-30 12:12 ` [Qemu-devel] [PATCH 4/7] qdev/core: add monitor command to list all drivers Gerd Hoffmann
2009-06-30 12:12 ` [Qemu-devel] [PATCH 5/7] qdev/pci: misc fixes Gerd Hoffmann
2009-06-30 12:12 ` Gerd Hoffmann [this message]
2009-06-30 14:32 ` [Qemu-devel] Re: [PATCH 6/7] qdev: convert es1370 Gerd Hoffmann
2009-06-30 12:12 ` [Qemu-devel] [PATCH 7/7] qdev: convert ac97 Gerd Hoffmann
2009-06-30 14:33 ` [Qemu-devel] " Gerd Hoffmann
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=1246363933-29564-7-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).