== 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++;
+ }
}
}
}
== 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++;
+ }
}
}
}