From ef6c9ec3a45992d9e7ef4716d444252baf2013e1 Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Mon, 14 Sep 2015 17:44:45 +0200 Subject: [PATCH] lspci calls pci_fill_info() only as needed Previously, lspci always asked for all attributes, even in terse mode where most of them are not shown. --- lspci.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lspci.c b/lspci.c index 219e260..fe7b7fe 100644 --- a/lspci.c +++ b/lspci.c @@ -1,7 +1,7 @@ /* * The PCI Utilities -- List All PCI Devices * - * Copyright (c) 1997--2008 Martin Mares + * Copyright (c) 1997--2015 Martin Mares * * Can be freely distributed and used under the terms of the GNU GPL. */ @@ -138,9 +138,7 @@ scan_device(struct pci_dev *p) d->config_cached += 64; } pci_setup_cache(p, d->config, d->config_cached); - pci_fill_info(p, PCI_FILL_IDENT | PCI_FILL_CLASS | PCI_FILL_IRQ | PCI_FILL_BASES | - PCI_FILL_ROM_BASE | PCI_FILL_SIZES | PCI_FILL_PHYS_SLOT | PCI_FILL_LABEL | - PCI_FILL_NUMA_NODE); + pci_fill_info(p, PCI_FILL_IDENT | PCI_FILL_CLASS); return d; } @@ -655,10 +653,14 @@ show_verbose(struct device *d) byte cache_line = get_conf_byte(d, PCI_CACHE_LINE_SIZE); byte max_lat, min_gnt; byte int_pin = get_conf_byte(d, PCI_INTERRUPT_PIN); - unsigned int irq = p->irq; + unsigned int irq; show_terse(d); + pci_fill_info(p, PCI_FILL_IRQ | PCI_FILL_BASES | PCI_FILL_ROM_BASE | PCI_FILL_SIZES | + PCI_FILL_PHYS_SLOT | PCI_FILL_LABEL | PCI_FILL_NUMA_NODE); + irq = p->irq; + switch (htype) { case PCI_HEADER_TYPE_NORMAL: @@ -838,6 +840,7 @@ show_machine(struct device *d) if (verbose) { + pci_fill_info(p, PCI_FILL_PHYS_SLOT | PCI_FILL_NUMA_NODE); printf((opt_machine >= 2) ? "Slot:\t" : "Device:\t"); show_slot_name(d); putchar('\n'); -- 2.39.2