On Tue, Jun 14, 2011 at 08:35:20PM +0300, Michael S. Tsirkin wrote: > Signed-off-by: Michael S. Tsirkin <mst@xxxxxxxxxx> > --- > 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@xxxxxxxxxxxxx> In-Reply-To: <cover.1308091239.git.yamahata@xxxxxxxxxxxxx> References: <cover.1308091239.git.yamahata@xxxxxxxxxxxxx> From: Isaku Yamahata <yamahata@xxxxxxxxxxxxx> 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 <yamahata@xxxxxxxxxxxxx> --- 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 */ -- 1.7.1.1 -- yamahata -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html