[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 17/17] pci: Remove legacy errp from pci_add_capability
From: |
Akihiko Odaki |
Subject: |
[PATCH v2 17/17] pci: Remove legacy errp from pci_add_capability |
Date: |
Sat, 22 Oct 2022 13:40:53 +0900 |
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
---
hw/pci/pci.c | 29 +++++++----------------------
1 file changed, 7 insertions(+), 22 deletions(-)
diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index 8ee2171011..8ff71e4553 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -2513,38 +2513,23 @@ static void pci_del_option_rom(PCIDevice *pdev)
}
/*
- * On success, pci_add_capability_legacy() returns a positive value
- * that the offset of the pci capability.
- * On failure, it sets an error and returns a negative error
- * code.
+ * pci_add_capability() returns a positive value that the offset of the pci
+ * capability.
*/
-int pci_add_capability_legacy(PCIDevice *pdev, uint8_t cap_id,
- uint8_t offset, uint8_t size,
- Error **errp)
+uint8_t pci_add_capability(PCIDevice *pdev, uint8_t cap_id,
+ uint8_t offset, uint8_t size)
{
uint8_t *config;
- int i, overlapping_cap;
+ int i;
if (!offset) {
offset = pci_find_space(pdev, size);
/* out of PCI config space is programming error */
assert(offset);
} else {
- /* Verify that capabilities don't overlap. Note: device assignment
- * depends on this check to verify that the device is not broken.
- * Should never trigger for emulated devices, but it's helpful
- * for debugging these. */
+ /* Verify that capabilities don't overlap. */
for (i = offset; i < offset + size; i++) {
- overlapping_cap = pci_find_capability_at_offset(pdev, i);
- if (overlapping_cap) {
- error_setg(errp, "%s:%02x:%02x.%x "
- "Attempt to add PCI capability %x at offset "
- "%x overlaps existing capability %x at offset %x",
- pci_root_bus_path(pdev), pci_dev_bus_num(pdev),
- PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn),
- cap_id, offset, overlapping_cap, i);
- return -EINVAL;
- }
+ assert(!pci_find_capability_at_offset(pdev, i));
}
}
--
2.37.3
- [PATCH v2 07/17] msi: Omit errp for pci_add_capability, (continued)
- [PATCH v2 07/17] msi: Omit errp for pci_add_capability, Akihiko Odaki, 2022/10/22
- [PATCH v2 08/17] hw/pci/pci_bridge: Omit errp for pci_add_capability, Akihiko Odaki, 2022/10/22
- [PATCH v2 09/17] pcie: Omit errp for pci_add_capability, Akihiko Odaki, 2022/10/22
- [PATCH v2 10/17] pci/shpc: Omit errp for pci_add_capability, Akihiko Odaki, 2022/10/22
- [PATCH v2 11/17] msix: Omit errp for pci_add_capability, Akihiko Odaki, 2022/10/22
- [PATCH v2 12/17] pci/slotid: Omit errp for pci_add_capability, Akihiko Odaki, 2022/10/22
- [PATCH v2 13/17] hw/pci-bridge/pcie_pci_bridge: Omit errp for pci_add_capability, Akihiko Odaki, 2022/10/22
- [PATCH v2 14/17] hw/vfio/pci-quirks: Omit errp for pci_add_capability, Akihiko Odaki, 2022/10/22
- [PATCH v2 15/17] hw/vfio/pci: Omit errp for pci_add_capability, Akihiko Odaki, 2022/10/22
- [PATCH v2 17/17] pci: Remove legacy errp from pci_add_capability,
Akihiko Odaki <=
- [PATCH v2 16/17] virtio-pci: Omit errp for pci_add_capability, Akihiko Odaki, 2022/10/22