From a9c2e1645ebeb5d369d10aca48754dfefeb375ec Mon Sep 17 00:00:00 2001 From: Erwan Velu Date: Mon, 16 Feb 2009 16:41:57 +0100 Subject: [PATCH] hdt: We have to iterate & copy the vendor name to all matching pci devices as all pci devices might not have a matching vendor/product id. This will help us having the proper vendor device with an unknown product. --- com32/lib/pci/scan.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/com32/lib/pci/scan.c b/com32/lib/pci/scan.c index 54b5f54..d7c189f 100644 --- a/com32/lib/pci/scan.c +++ b/com32/lib/pci/scan.c @@ -311,15 +311,23 @@ int get_name_from_pci_ids(struct pci_domain *domain) strlcpy(sub_product_id,"0000",4); strlcpy(sub_vendor_id,"0000",4); + /* Unless we found a matching device, we have to skip to the next vendor */ skip_to_next_vendor=true; + int_vendor_id=hex_to_int(vendor_id); + /* Iterate in all pci devices to find a matching vendor */ for_each_pci_func(dev, domain) { + /* if one device that match this vendor */ if (int_vendor_id == dev->vendor) { - skip_to_next_vendor=false; - continue; + /* copy the vendor name for this device */ + strlcpy(dev->dev_info->vendor_name,vendor,PCI_VENDOR_NAME_SIZE-1); + /* Some pci devices match this vendor, so we have to found them */ + skip_to_next_vendor=false; + /* Let's loop on the other devices as some may have the same vendor */ } } - /* if we have a tab + a char, it means this is a product id */ + /* if we have a tab + a char, it means this is a product id + * but we only look at it if we own some pci devices of the current vendor*/ } else if ((line[0] == '\t') && (line[1] != '\t') && (skip_to_next_vendor == false)) { /* the product name the second field */ @@ -345,7 +353,8 @@ int get_name_from_pci_ids(struct pci_domain *domain) } } - /* if we have two tabs, it means this is a sub product */ + /* if we have two tabs, it means this is a sub product + * but we only look at it if we own some pci devices of the current vendor*/ } else if ((line[0] == '\t') && (line[1] == '\t') && (skip_to_next_vendor == false)) { /* the product name is last field */ -- 2.7.4