qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 01/10] ppce500: move device/vendor/class id to q


From: Isaku Yamahata
Subject: Re: [Qemu-devel] [PATCH 01/10] ppce500: move device/vendor/class id to qdev
Date: Wed, 15 Jun 2011 07:42:45 +0900
User-agent: Mutt/1.5.19 (2009-01-05)

On Tue, Jun 14, 2011 at 08:35:20PM +0300, Michael S. Tsirkin wrote:
> Signed-off-by: Michael S. Tsirkin <address@hidden>
> ---
>  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: <address@hidden>
In-Reply-To: <address@hidden>
References: <address@hidden>
From: Isaku Yamahata <address@hidden>
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 <address@hidden>
---
 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]