[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 06/13] pci: Deduplicate get_class_desc()
From: |
Markus Armbruster |
Subject: |
[PATCH v2 06/13] pci: Deduplicate get_class_desc() |
Date: |
Thu, 1 Dec 2022 13:11:26 +0100 |
pcibus_dev_print() contains a copy of get_class_desc(). Call the
function instead.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
---
hw/pci/pci.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index 81ffc74925..6711a75098 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -2409,15 +2409,12 @@ uint8_t pci_find_capability(PCIDevice *pdev, uint8_t
cap_id)
static void pcibus_dev_print(Monitor *mon, DeviceState *dev, int indent)
{
PCIDevice *d = (PCIDevice *)dev;
- const pci_class_desc *desc;
+ int class = pci_get_word(d->config + PCI_CLASS_DEVICE);
+ const pci_class_desc *desc = get_class_desc(class);
char ctxt[64];
PCIIORegion *r;
- int i, class;
+ int i;
- class = pci_get_word(d->config + PCI_CLASS_DEVICE);
- desc = pci_class_descriptions;
- while (desc->desc && class != desc->class)
- desc++;
if (desc->desc) {
snprintf(ctxt, sizeof(ctxt), "%s", desc->desc);
} else {
--
2.37.3
- [PATCH v2 00/13] pci: Move and clean up monitor command code, Markus Armbruster, 2022/12/01
- [PATCH v2 04/13] pci: Make query-pci stub consistent with the real one, Markus Armbruster, 2022/12/01
- [PATCH v2 02/13] pci: Move QMP commands to new hw/pci/pci-qmp-cmds.c, Markus Armbruster, 2022/12/01
- [PATCH v2 05/13] pci: Build hw/pci/pci-hmp-cmds.c only when CONFIG_PCI, Markus Armbruster, 2022/12/01
- [PATCH v2 08/13] pci: Fix silent truncation of pcie_aer_inject_error argument, Markus Armbruster, 2022/12/01
- [PATCH v2 06/13] pci: Deduplicate get_class_desc(),
Markus Armbruster <=
- [PATCH v2 10/13] pci: Inline do_pcie_aer_inject_error() into its only caller, Markus Armbruster, 2022/12/01
- [PATCH v2 07/13] pci: Move pcibus_dev_print() to pci-hmp-cmds.c, Markus Armbruster, 2022/12/01
- [PATCH v2 11/13] pci: Rename hmp_pcie_aer_inject_error()'s local variable @err, Markus Armbruster, 2022/12/01
- [PATCH v2 09/13] pci: Move HMP command from hw/pci/pcie_aer.c to pci-hmp-cmds.c, Markus Armbruster, 2022/12/01
- [PATCH v2 13/13] pci: Reject pcie_aer_inject_error -c with symbolic error status, Markus Armbruster, 2022/12/01
- [PATCH v2 03/13] pci: Move HMP commands from monitor/ to new hw/pci/pci-hmp-cmds.c, Markus Armbruster, 2022/12/01
- [PATCH v2 01/13] pci: Clean up a few things checkpatch.pl would flag later on, Markus Armbruster, 2022/12/01
- [PATCH v2 12/13] pci: Improve do_pcie_aer_inject_error()'s error messages, Markus Armbruster, 2022/12/01