From patchwork Fri Sep 11 12:32:24 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 33460 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 3C7A5B7067 for ; Fri, 11 Sep 2009 23:17:22 +1000 (EST) Received: from localhost ([127.0.0.1]:60947 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mm607-0001ib-Db for incoming@patchwork.ozlabs.org; Fri, 11 Sep 2009 09:17:19 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mm5JH-0004EM-RN for qemu-devel@nongnu.org; Fri, 11 Sep 2009 08:33:04 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Mm5JC-00046j-C8 for qemu-devel@nongnu.org; Fri, 11 Sep 2009 08:33:02 -0400 Received: from [199.232.76.173] (port=49291 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mm5JB-000460-G6 for qemu-devel@nongnu.org; Fri, 11 Sep 2009 08:32:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51832) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Mm5JA-000467-W1 for qemu-devel@nongnu.org; Fri, 11 Sep 2009 08:32:57 -0400 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n8BCWuH0016704 for ; Fri, 11 Sep 2009 08:32:56 -0400 Received: from zweiblum.home.kraxel.org (vpn1-5-42.ams2.redhat.com [10.36.5.42]) by int-mx05.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with SMTP id n8BCWlER024005; Fri, 11 Sep 2009 08:32:51 -0400 Received: by zweiblum.home.kraxel.org (Postfix, from userid 500) id 62498700E0; Fri, 11 Sep 2009 14:32:31 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 11 Sep 2009 14:32:24 +0200 Message-Id: <1252672351-12937-2-git-send-email-kraxel@redhat.com> In-Reply-To: <1252672351-12937-1-git-send-email-kraxel@redhat.com> References: <1252672351-12937-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.18 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: Gerd Hoffmann Subject: [Qemu-devel] [PATCH 1/8] qdev/pci: add pci_create_noinit() 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 Like pci_create_simple() but doesn't call qdev_init(), so one can set properties before initializing the device. Signed-off-by: Gerd Hoffmann --- hw/pci.c | 11 ++++++++--- hw/pci.h | 1 + 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/hw/pci.c b/hw/pci.c index c12b0be..64d70ed 100644 --- a/hw/pci.c +++ b/hw/pci.c @@ -923,15 +923,20 @@ void pci_qdev_register_many(PCIDeviceInfo *info) } } -PCIDevice *pci_create_simple(PCIBus *bus, int devfn, const char *name) +PCIDevice *pci_create_noinit(PCIBus *bus, int devfn, const char *name) { DeviceState *dev; dev = qdev_create(&bus->qbus, name); qdev_prop_set_uint32(dev, "addr", devfn); - qdev_init(dev); + return DO_UPCAST(PCIDevice, qdev, dev); +} - return (PCIDevice *)dev; +PCIDevice *pci_create_simple(PCIBus *bus, int devfn, const char *name) +{ + PCIDevice *dev = pci_create_noinit(bus, devfn, name); + qdev_init(&dev->qdev); + return dev; } static int pci_find_space(PCIDevice *pdev, uint8_t size) diff --git a/hw/pci.h b/hw/pci.h index 6196b6a..e7bf33a 100644 --- a/hw/pci.h +++ b/hw/pci.h @@ -328,6 +328,7 @@ void pci_qdev_register(PCIDeviceInfo *info); void pci_qdev_register_many(PCIDeviceInfo *info); PCIDevice *pci_create(const char *name, const char *devaddr); +PCIDevice *pci_create_noinit(PCIBus *bus, int devfn, const char *name); PCIDevice *pci_create_simple(PCIBus *bus, int devfn, const char *name); /* lsi53c895a.c */