Skip to contentSkip to conversation

pci: clean up of pci_set_default_subsystem_id().

PATCH Applied Isaku Yamahata 2 participants 2 messages May 27, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pci: clean up of pci_set_default_subsystem_id().

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

---
 hw/pci.c |   12 +++++-------
 1 files changed, 5 insertions(+), 7 deletions(-)
hw/pci.c +5 -7
index 8d84651..3362842 100644
@@ -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);
 }
 
 /*
Signature · 1 line
1.6.6.1
#1 lore raw
Quoted 5 lines · Isaku Yamahata

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

Applied, thanks!

Quoted 31 lines
---
 hw/pci.c |   12 +++++-------
 1 files changed, 5 insertions(+), 7 deletions(-)
hw/pci.c +5 -7
index 8d84651..3362842 100644
@@ -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);
 }
 
 /*
Signature · 1 line
1.6.6.1