diff options
Diffstat (limited to 'scripts/mod')
| -rw-r--r-- | scripts/mod/file2alias.c | 75 | ||||
| -rw-r--r-- | scripts/mod/modpost.c | 6 | 
2 files changed, 79 insertions, 2 deletions
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c index 4c9890ec2528..d4dc222a74f3 100644 --- a/scripts/mod/file2alias.c +++ b/scripts/mod/file2alias.c  | |||
| @@ -206,6 +206,20 @@ static void do_usb_table(void *symval, unsigned long size, | |||
| 206 | do_usb_entry_multi(symval + i, mod); | 206 | do_usb_entry_multi(symval + i, mod); | 
| 207 | } | 207 | } | 
| 208 | 208 | ||
| 209 | /* Looks like: hid:bNvNpN */ | ||
| 210 | static int do_hid_entry(const char *filename, | ||
| 211 | struct hid_device_id *id, char *alias) | ||
| 212 | { | ||
| 213 | id->vendor = TO_NATIVE(id->vendor); | ||
| 214 | id->product = TO_NATIVE(id->product); | ||
| 215 | |||
| 216 | sprintf(alias, "hid:b%04X", id->bus); | ||
| 217 | ADD(alias, "v", id->vendor != HID_ANY_ID, id->vendor); | ||
| 218 | ADD(alias, "p", id->product != HID_ANY_ID, id->product); | ||
| 219 | |||
| 220 | return 1; | ||
| 221 | } | ||
| 222 | |||
| 209 | /* Looks like: ieee1394:venNmoNspNverN */ | 223 | /* Looks like: ieee1394:venNmoNspNverN */ | 
| 210 | static int do_ieee1394_entry(const char *filename, | 224 | static int do_ieee1394_entry(const char *filename, | 
| 211 | struct ieee1394_device_id *id, char *alias) | 225 | struct ieee1394_device_id *id, char *alias) | 
| @@ -629,6 +643,59 @@ static int do_i2c_entry(const char *filename, struct i2c_device_id *id, | |||
| 629 | return 1; | 643 | return 1; | 
| 630 | } | 644 | } | 
| 631 | 645 | ||
| 646 | static const struct dmifield { | ||
| 647 | const char *prefix; | ||
| 648 | int field; | ||
| 649 | } dmi_fields[] = { | ||
| 650 | { "bvn", DMI_BIOS_VENDOR }, | ||
| 651 | { "bvr", DMI_BIOS_VERSION }, | ||
| 652 | { "bd", DMI_BIOS_DATE }, | ||
| 653 | { "svn", DMI_SYS_VENDOR }, | ||
| 654 | { "pn", DMI_PRODUCT_NAME }, | ||
| 655 | { "pvr", DMI_PRODUCT_VERSION }, | ||
| 656 | { "rvn", DMI_BOARD_VENDOR }, | ||
| 657 | { "rn", DMI_BOARD_NAME }, | ||
| 658 | { "rvr", DMI_BOARD_VERSION }, | ||
| 659 | { "cvn", DMI_CHASSIS_VENDOR }, | ||
| 660 | { "ct", DMI_CHASSIS_TYPE }, | ||
| 661 | { "cvr", DMI_CHASSIS_VERSION }, | ||
| 662 | { NULL, DMI_NONE } | ||
| 663 | }; | ||
| 664 | |||
| 665 | static void dmi_ascii_filter(char *d, const char *s) | ||
| 666 | { | ||
| 667 | /* Filter out characters we don't want to see in the modalias string */ | ||
| 668 | for (; *s; s++) | ||
| 669 | if (*s > ' ' && *s < 127 && *s != ':') | ||
| 670 | *(d++) = *s; | ||
| 671 | |||
| 672 | *d = 0; | ||
| 673 | } | ||
| 674 | |||
| 675 | |||
| 676 | static int do_dmi_entry(const char *filename, struct dmi_system_id *id, | ||
| 677 | char *alias) | ||
| 678 | { | ||
| 679 | int i, j; | ||
| 680 | |||
| 681 | sprintf(alias, "dmi*"); | ||
| 682 | |||
| 683 | for (i = 0; i < ARRAY_SIZE(dmi_fields); i++) { | ||
| 684 | for (j = 0; j < 4; j++) { | ||
| 685 | if (id->matches[j].slot && | ||
| 686 | id->matches[j].slot == dmi_fields[i].field) { | ||
| 687 | sprintf(alias + strlen(alias), ":%s*", | ||
| 688 | dmi_fields[i].prefix); | ||
| 689 | dmi_ascii_filter(alias + strlen(alias), | ||
| 690 | id->matches[j].substr); | ||
| 691 | strcat(alias, "*"); | ||
| 692 | } | ||
| 693 | } | ||
| 694 | } | ||
| 695 | |||
| 696 | strcat(alias, ":"); | ||
| 697 | return 1; | ||
| 698 | } | ||
| 632 | /* Ignore any prefix, eg. some architectures prepend _ */ | 699 | /* Ignore any prefix, eg. some architectures prepend _ */ | 
| 633 | static inline int sym_is(const char *symbol, const char *name) | 700 | static inline int sym_is(const char *symbol, const char *name) | 
| 634 | { | 701 | { | 
| @@ -692,6 +759,10 @@ void handle_moddevtable(struct module *mod, struct elf_info *info, | |||
| 692 | else if (sym_is(symname, "__mod_usb_device_table")) | 759 | else if (sym_is(symname, "__mod_usb_device_table")) | 
| 693 | /* special case to handle bcdDevice ranges */ | 760 | /* special case to handle bcdDevice ranges */ | 
| 694 | do_usb_table(symval, sym->st_size, mod); | 761 | do_usb_table(symval, sym->st_size, mod); | 
| 762 | else if (sym_is(symname, "__mod_hid_device_table")) | ||
| 763 | do_table(symval, sym->st_size, | ||
| 764 | sizeof(struct hid_device_id), "hid", | ||
| 765 | do_hid_entry, mod); | ||
| 695 | else if (sym_is(symname, "__mod_ieee1394_device_table")) | 766 | else if (sym_is(symname, "__mod_ieee1394_device_table")) | 
| 696 | do_table(symval, sym->st_size, | 767 | do_table(symval, sym->st_size, | 
| 697 | sizeof(struct ieee1394_device_id), "ieee1394", | 768 | sizeof(struct ieee1394_device_id), "ieee1394", | 
| @@ -760,6 +831,10 @@ void handle_moddevtable(struct module *mod, struct elf_info *info, | |||
| 760 | do_table(symval, sym->st_size, | 831 | do_table(symval, sym->st_size, | 
| 761 | sizeof(struct i2c_device_id), "i2c", | 832 | sizeof(struct i2c_device_id), "i2c", | 
| 762 | do_i2c_entry, mod); | 833 | do_i2c_entry, mod); | 
| 834 | else if (sym_is(symname, "__mod_dmi_device_table")) | ||
| 835 | do_table(symval, sym->st_size, | ||
| 836 | sizeof(struct dmi_system_id), "dmi", | ||
| 837 | do_dmi_entry, mod); | ||
| 763 | free(zeros); | 838 | free(zeros); | 
| 764 | } | 839 | } | 
| 765 | 840 | ||
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 418cd7dbbc93..8e0de6a5e18a 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c  | |||
| @@ -1986,11 +1986,13 @@ static void read_markers(const char *fname) | |||
| 1986 | 1986 | ||
| 1987 | mod = find_module(modname); | 1987 | mod = find_module(modname); | 
| 1988 | if (!mod) { | 1988 | if (!mod) { | 
| 1989 | if (is_vmlinux(modname)) | ||
| 1990 | have_vmlinux = 1; | ||
| 1991 | mod = new_module(NOFAIL(strdup(modname))); | 1989 | mod = new_module(NOFAIL(strdup(modname))); | 
| 1992 | mod->skip = 1; | 1990 | mod->skip = 1; | 
| 1993 | } | 1991 | } | 
| 1992 | if (is_vmlinux(modname)) { | ||
| 1993 | have_vmlinux = 1; | ||
| 1994 | mod->skip = 0; | ||
| 1995 | } | ||
| 1994 | 1996 | ||
| 1995 | if (!mod->skip) | 1997 | if (!mod->skip) | 
| 1996 | add_marker(mod, marker, fmt); | 1998 | add_marker(mod, marker, fmt); | 
