diff options
Diffstat (limited to 'scripts/mod/file2alias.c')
-rw-r--r-- | scripts/mod/file2alias.c | 44 |
1 files changed, 35 insertions, 9 deletions
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c index cea4a790e1e9..4c9890ec2528 100644 --- a/scripts/mod/file2alias.c +++ b/scripts/mod/file2alias.c | |||
@@ -304,6 +304,14 @@ static int do_ap_entry(const char *filename, | |||
304 | return 1; | 304 | return 1; |
305 | } | 305 | } |
306 | 306 | ||
307 | /* looks like: "css:tN" */ | ||
308 | static int do_css_entry(const char *filename, | ||
309 | struct css_device_id *id, char *alias) | ||
310 | { | ||
311 | sprintf(alias, "css:t%01X", id->type); | ||
312 | return 1; | ||
313 | } | ||
314 | |||
307 | /* Looks like: "serio:tyNprNidNexN" */ | 315 | /* Looks like: "serio:tyNprNidNexN" */ |
308 | static int do_serio_entry(const char *filename, | 316 | static int do_serio_entry(const char *filename, |
309 | struct serio_device_id *id, char *alias) | 317 | struct serio_device_id *id, char *alias) |
@@ -332,11 +340,24 @@ static int do_acpi_entry(const char *filename, | |||
332 | } | 340 | } |
333 | 341 | ||
334 | /* looks like: "pnp:dD" */ | 342 | /* looks like: "pnp:dD" */ |
335 | static int do_pnp_entry(const char *filename, | 343 | static void do_pnp_device_entry(void *symval, unsigned long size, |
336 | struct pnp_device_id *id, char *alias) | 344 | struct module *mod) |
337 | { | 345 | { |
338 | sprintf(alias, "pnp:d%s*", id->id); | 346 | const unsigned long id_size = sizeof(struct pnp_device_id); |
339 | return 1; | 347 | const unsigned int count = (size / id_size)-1; |
348 | const struct pnp_device_id *devs = symval; | ||
349 | unsigned int i; | ||
350 | |||
351 | device_id_check(mod->name, "pnp", size, id_size, symval); | ||
352 | |||
353 | for (i = 0; i < count; i++) { | ||
354 | const char *id = (char *)devs[i].id; | ||
355 | |||
356 | buf_printf(&mod->dev_table_buf, | ||
357 | "MODULE_ALIAS(\"pnp:d%s*\");\n", id); | ||
358 | buf_printf(&mod->dev_table_buf, | ||
359 | "MODULE_ALIAS(\"acpi*:%s:*\");\n", id); | ||
360 | } | ||
340 | } | 361 | } |
341 | 362 | ||
342 | /* looks like: "pnp:dD" for every device of the card */ | 363 | /* looks like: "pnp:dD" for every device of the card */ |
@@ -380,9 +401,12 @@ static void do_pnp_card_entries(void *symval, unsigned long size, | |||
380 | } | 401 | } |
381 | 402 | ||
382 | /* add an individual alias for every device entry */ | 403 | /* add an individual alias for every device entry */ |
383 | if (!dup) | 404 | if (!dup) { |
384 | buf_printf(&mod->dev_table_buf, | 405 | buf_printf(&mod->dev_table_buf, |
385 | "MODULE_ALIAS(\"pnp:d%s*\");\n", id); | 406 | "MODULE_ALIAS(\"pnp:d%s*\");\n", id); |
407 | buf_printf(&mod->dev_table_buf, | ||
408 | "MODULE_ALIAS(\"acpi*:%s:*\");\n", id); | ||
409 | } | ||
386 | } | 410 | } |
387 | } | 411 | } |
388 | } | 412 | } |
@@ -605,7 +629,7 @@ static int do_i2c_entry(const char *filename, struct i2c_device_id *id, | |||
605 | return 1; | 629 | return 1; |
606 | } | 630 | } |
607 | 631 | ||
608 | /* Ignore any prefix, eg. v850 prepends _ */ | 632 | /* Ignore any prefix, eg. some architectures prepend _ */ |
609 | static inline int sym_is(const char *symbol, const char *name) | 633 | static inline int sym_is(const char *symbol, const char *name) |
610 | { | 634 | { |
611 | const char *match; | 635 | const char *match; |
@@ -680,6 +704,10 @@ void handle_moddevtable(struct module *mod, struct elf_info *info, | |||
680 | do_table(symval, sym->st_size, | 704 | do_table(symval, sym->st_size, |
681 | sizeof(struct ap_device_id), "ap", | 705 | sizeof(struct ap_device_id), "ap", |
682 | do_ap_entry, mod); | 706 | do_ap_entry, mod); |
707 | else if (sym_is(symname, "__mod_css_device_table")) | ||
708 | do_table(symval, sym->st_size, | ||
709 | sizeof(struct css_device_id), "css", | ||
710 | do_css_entry, mod); | ||
683 | else if (sym_is(symname, "__mod_serio_device_table")) | 711 | else if (sym_is(symname, "__mod_serio_device_table")) |
684 | do_table(symval, sym->st_size, | 712 | do_table(symval, sym->st_size, |
685 | sizeof(struct serio_device_id), "serio", | 713 | sizeof(struct serio_device_id), "serio", |
@@ -689,9 +717,7 @@ void handle_moddevtable(struct module *mod, struct elf_info *info, | |||
689 | sizeof(struct acpi_device_id), "acpi", | 717 | sizeof(struct acpi_device_id), "acpi", |
690 | do_acpi_entry, mod); | 718 | do_acpi_entry, mod); |
691 | else if (sym_is(symname, "__mod_pnp_device_table")) | 719 | else if (sym_is(symname, "__mod_pnp_device_table")) |
692 | do_table(symval, sym->st_size, | 720 | do_pnp_device_entry(symval, sym->st_size, mod); |
693 | sizeof(struct pnp_device_id), "pnp", | ||
694 | do_pnp_entry, mod); | ||
695 | else if (sym_is(symname, "__mod_pnp_card_device_table")) | 721 | else if (sym_is(symname, "__mod_pnp_card_device_table")) |
696 | do_pnp_card_entries(symval, sym->st_size, mod); | 722 | do_pnp_card_entries(symval, sym->st_size, mod); |
697 | else if (sym_is(symname, "__mod_pcmcia_device_table")) | 723 | else if (sym_is(symname, "__mod_pcmcia_device_table")) |