]> git.ipfire.org Git - thirdparty/pciutils.git/commitdiff
lspci calls pci_fill_info() only as needed
authorMartin Mares <mj@ucw.cz>
Mon, 14 Sep 2015 15:44:45 +0000 (17:44 +0200)
committerMartin Mares <mj@ucw.cz>
Mon, 14 Sep 2015 15:44:45 +0000 (17:44 +0200)
Previously, lspci always asked for all attributes, even in terse
mode where most of them are not shown.

lspci.c

diff --git a/lspci.c b/lspci.c
index 219e260deff21037e742bce72b83a477aead75e1..fe7b7fe0fd6c49fa140afeba77d2816e0c2699ff 100644 (file)
--- a/lspci.c
+++ b/lspci.c
@@ -1,7 +1,7 @@
 /*
  *     The PCI Utilities -- List All PCI Devices
  *
- *     Copyright (c) 1997--2008 Martin Mares <mj@ucw.cz>
+ *     Copyright (c) 1997--2015 Martin Mares <mj@ucw.cz>
  *
  *     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');