From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MLeOn-0007vP-IP for qemu-devel@nongnu.org; Tue, 30 Jun 2009 10:33:29 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MLeOj-0007sW-3E for qemu-devel@nongnu.org; Tue, 30 Jun 2009 10:33:29 -0400 Received: from [199.232.76.173] (port=60576 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MLeOi-0007sQ-NH for qemu-devel@nongnu.org; Tue, 30 Jun 2009 10:33:24 -0400 Received: from mx2.redhat.com ([66.187.237.31]:42155) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MLeOi-0001QN-30 for qemu-devel@nongnu.org; Tue, 30 Jun 2009 10:33:24 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n5UEXNok028894 for ; Tue, 30 Jun 2009 10:33:23 -0400 Message-ID: <4A4A222F.6080505@redhat.com> Date: Tue, 30 Jun 2009 16:33:19 +0200 From: Gerd Hoffmann MIME-Version: 1.0 References: <1246363933-29564-1-git-send-email-kraxel@redhat.com> <1246363933-29564-8-git-send-email-kraxel@redhat.com> In-Reply-To: <1246363933-29564-8-git-send-email-kraxel@redhat.com> Content-Type: multipart/mixed; boundary="------------010104080701040306080901" Subject: [Qemu-devel] Re: [PATCH 7/7] qdev: convert ac97. List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gerd Hoffmann Cc: qemu-devel@nongnu.org This is a multi-part message in MIME format. --------------010104080701040306080901 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit updated version, formated conststently with audio/ --------------010104080701040306080901 Content-Type: text/plain; name="0002-qdev-convert-ac97.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0002-qdev-convert-ac97.patch" >>From c314b4860ba07cebf7071e2f2390fe34c4428f21 Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Fri, 19 Jun 2009 14:14:52 +0200 Subject: [PATCH 2/2] qdev: convert ac97. --- hw/ac97.c | 42 ++++++++++++++++++++++-------------------- 1 files changed, 22 insertions(+), 20 deletions(-) diff --git a/hw/ac97.c b/hw/ac97.c index b9dac3c..873469d 100644 --- a/hw/ac97.c +++ b/hw/ac97.c @@ -1308,29 +1308,13 @@ static void ac97_on_reset (void *opaque) mixer_reset (s); } -int ac97_init (PCIBus *bus) +static void ac97_initfn(PCIDevice *dev) { - PCIAC97LinkState *d; - AC97LinkState *s; - uint8_t *c; - - if (!bus) { - AUD_log ("ac97", "No PCI bus\n"); - return -1; - } - - d = (PCIAC97LinkState *) pci_register_device (bus, "AC97", - sizeof (PCIAC97LinkState), - -1, NULL, NULL); - - if (!d) { - AUD_log ("ac97", "Failed to register PCI device\n"); - return -1; - } + PCIAC97LinkState *d = DO_UPCAST (PCIAC97LinkState, dev, dev); + AC97LinkState *s = &d->ac97; + uint8_t *c = d->dev.config; - s = &d->ac97; s->pci_dev = &d->dev; - c = d->dev.config; pci_config_set_vendor_id (c, PCI_VENDOR_ID_INTEL); /* ro */ pci_config_set_device_id (c, PCI_DEVICE_ID_INTEL_82801AA_5); /* ro */ @@ -1372,5 +1356,23 @@ int ac97_init (PCIBus *bus) qemu_register_reset (ac97_on_reset, s); AUD_register_card ("ac97", &s->card); ac97_on_reset (s); +} + +int ac97_init (PCIBus *bus) +{ + pci_create_simple (bus, -1, "AC97"); return 0; } + +static PCIDeviceInfo ac97_info = { + .qdev.name = "AC97", + .qdev.size = sizeof (PCIAC97LinkState), + .init = ac97_initfn, +}; + +static void ac97_register(void) +{ + pci_qdev_register (&ac97_info); +} +device_init (ac97_register); + -- 1.6.2.5 --------------010104080701040306080901--