]> mj.ucw.cz Git - pciutils.git/blobdiff - lib/caps.c
libpci: Do not build physmem-posix.c when not needed
[pciutils.git] / lib / caps.c
index 1fca141679884f38588c0c49a389733cba5eeddb..cf1df5d581121a62978630ec864b75345199092c 100644 (file)
@@ -3,7 +3,9 @@
  *
  *     Copyright (c) 2008 Martin Mares <mj@ucw.cz>
  *
- *     Can be freely distributed and used under the terms of the GNU GPL.
+ *     Can be freely distributed and used under the terms of the GNU GPL v2+.
+ *
+ *     SPDX-License-Identifier: GPL-2.0-or-later
  */
 
 #include <string.h>
@@ -80,17 +82,16 @@ pci_scan_ext_caps(struct pci_dev *d)
   while (where);
 }
 
-unsigned int
+void
 pci_scan_caps(struct pci_dev *d, unsigned int want_fields)
 {
-  if ((want_fields & PCI_FILL_EXT_CAPS) && !(d->known_fields & PCI_FILL_CAPS))
+  if (want_fields & PCI_FILL_EXT_CAPS)
     want_fields |= PCI_FILL_CAPS;
 
-  if (want_fields & PCI_FILL_CAPS)
+  if (want_fill(d, want_fields, PCI_FILL_CAPS))
     pci_scan_trad_caps(d);
-  if (want_fields & PCI_FILL_EXT_CAPS)
+  if (want_fill(d, want_fields, PCI_FILL_EXT_CAPS))
     pci_scan_ext_caps(d);
-  return want_fields;
 }
 
 void
@@ -117,8 +118,8 @@ pci_find_cap(struct pci_dev *d, unsigned int id, unsigned int type)
  * To select one capability if there are more than one with the same id, you
  * can provide a pointer to an unsigned int that contains the index which you
  * want as cap_number. If you don't care and are fine with the first one you
- * can supply NULL. The cap_number will be replaced by the acutal number
- * of capablities with that id.
+ * can supply NULL. The cap_number will be replaced by the actual number
+ * of capabilities with that id.
  */
 struct pci_cap *
 pci_find_cap_nr(struct pci_dev *d, unsigned int id, unsigned int type,
@@ -129,7 +130,7 @@ pci_find_cap_nr(struct pci_dev *d, unsigned int id, unsigned int type,
   unsigned int target = (cap_number ? *cap_number : 0);
   unsigned int index = 0;
 
-  pci_fill_info_v35(d, ((type == PCI_CAP_NORMAL) ? PCI_FILL_CAPS : PCI_FILL_EXT_CAPS));
+  pci_fill_info_v38(d, ((type == PCI_CAP_NORMAL) ? PCI_FILL_CAPS : PCI_FILL_EXT_CAPS));
 
   for (c=d->first_cap; c; c=c->next)
     {