aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErwan Velu <erwan.velu@free.fr>2009-11-30 11:02:49 +0100
committerErwan Velu <erwan.velu@free.fr>2009-12-04 10:11:16 +0100
commit85d9a1a29bfecccc6c98d624c82b2d742b653a32 (patch)
treeeababc7e0b698202391beaf173a82238edf20019
parent9a7a7f6db7abddbc5973ba5db0c9ca0340318bec (diff)
downloadsyslinux.git-85d9a1a29bfecccc6c98d624c82b2d742b653a32.tar.gz
syslinux.git-85d9a1a29bfecccc6c98d624c82b2d742b653a32.tar.xz
syslinux.git-85d9a1a29bfecccc6c98d624c82b2d742b653a32.zip
pci: replace '-' by '_' in modules names
Impact: avoid kernel modules duplication In modules.pcimap, kernel modules name are featuring '_' or '-' whereas modules.alias is only using '_'. To avoid kernel modules duplication, let's rename all '-' by '_' to match what modules.alias provides This avoid stupid duplications like "a-b" & "a_b" whereas they are in fact the same kernel module
-rw-r--r--com32/lib/pci/scan.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/com32/lib/pci/scan.c b/com32/lib/pci/scan.c
index a3a804f7..65d80157 100644
--- a/com32/lib/pci/scan.c
+++ b/com32/lib/pci/scan.c
@@ -74,6 +74,15 @@ static int hex_to_int(char *hexa)
return strtoul(hexa, NULL, 16);
}
+/* Replace char 'old' by char 'new' in source */
+void chr_replace(char *source, char old, char new)
+{
+ while (*source) {
+ source++;
+ if (source[0] == old) source[0]=new;
+ }
+}
+
/* Try to match any pci device to the appropriate kernel module */
/* it uses the modules.pcimap from the boot device */
int get_module_name_from_pcimap(struct pci_domain *domain,
@@ -130,7 +139,11 @@ int get_module_name_from_pcimap(struct pci_domain *domain,
/* multiple spaces generates some empty fields */
if (strlen(result)>1) {
switch (field) {
- case 0:strcpy(module_name,result); break;
+ /* About case 0, the kernel module name is featuring '_' or '-'
+ * in the module name whereas modules.alias is only using '_'.
+ * To avoid kernel modules duplication, let's rename all '-' in '_'
+ * to match what modules.alias provides */
+ case 0:chr_replace(result,'-','_');strcpy(module_name,result); break;
case 1:strcpy(vendor_id,result); break;
case 2:strcpy(product_id,result); break;
case 3:strcpy(sub_vendor_id,result); break;