summaryrefslogtreecommitdiff
path: root/com32/lib/pci
diff options
context:
space:
mode:
authorErwan Velu <erwan.velu@free.fr>2009-02-12 21:04:18 +0100
committerH. Peter Anvin <hpa@zytor.com>2009-02-25 20:58:40 -0800
commit04d969ce4d548d3ae4fb2dbce68caa3923153bf8 (patch)
tree028a2a7a51450246efcd9f88d4def101f3d39d93 /com32/lib/pci
parent410df54dde8dca29f58ce99a2147a3722b2c7d76 (diff)
downloadsyslinux-04d969ce4d548d3ae4fb2dbce68caa3923153bf8.tar.gz
hdt: Improving detection speed by skipping uncessary lines
Diffstat (limited to 'com32/lib/pci')
-rw-r--r--com32/lib/pci/scan.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/com32/lib/pci/scan.c b/com32/lib/pci/scan.c
index 7d11399d..06302853 100644
--- a/com32/lib/pci/scan.c
+++ b/com32/lib/pci/scan.c
@@ -256,6 +256,7 @@ int get_name_from_pci_ids(struct pci_domain *domain)
char sub_vendor_id[5];
FILE *f;
struct pci_device *dev;
+ bool skip_to_next_vendor=false;
/* Intializing the vendor/product name for each pci device to "unknown" */
/* adding a dev_info member if needed */
@@ -306,9 +307,19 @@ int get_name_from_pci_ids(struct pci_domain *domain)
/* ffff is an invalid vendor id */
if (strstr(vendor_id,"ffff")) break;
+ skip_to_next_vendor=true;
+ int int_vendor_id=hex_to_int(vendor_id);
+ for_each_pci_func(dev, domain) {
+ if (int_vendor_id == dev->vendor) {
+ skip_to_next_vendor=false;
+ continue;
+ }
+ }
/* if we have a tab + a char, it means this is a product id */
} else if ((line[0] == '\t') && (line[1] != '\t')) {
+ if (skip_to_next_vendor == true) continue;
+
/* the product name the second field */
strlcpy(product,skipspace(strstr(line," ")),255);
remove_eol(product);
@@ -335,6 +346,8 @@ int get_name_from_pci_ids(struct pci_domain *domain)
/* if we have two tabs, it means this is a sub product */
} else if ((line[0] == '\t') && (line[1] == '\t')) {
+ if (skip_to_next_vendor == true) continue;
+
/* the product name is last field */
strlcpy(product,skipspace(strstr(line," ")),255);
strlcpy(product,skipspace(strstr(product," ")),255);