aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--com32/lib/pci/scan.c36
1 files changed, 32 insertions, 4 deletions
diff --git a/com32/lib/pci/scan.c b/com32/lib/pci/scan.c
index 82a7c844..55b178dd 100644
--- a/com32/lib/pci/scan.c
+++ b/com32/lib/pci/scan.c
@@ -154,8 +154,22 @@ int get_module_name_from_pcimap(struct pci_domain *domain,
== dev->sub_product &&
(int_sub_vendor_id & dev->sub_vendor)
== dev->sub_vendor) {
- strcpy(dev->dev_info->linux_kernel_module[dev->dev_info->linux_kernel_module_count], module_name);
- dev->dev_info->linux_kernel_module_count++;
+ bool found=false;
+
+ /* Scan all known kernel modules for this pci device */
+ for (int i=0; i<dev->dev_info->linux_kernel_module_count; i++) {
+
+ /* Try to detect if we already knew the same kernel module*/
+ if (strstr(dev->dev_info->linux_kernel_module[i], module_name)) {
+ found=true;
+ break;
+ }
+ }
+ /* If we don't have this kernel module, let's add it */
+ if (!found) {
+ strcpy(dev->dev_info->linux_kernel_module[dev->dev_info->linux_kernel_module_count], module_name);
+ dev->dev_info->linux_kernel_module_count++;
+ }
}
}
}
@@ -702,8 +716,22 @@ int get_module_name_from_alias(struct pci_domain *domain, char *modules_alias_pa
== dev->sub_product &&
(int_sub_vendor_id & dev->sub_vendor)
== dev->sub_vendor) {
- strcpy(dev->dev_info->linux_kernel_module[dev->dev_info->linux_kernel_module_count], module_name);
- dev->dev_info->linux_kernel_module_count++;
+ bool found=false;
+
+ /* Scan all known kernel modules for this pci device */
+ for (int i=0; i<dev->dev_info->linux_kernel_module_count; i++) {
+
+ /* Try to detect if we already knew the same kernel module*/
+ if (strstr(dev->dev_info->linux_kernel_module[i], module_name)) {
+ found=true;
+ break;
+ }
+ }
+ /* If we don't have this kernel module, let's add it */
+ if (!found) {
+ strcpy(dev->dev_info->linux_kernel_module[dev->dev_info->linux_kernel_module_count], module_name);
+ dev->dev_info->linux_kernel_module_count++;
+ }
}
}
}