mirror of https://github.com/xemu-project/xemu.git
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>
This commit is contained in:
parent
c2c1397497
commit
ef21900951
|
@ -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)
|
static void pcibus_dev_print(Monitor *mon, DeviceState *dev, int indent)
|
||||||
{
|
{
|
||||||
PCIDevice *d = (PCIDevice *)dev;
|
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];
|
char ctxt[64];
|
||||||
PCIIORegion *r;
|
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) {
|
if (desc->desc) {
|
||||||
snprintf(ctxt, sizeof(ctxt), "%s", desc->desc);
|
snprintf(ctxt, sizeof(ctxt), "%s", desc->desc);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue