aboutsummaryrefslogtreecommitdiff
path: root/hw/pci/pci.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2022-12-01 13:11:26 +0100
committerMarkus Armbruster <armbru@redhat.com>2022-12-19 16:21:56 +0100
commitef21900951bb2f5510ce4b238f167e93ca2a11fd (patch)
tree824cbea456db124d85e8f24754adf8e5b7115ff9 /hw/pci/pci.c
parentc2c139749733545516ffff0b54f949bb3343711f (diff)
pci: Deduplicate get_class_desc()
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> Message-Id: <20221201121133.3813857-7-armbru@redhat.com>
Diffstat (limited to 'hw/pci/pci.c')
-rw-r--r--hw/pci/pci.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index 7310a82cee..41718aaf60 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 {