diff options
author | Erwan Velu <erwan.velu@free.fr> | 2009-11-30 11:02:49 +0100 |
---|---|---|
committer | Erwan Velu <erwan.velu@free.fr> | 2009-12-04 10:11:16 +0100 |
commit | 85d9a1a29bfecccc6c98d624c82b2d742b653a32 (patch) | |
tree | eababc7e0b698202391beaf173a82238edf20019 /com32/lib/pci/scan.c | |
parent | 9a7a7f6db7abddbc5973ba5db0c9ca0340318bec (diff) | |
download | syslinux-85d9a1a29bfecccc6c98d624c82b2d742b653a32.tar.gz |
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
Diffstat (limited to 'com32/lib/pci/scan.c')
-rw-r--r-- | com32/lib/pci/scan.c | 15 |
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; |