qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] pci: clean up of pci_set_default_subsystem_id().
@ 2010-05-27  5:42 Isaku Yamahata
  2010-05-27 14:10 ` [Qemu-devel] " Michael S. Tsirkin
  0 siblings, 1 reply; 2+ messages in thread
From: Isaku Yamahata @ 2010-05-27  5:42 UTC (permalink / raw)
  To: qemu-devel

Use pci accessor function.
don't return value because it always return 0 and
the caller doesn't check the return value.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
 hw/pci.c |   12 +++++-------
 1 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/hw/pci.c b/hw/pci.c
index 8d84651..3362842 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -419,14 +419,12 @@ int pci_device_load(PCIDevice *s, QEMUFile *f)
     return ret;
 }
 
-static int pci_set_default_subsystem_id(PCIDevice *pci_dev)
+static void pci_set_default_subsystem_id(PCIDevice *pci_dev)
 {
-    uint16_t *id;
-
-    id = (void*)(&pci_dev->config[PCI_SUBSYSTEM_VENDOR_ID]);
-    id[0] = cpu_to_le16(pci_default_sub_vendor_id);
-    id[1] = cpu_to_le16(pci_default_sub_device_id);
-    return 0;
+    pci_set_word(pci_dev->config + PCI_SUBSYSTEM_VENDOR_ID,
+                 pci_default_sub_vendor_id);
+    pci_set_word(pci_dev->config + PCI_SUBSYSTEM_ID,
+                 pci_default_sub_device_id);
 }
 
 /*
-- 
1.6.6.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [Qemu-devel] Re: [PATCH] pci: clean up of pci_set_default_subsystem_id().
  2010-05-27  5:42 [Qemu-devel] [PATCH] pci: clean up of pci_set_default_subsystem_id() Isaku Yamahata
@ 2010-05-27 14:10 ` Michael S. Tsirkin
  0 siblings, 0 replies; 2+ messages in thread
From: Michael S. Tsirkin @ 2010-05-27 14:10 UTC (permalink / raw)
  To: Isaku Yamahata; +Cc: qemu-devel

On Thu, May 27, 2010 at 02:42:06PM +0900, Isaku Yamahata wrote:
> Use pci accessor function.
> don't return value because it always return 0 and
> the caller doesn't check the return value.
> 
> Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>

Applied, thanks!

> ---
>  hw/pci.c |   12 +++++-------
>  1 files changed, 5 insertions(+), 7 deletions(-)
> 
> diff --git a/hw/pci.c b/hw/pci.c
> index 8d84651..3362842 100644
> --- a/hw/pci.c
> +++ b/hw/pci.c
> @@ -419,14 +419,12 @@ int pci_device_load(PCIDevice *s, QEMUFile *f)
>      return ret;
>  }
>  
> -static int pci_set_default_subsystem_id(PCIDevice *pci_dev)
> +static void pci_set_default_subsystem_id(PCIDevice *pci_dev)
>  {
> -    uint16_t *id;
> -
> -    id = (void*)(&pci_dev->config[PCI_SUBSYSTEM_VENDOR_ID]);
> -    id[0] = cpu_to_le16(pci_default_sub_vendor_id);
> -    id[1] = cpu_to_le16(pci_default_sub_device_id);
> -    return 0;
> +    pci_set_word(pci_dev->config + PCI_SUBSYSTEM_VENDOR_ID,
> +                 pci_default_sub_vendor_id);
> +    pci_set_word(pci_dev->config + PCI_SUBSYSTEM_ID,
> +                 pci_default_sub_device_id);
>  }
>  
>  /*
> -- 
> 1.6.6.1
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-05-27 14:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-27  5:42 [Qemu-devel] [PATCH] pci: clean up of pci_set_default_subsystem_id() Isaku Yamahata
2010-05-27 14:10 ` [Qemu-devel] " Michael S. Tsirkin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).