qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH 1/6] pci: remove pci_config_set_vendor_id


From: Hu Tao
Subject: [Qemu-devel] [PATCH 1/6] pci: remove pci_config_set_vendor_id
Date: Wed, 5 Nov 2014 17:50:41 +0800

Use pci_set_word() instead. The main purpose is for API
consistency. Detailed reasons:

  - pci_config_set_* are not complete. 1) Only part of registers in
    predefined header portion of PCI Configuration Space are
    supported. 2) Lack of get_ counterparts.

  - pci_set_word() and friends are extensively used in qemu. They
    are used both for predefined registers and device specific
    registers.

  - another option is to complete the pci_config_set_* for all
    predefined registers (though they will co-exist with pci_set_*).
    Hence the RFC.

Signed-off-by: Hu Tao <address@hidden>
---
 hw/pci/pci.c         | 2 +-
 include/hw/pci/pci.h | 6 ------
 2 files changed, 1 insertion(+), 7 deletions(-)

diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index 371699c..6c544ed 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -840,7 +840,7 @@ static PCIDevice *do_pci_register_device(PCIDevice 
*pci_dev, PCIBus *bus,
     pci_dev->irq_state = 0;
     pci_config_alloc(pci_dev);
 
-    pci_config_set_vendor_id(pci_dev->config, pc->vendor_id);
+    pci_set_word(pci_dev->config + PCI_VENDOR_ID, pc->vendor_id);
     pci_config_set_device_id(pci_dev->config, pc->device_id);
     pci_config_set_revision(pci_dev->config, pc->revision);
     pci_config_set_class(pci_dev->config, pc->class_id);
diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h
index c352c7b..390aa83 100644
--- a/include/hw/pci/pci.h
+++ b/include/hw/pci/pci.h
@@ -462,12 +462,6 @@ pci_get_quad(const uint8_t *config)
 }
 
 static inline void
-pci_config_set_vendor_id(uint8_t *pci_config, uint16_t val)
-{
-    pci_set_word(&pci_config[PCI_VENDOR_ID], val);
-}
-
-static inline void
 pci_config_set_device_id(uint8_t *pci_config, uint16_t val)
 {
     pci_set_word(&pci_config[PCI_DEVICE_ID], val);
-- 
1.9.3




reply via email to

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