From patchwork Tue Jun 14 22:42:45 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Isaku Yamahata X-Patchwork-Id: 100465 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 31894B6F91 for ; Wed, 15 Jun 2011 10:20:54 +1000 (EST) Received: from localhost ([::1]:53622 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QWdqk-0004Xt-Hj for incoming@patchwork.ozlabs.org; Tue, 14 Jun 2011 20:20:50 -0400 Received: from eggs.gnu.org ([140.186.70.92]:33370) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QWcJv-00058L-L0 for qemu-devel@nongnu.org; Tue, 14 Jun 2011 18:42:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QWcJu-0007ay-1o for qemu-devel@nongnu.org; Tue, 14 Jun 2011 18:42:51 -0400 Received: from mail.valinux.co.jp ([210.128.90.3]:42743) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QWcJt-0007ac-Da for qemu-devel@nongnu.org; Tue, 14 Jun 2011 18:42:49 -0400 Received: from ps.local.valinux.co.jp (vagw.valinux.co.jp [210.128.90.14]) by mail.valinux.co.jp (Postfix) with SMTP id 4C8F5280FA; Wed, 15 Jun 2011 07:42:45 +0900 (JST) Received: (nullmailer pid 22579 invoked by uid 1000); Tue, 14 Jun 2011 22:42:45 -0000 Date: Wed, 15 Jun 2011 07:42:45 +0900 From: Isaku Yamahata To: "Michael S\. Tsirkin" Message-ID: <20110614224245.GF23200@valinux.co.jp> References: <3f7ffd8874e571082a1536364d38a4fd6ccddb46.1308072799.git.mst@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <3f7ffd8874e571082a1536364d38a4fd6ccddb46.1308072799.git.mst@redhat.com> User-Agent: Mutt/1.5.19 (2009-01-05) X-Virus-Scanned: clamav-milter 0.95.2 at va-mail.local.valinux.co.jp X-Virus-Status: Clean X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 210.128.90.3 X-Mailman-Approved-At: Tue, 14 Jun 2011 19:32:51 -0400 Cc: Kevin Wolf , Alexander Graf , Anthony Liguori , Marcelo Tosatti , Stefan Hajnoczi , kvm@vger.kernel.org, Jan Kiszka , Riku Voipio , qemu-devel@nongnu.org, Christoph Hellwig , Blue Swirl , Alex Williamson , Gerd Hoffmann , Paolo Bonzini , Richard Henderson , Avi Kivity , Aurelien Jarno , Paul Brook Subject: Re: [Qemu-devel] [PATCH 01/10] ppce500: move device/vendor/class id to qdev X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org On Tue, Jun 14, 2011 at 08:35:20PM +0300, Michael S. Tsirkin wrote: > Signed-off-by: Michael S. Tsirkin > --- > hw/ppce500_pci.c | 13 +++---------- > 1 files changed, 3 insertions(+), 10 deletions(-) > > diff --git a/hw/ppce500_pci.c b/hw/ppce500_pci.c > index 069af96..fc11af4 100644 > --- a/hw/ppce500_pci.c > +++ b/hw/ppce500_pci.c > @@ -304,20 +304,13 @@ static int e500_pcihost_initfn(SysBusDevice *dev) > return 0; > } > > -static int e500_host_bridge_initfn(PCIDevice *dev) > -{ > - pci_config_set_vendor_id(dev->config, PCI_VENDOR_ID_FREESCALE); > - pci_config_set_device_id(dev->config, PCI_DEVICE_ID_MPC8533E); > - pci_config_set_class(dev->config, PCI_CLASS_PROCESSOR_POWERPC); > - > - return 0; > -} > - > static PCIDeviceInfo e500_host_bridge_info = { > .qdev.name = "e500-host-bridge", > .qdev.desc = "Host bridge", > .qdev.size = sizeof(PCIDevice), > - .init = e500_host_bridge_initfn, > + .vendor_id = PCI_VENDOR_ID_FREESCALE, > + .device_id = PCI_DEVICE_ID_MPC8533E, > + .class_id = PCI_CLASS_PROCESSOR_POWERPC, > }; > > static SysBusDeviceInfo e500_pcihost_info = { > -- > 1.7.5.53.gc233e > Now PCIDeviceInfo::init is NULL. So we want the following patch. From 45ea80e32966bf8105e56b7d08926d1e6675ae48 Mon Sep 17 00:00:00 2001 Message-Id: <45ea80e32966bf8105e56b7d08926d1e6675ae48.1308091239.git.yamahata@valinux.co.jp> In-Reply-To: References: From: Isaku Yamahata Date: Wed, 15 Jun 2011 07:37:47 +0900 Subject: [PATCH] pci: don't call qdev pci init method As pci id initialization is moved to common layer, some initialization function can be empty. So don't call init method if NULL. Signed-off-by: Isaku Yamahata --- hw/pci.c | 10 ++++++---- 1 files changed, 6 insertions(+), 4 deletions(-) diff --git a/hw/pci.c b/hw/pci.c index ba0598b..b904a4e 100644 --- a/hw/pci.c +++ b/hw/pci.c @@ -1681,10 +1681,12 @@ static int pci_qdev_init(DeviceState *qdev, DeviceInfo *base) do_pci_unregister_device(pci_dev); return -1; } - rc = info->init(pci_dev); - if (rc != 0) { - do_pci_unregister_device(pci_dev); - return rc; + if (info->init) { + rc = info->init(pci_dev); + if (rc != 0) { + do_pci_unregister_device(pci_dev); + return rc; + } } /* rom loading */