public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Isaku Yamahata <yamahata@valinux.co.jp>
To: "Michael S\. Tsirkin" <mst@redhat.com>
Cc: qemu-devel@nongnu.org, Paul Brook <paul@codesourcery.com>,
	Kevin Wolf <kwolf@redhat.com>, Gerd Hoffmann <kraxel@redhat.com>,
	Anthony Liguori <aliguori@us.ibm.com>,
	Riku Voipio <riku.voipio@iki.fi>,
	Richard Henderson <rth@twiddle.net>, Avi Kivity <avi@redhat.com>,
	Marcelo Tosatti <mtosatti@redhat.com>,
	Alex Williamson <alex.williamson@redhat.com>,
	Blue Swirl <blauwirbel@gmail.com>,
	Stefan Weil <weil@mail.berlios.de>,
	Jan Kiszka <jan.kiszka@siemens.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Christoph Hellwig <hch@lst.de>,
	Aurelien Jarno <aurelien@aurel32.net>,
	Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>,
	Alexander Graf <agraf@suse.de>,
	kvm@vger.kernel.org
Subject: Re: [PATCH 01/10] ppce500: move device/vendor/class id to qdev
Date: Wed, 15 Jun 2011 07:42:45 +0900	[thread overview]
Message-ID: <20110614224245.GF23200@valinux.co.jp> (raw)
In-Reply-To: <3f7ffd8874e571082a1536364d38a4fd6ccddb46.1308072799.git.mst@redhat.com>

On Tue, Jun 14, 2011 at 08:35:20PM +0300, Michael S. Tsirkin wrote:
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
>  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: <cover.1308091239.git.yamahata@valinux.co.jp>
References: <cover.1308091239.git.yamahata@valinux.co.jp>
From: Isaku Yamahata <yamahata@valinux.co.jp>
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@valinux.co.jp>
---
 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	other threads:[~2011-06-14 22:42 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-14 17:35 [PATCH 00/10] qemu: remove set but unused variables Michael S. Tsirkin
2011-06-14 17:35 ` [PATCH 01/10] ppce500: move device/vendor/class id to qdev Michael S. Tsirkin
2011-06-14 22:42   ` Isaku Yamahata [this message]
2011-06-14 17:35 ` [PATCH 02/10] usb-ehci: " Michael S. Tsirkin
2011-06-14 17:35 ` [PATCH 03/10] usb-ehci: remove unused variables Michael S. Tsirkin
2011-06-15  6:45   ` Gerd Hoffmann
2011-06-14 17:35 ` [PATCH 04/10] lsi53c895a: " Michael S. Tsirkin
2011-06-15  9:23   ` Stefan Hajnoczi
2011-06-14 17:35 ` [PATCH 05/10] wdt: " Michael S. Tsirkin
2011-06-14 22:47   ` Isaku Yamahata
2011-06-14 17:36 ` [PATCH 06/10] kvm: " Michael S. Tsirkin
2011-06-15  7:38   ` Kevin Wolf
2011-06-15  8:25     ` Michael S. Tsirkin
2011-06-15  8:42       ` Jan Kiszka
2011-06-15 12:44   ` [Qemu-devel] " Chris Krumme
2011-06-15 18:29     ` Michael S. Tsirkin
2011-06-14 17:36 ` [PATCH 07/10] alpha/translate: remve " Michael S. Tsirkin
2011-06-14 17:47   ` Richard Henderson
2011-06-14 17:36 ` [PATCH 08/10] alpha: remove unused variable Michael S. Tsirkin
2011-06-14 17:47   ` Richard Henderson
2011-06-14 17:36 ` [PATCH 09/10] exec: " Michael S. Tsirkin
2011-06-26 11:08   ` Michael S. Tsirkin
2011-06-26 14:32     ` Stefan Hajnoczi
2011-06-14 17:36 ` [PATCH 10/10] linux-user: remove unused variables Michael S. Tsirkin
2011-06-15  8:35   ` Alexander Graf
2011-06-15  8:55     ` Michael S. Tsirkin
2011-06-15 14:32     ` Richard Henderson
2011-06-15 18:40       ` Michael S. Tsirkin
2011-06-15 23:42       ` [Qemu-devel] " Peter Maydell
2011-06-15 16:51     ` Peter Maydell
2011-06-26 11:11   ` Michael S. Tsirkin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110614224245.GF23200@valinux.co.jp \
    --to=yamahata@valinux.co.jp \
    --cc=agraf@suse.de \
    --cc=alex.williamson@redhat.com \
    --cc=aliguori@us.ibm.com \
    --cc=aurelien@aurel32.net \
    --cc=avi@redhat.com \
    --cc=blauwirbel@gmail.com \
    --cc=hch@lst.de \
    --cc=jan.kiszka@siemens.com \
    --cc=kraxel@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=kwolf@redhat.com \
    --cc=mst@redhat.com \
    --cc=mtosatti@redhat.com \
    --cc=paul@codesourcery.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=riku.voipio@iki.fi \
    --cc=rth@twiddle.net \
    --cc=stefanha@linux.vnet.ibm.com \
    --cc=weil@mail.berlios.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox