diff options
Diffstat (limited to 'scripts/mod')
| -rw-r--r-- | scripts/mod/file2alias.c | 70 | ||||
| -rw-r--r-- | scripts/mod/modpost.c | 27 | 
2 files changed, 83 insertions, 14 deletions
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c index 348d8687b7c9..e04c4218cb52 100644 --- a/scripts/mod/file2alias.c +++ b/scripts/mod/file2alias.c  | |||
| @@ -328,19 +328,52 @@ static int do_pnp_entry(const char *filename, | |||
| 328 | return 1; | 328 | return 1; | 
| 329 | } | 329 | } | 
| 330 | 330 | ||
| 331 | /* looks like: "pnp:cCdD..." */ | 331 | /* looks like: "pnp:dD" for every device of the card */ | 
| 332 | static int do_pnp_card_entry(const char *filename, | 332 | static void do_pnp_card_entries(void *symval, unsigned long size, | 
| 333 | struct pnp_card_device_id *id, char *alias) | 333 | struct module *mod) | 
| 334 | { | 334 | { | 
| 335 | int i; | 335 | const unsigned long id_size = sizeof(struct pnp_card_device_id); | 
| 336 | const unsigned int count = (size / id_size)-1; | ||
| 337 | const struct pnp_card_device_id *cards = symval; | ||
| 338 | unsigned int i; | ||
| 336 | 339 | ||
| 337 | sprintf(alias, "pnp:c%s", id->id); | 340 | device_id_check(mod->name, "pnp", size, id_size, symval); | 
| 338 | for (i = 0; i < PNP_MAX_DEVICES; i++) { | 341 | |
| 339 | if (! *id->devs[i].id) | 342 | for (i = 0; i < count; i++) { | 
| 340 | break; | 343 | unsigned int j; | 
| 341 | sprintf(alias + strlen(alias), "d%s", id->devs[i].id); | 344 | const struct pnp_card_device_id *card = &cards[i]; | 
| 345 | |||
| 346 | for (j = 0; j < PNP_MAX_DEVICES; j++) { | ||
| 347 | const char *id = (char *)card->devs[j].id; | ||
| 348 | int i2, j2; | ||
| 349 | int dup = 0; | ||
| 350 | |||
| 351 | if (!id[0]) | ||
| 352 | break; | ||
| 353 | |||
| 354 | /* find duplicate, already added value */ | ||
| 355 | for (i2 = 0; i2 < i && !dup; i2++) { | ||
| 356 | const struct pnp_card_device_id *card2 = &cards[i2]; | ||
| 357 | |||
| 358 | for (j2 = 0; j2 < PNP_MAX_DEVICES; j2++) { | ||
| 359 | const char *id2 = (char *)card2->devs[j2].id; | ||
| 360 | |||
| 361 | if (!id2[0]) | ||
| 362 | break; | ||
| 363 | |||
| 364 | if (!strcmp(id, id2)) { | ||
| 365 | dup = 1; | ||
| 366 | break; | ||
| 367 | } | ||
| 368 | } | ||
| 369 | } | ||
| 370 | |||
| 371 | /* add an individual alias for every device entry */ | ||
| 372 | if (!dup) | ||
| 373 | buf_printf(&mod->dev_table_buf, | ||
| 374 | "MODULE_ALIAS(\"pnp:d%s*\");\n", id); | ||
| 375 | } | ||
| 342 | } | 376 | } | 
| 343 | return 1; | ||
| 344 | } | 377 | } | 
| 345 | 378 | ||
| 346 | /* Looks like: pcmcia:mNcNfNfnNpfnNvaNvbNvcNvdN. */ | 379 | /* Looks like: pcmcia:mNcNfNfnNpfnNvaNvbNvcNvdN. */ | 
| @@ -543,6 +576,15 @@ static int do_virtio_entry(const char *filename, struct virtio_device_id *id, | |||
| 543 | return 1; | 576 | return 1; | 
| 544 | } | 577 | } | 
| 545 | 578 | ||
| 579 | /* Looks like: i2c:S */ | ||
| 580 | static int do_i2c_entry(const char *filename, struct i2c_device_id *id, | ||
| 581 | char *alias) | ||
| 582 | { | ||
| 583 | sprintf(alias, I2C_MODULE_PREFIX "%s", id->name); | ||
| 584 | |||
| 585 | return 1; | ||
| 586 | } | ||
| 587 | |||
| 546 | /* Ignore any prefix, eg. v850 prepends _ */ | 588 | /* Ignore any prefix, eg. v850 prepends _ */ | 
| 547 | static inline int sym_is(const char *symbol, const char *name) | 589 | static inline int sym_is(const char *symbol, const char *name) | 
| 548 | { | 590 | { | 
| @@ -634,9 +676,7 @@ void handle_moddevtable(struct module *mod, struct elf_info *info, | |||
| 634 | sizeof(struct pnp_device_id), "pnp", | 676 | sizeof(struct pnp_device_id), "pnp", | 
| 635 | do_pnp_entry, mod); | 677 | do_pnp_entry, mod); | 
| 636 | else if (sym_is(symname, "__mod_pnp_card_device_table")) | 678 | else if (sym_is(symname, "__mod_pnp_card_device_table")) | 
| 637 | do_table(symval, sym->st_size, | 679 | do_pnp_card_entries(symval, sym->st_size, mod); | 
| 638 | sizeof(struct pnp_card_device_id), "pnp_card", | ||
| 639 | do_pnp_card_entry, mod); | ||
| 640 | else if (sym_is(symname, "__mod_pcmcia_device_table")) | 680 | else if (sym_is(symname, "__mod_pcmcia_device_table")) | 
| 641 | do_table(symval, sym->st_size, | 681 | do_table(symval, sym->st_size, | 
| 642 | sizeof(struct pcmcia_device_id), "pcmcia", | 682 | sizeof(struct pcmcia_device_id), "pcmcia", | 
| @@ -673,6 +713,10 @@ void handle_moddevtable(struct module *mod, struct elf_info *info, | |||
| 673 | do_table(symval, sym->st_size, | 713 | do_table(symval, sym->st_size, | 
| 674 | sizeof(struct virtio_device_id), "virtio", | 714 | sizeof(struct virtio_device_id), "virtio", | 
| 675 | do_virtio_entry, mod); | 715 | do_virtio_entry, mod); | 
| 716 | else if (sym_is(symname, "__mod_i2c_device_table")) | ||
| 717 | do_table(symval, sym->st_size, | ||
| 718 | sizeof(struct i2c_device_id), "i2c", | ||
| 719 | do_i2c_entry, mod); | ||
| 676 | free(zeros); | 720 | free(zeros); | 
| 677 | } | 721 | } | 
| 678 | 722 | ||
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 110cf243fa4e..757294b4f322 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c  | |||
| @@ -1552,6 +1552,10 @@ static void read_symbols(char *modname) | |||
| 1552 | } | 1552 | } | 
| 1553 | 1553 | ||
| 1554 | license = get_modinfo(info.modinfo, info.modinfo_len, "license"); | 1554 | license = get_modinfo(info.modinfo, info.modinfo_len, "license"); | 
| 1555 | if (info.modinfo && !license && !is_vmlinux(modname)) | ||
| 1556 | warn("modpost: missing MODULE_LICENSE() in %s\n" | ||
| 1557 | "see include/linux/module.h for " | ||
| 1558 | "more information\n", modname); | ||
| 1555 | while (license) { | 1559 | while (license) { | 
| 1556 | if (license_is_gpl_compatible(license)) | 1560 | if (license_is_gpl_compatible(license)) | 
| 1557 | mod->gpl_compatible = 1; | 1561 | mod->gpl_compatible = 1; | 
| @@ -2015,6 +2019,11 @@ static void write_markers(const char *fname) | |||
| 2015 | write_if_changed(&buf, fname); | 2019 | write_if_changed(&buf, fname); | 
| 2016 | } | 2020 | } | 
| 2017 | 2021 | ||
| 2022 | struct ext_sym_list { | ||
| 2023 | struct ext_sym_list *next; | ||
| 2024 | const char *file; | ||
| 2025 | }; | ||
| 2026 | |||
| 2018 | int main(int argc, char **argv) | 2027 | int main(int argc, char **argv) | 
| 2019 | { | 2028 | { | 
| 2020 | struct module *mod; | 2029 | struct module *mod; | 
| @@ -2025,8 +2034,10 @@ int main(int argc, char **argv) | |||
| 2025 | char *markers_write = NULL; | 2034 | char *markers_write = NULL; | 
| 2026 | int opt; | 2035 | int opt; | 
| 2027 | int err; | 2036 | int err; | 
| 2037 | struct ext_sym_list *extsym_iter; | ||
| 2038 | struct ext_sym_list *extsym_start = NULL; | ||
| 2028 | 2039 | ||
| 2029 | while ((opt = getopt(argc, argv, "i:I:cmsSo:awM:K:")) != -1) { | 2040 | while ((opt = getopt(argc, argv, "i:I:e:cmsSo:awM:K:")) != -1) { | 
| 2030 | switch (opt) { | 2041 | switch (opt) { | 
| 2031 | case 'i': | 2042 | case 'i': | 
| 2032 | kernel_read = optarg; | 2043 | kernel_read = optarg; | 
| @@ -2038,6 +2049,14 @@ int main(int argc, char **argv) | |||
| 2038 | case 'c': | 2049 | case 'c': | 
| 2039 | cross_build = 1; | 2050 | cross_build = 1; | 
| 2040 | break; | 2051 | break; | 
| 2052 | case 'e': | ||
| 2053 | external_module = 1; | ||
| 2054 | extsym_iter = | ||
| 2055 | NOFAIL(malloc(sizeof(*extsym_iter))); | ||
| 2056 | extsym_iter->next = extsym_start; | ||
| 2057 | extsym_iter->file = optarg; | ||
| 2058 | extsym_start = extsym_iter; | ||
| 2059 | break; | ||
| 2041 | case 'm': | 2060 | case 'm': | 
| 2042 | modversions = 1; | 2061 | modversions = 1; | 
| 2043 | break; | 2062 | break; | 
| @@ -2071,6 +2090,12 @@ int main(int argc, char **argv) | |||
| 2071 | read_dump(kernel_read, 1); | 2090 | read_dump(kernel_read, 1); | 
| 2072 | if (module_read) | 2091 | if (module_read) | 
| 2073 | read_dump(module_read, 0); | 2092 | read_dump(module_read, 0); | 
| 2093 | while (extsym_start) { | ||
| 2094 | read_dump(extsym_start->file, 0); | ||
| 2095 | extsym_iter = extsym_start->next; | ||
| 2096 | free(extsym_start); | ||
| 2097 | extsym_start = extsym_iter; | ||
| 2098 | } | ||
| 2074 | 2099 | ||
| 2075 | while (optind < argc) | 2100 | while (optind < argc) | 
| 2076 | read_symbols(argv[optind++]); | 2101 | read_symbols(argv[optind++]); | 
