From patchwork Fri Jun 25 16:53:31 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 56938 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id D9A66B6F10 for ; Sat, 26 Jun 2010 04:14:00 +1000 (EST) Received: from localhost ([127.0.0.1]:48598 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OSDON-0003aA-L6 for incoming@patchwork.ozlabs.org; Fri, 25 Jun 2010 14:12:43 -0400 Received: from [140.186.70.92] (port=44167 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OSCvb-0002Dc-Ii for qemu-devel@nongnu.org; Fri, 25 Jun 2010 13:43:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OSC9o-0008Ni-Pe for qemu-devel@nongnu.org; Fri, 25 Jun 2010 12:53:38 -0400 Received: from oxygen.pond.sub.org ([213.239.205.148]:34422) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OSC9o-0008MD-HZ for qemu-devel@nongnu.org; Fri, 25 Jun 2010 12:53:36 -0400 Received: from blackfin.pond.sub.org (pD9E39B39.dip.t-dialin.net [217.227.155.57]) by oxygen.pond.sub.org (Postfix) with ESMTPA id C6B292DD3B7; Fri, 25 Jun 2010 18:53:33 +0200 (CEST) Received: by blackfin.pond.sub.org (Postfix, from userid 500) id 1D36541C; Fri, 25 Jun 2010 18:53:33 +0200 (CEST) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Fri, 25 Jun 2010 18:53:31 +0200 Message-Id: <1277484812-22012-12-git-send-email-armbru@redhat.com> X-Mailer: git-send-email 1.6.6.1 In-Reply-To: <1277484812-22012-1-git-send-email-armbru@redhat.com> References: <1277484812-22012-1-git-send-email-armbru@redhat.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) Cc: kwolf@redhat.com, kraxel@redhat.com, hch@lst.de Subject: [Qemu-devel] [PATCH 11/12] ide: Make PIIX and ISA IDE init functions return the qdev X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Markus Armbruster Reviewed-by: Christoph Hellwig --- hw/ide.h | 11 ++++++----- hw/ide/isa.c | 8 ++++---- hw/ide/piix.c | 6 ++++-- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/hw/ide.h b/hw/ide.h index 0e7d540..f0cb320 100644 --- a/hw/ide.h +++ b/hw/ide.h @@ -1,17 +1,18 @@ #ifndef HW_IDE_H #define HW_IDE_H -#include "qdev.h" +#include "isa.h" +#include "pci.h" /* ide-isa.c */ -int isa_ide_init(int iobase, int iobase2, int isairq, - DriveInfo *hd0, DriveInfo *hd1); +ISADevice *isa_ide_init(int iobase, int iobase2, int isairq, + DriveInfo *hd0, DriveInfo *hd1); /* ide-pci.c */ void pci_cmd646_ide_init(PCIBus *bus, DriveInfo **hd_table, int secondary_ide_enabled); -void pci_piix3_ide_init(PCIBus *bus, DriveInfo **hd_table, int devfn); -void pci_piix4_ide_init(PCIBus *bus, DriveInfo **hd_table, int devfn); +PCIDevice *pci_piix3_ide_init(PCIBus *bus, DriveInfo **hd_table, int devfn); +PCIDevice *pci_piix4_ide_init(PCIBus *bus, DriveInfo **hd_table, int devfn); /* ide-macio.c */ int pmac_ide_init (DriveInfo **hd_table, qemu_irq irq, diff --git a/hw/ide/isa.c b/hw/ide/isa.c index b6c6347..10777ca 100644 --- a/hw/ide/isa.c +++ b/hw/ide/isa.c @@ -75,8 +75,8 @@ static int isa_ide_initfn(ISADevice *dev) return 0; }; -int isa_ide_init(int iobase, int iobase2, int isairq, - DriveInfo *hd0, DriveInfo *hd1) +ISADevice *isa_ide_init(int iobase, int iobase2, int isairq, + DriveInfo *hd0, DriveInfo *hd1) { ISADevice *dev; ISAIDEState *s; @@ -86,14 +86,14 @@ int isa_ide_init(int iobase, int iobase2, int isairq, qdev_prop_set_uint32(&dev->qdev, "iobase2", iobase2); qdev_prop_set_uint32(&dev->qdev, "irq", isairq); if (qdev_init(&dev->qdev) < 0) - return -1; + return NULL; s = DO_UPCAST(ISAIDEState, dev, dev); if (hd0) ide_create_drive(&s->bus, 0, hd0); if (hd1) ide_create_drive(&s->bus, 1, hd1); - return 0; + return dev; } static ISADeviceInfo isa_ide_info = { diff --git a/hw/ide/piix.c b/hw/ide/piix.c index dad6e86..fa22226 100644 --- a/hw/ide/piix.c +++ b/hw/ide/piix.c @@ -160,22 +160,24 @@ static int pci_piix4_ide_initfn(PCIDevice *dev) /* hd_table must contain 4 block drivers */ /* NOTE: for the PIIX3, the IRQs and IOports are hardcoded */ -void pci_piix3_ide_init(PCIBus *bus, DriveInfo **hd_table, int devfn) +PCIDevice *pci_piix3_ide_init(PCIBus *bus, DriveInfo **hd_table, int devfn) { PCIDevice *dev; dev = pci_create_simple(bus, devfn, "piix3-ide"); pci_ide_create_devs(dev, hd_table); + return dev; } /* hd_table must contain 4 block drivers */ /* NOTE: for the PIIX4, the IRQs and IOports are hardcoded */ -void pci_piix4_ide_init(PCIBus *bus, DriveInfo **hd_table, int devfn) +PCIDevice *pci_piix4_ide_init(PCIBus *bus, DriveInfo **hd_table, int devfn) { PCIDevice *dev; dev = pci_create_simple(bus, devfn, "piix4-ide"); pci_ide_create_devs(dev, hd_table); + return dev; } static PCIDeviceInfo piix_ide_info[] = {