diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-01-14 15:32:16 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-01-14 15:32:16 -0500 |
commit | 0a80939b3e6af4b0dc93bf88ec02fd7e90a16f1b (patch) | |
tree | a112335f2b2b2a51e90531c6c67e8a3b54dcf0ef /scripts/mod/file2alias.c | |
parent | 0b48d42235caf627121f440b57d376f48a9af8b6 (diff) | |
parent | 72db395ffadb1d33233fd123c2bf87ba0198c6c1 (diff) |
Merge tag 'for-linus' of git://github.com/rustyrussell/linux
Autogenerated GPG tag for Rusty D1ADB8F1: 15EE 8D6C AB0E 7F0C F999 BFCB D920 0E6C D1AD B8F1
* tag 'for-linus' of git://github.com/rustyrussell/linux:
module_param: check that bool parameters really are bool.
intelfbdrv.c: bailearly is an int module_param
paride/pcd: fix bool verbose module parameter.
module_param: make bool parameters really bool (drivers & misc)
module_param: make bool parameters really bool (arch)
module_param: make bool parameters really bool (core code)
kernel/async: remove redundant declaration.
printk: fix unnecessary module_param_name.
lirc_parallel: fix module parameter description.
module_param: avoid bool abuse, add bint for special cases.
module_param: check type correctness for module_param_array
modpost: use linker section to generate table.
modpost: use a table rather than a giant if/else statement.
modules: sysfs - export: taint, coresize, initsize
kernel/params: replace DEBUGP with pr_debug
module: replace DEBUGP with pr_debug
module: struct module_ref should contains long fields
module: Fix performance regression on modules with large symbol tables
module: Add comments describing how the "strmap" logic works
Fix up conflicts in scripts/mod/file2alias.c due to the new linker-
generated table approach to adding __mod_*_device_table entries. The
ARM sa11x0 mcp bus needed to be converted to that too.
Diffstat (limited to 'scripts/mod/file2alias.c')
-rw-r--r-- | scripts/mod/file2alias.c | 217 |
1 files changed, 92 insertions, 125 deletions
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c index 296f17ff751b..c0e14b3f2306 100644 --- a/scripts/mod/file2alias.c +++ b/scripts/mod/file2alias.c | |||
@@ -28,6 +28,7 @@ typedef Elf64_Addr kernel_ulong_t; | |||
28 | #endif | 28 | #endif |
29 | 29 | ||
30 | #include <ctype.h> | 30 | #include <ctype.h> |
31 | #include <stdbool.h> | ||
31 | 32 | ||
32 | typedef uint32_t __u32; | 33 | typedef uint32_t __u32; |
33 | typedef uint16_t __u16; | 34 | typedef uint16_t __u16; |
@@ -38,6 +39,35 @@ typedef unsigned char __u8; | |||
38 | * we handle those differences explicitly below */ | 39 | * we handle those differences explicitly below */ |
39 | #include "../../include/linux/mod_devicetable.h" | 40 | #include "../../include/linux/mod_devicetable.h" |
40 | 41 | ||
42 | /* This array collects all instances that use the generic do_table */ | ||
43 | struct devtable { | ||
44 | const char *device_id; /* name of table, __mod_<name>_device_table. */ | ||
45 | unsigned long id_size; | ||
46 | void *function; | ||
47 | }; | ||
48 | |||
49 | /* We construct a table of pointers in an ELF section (pointers generally | ||
50 | * go unpadded by gcc). ld creates boundary syms for us. */ | ||
51 | extern struct devtable *__start___devtable[], *__stop___devtable[]; | ||
52 | #define ___cat(a,b) a ## b | ||
53 | #define __cat(a,b) ___cat(a,b) | ||
54 | |||
55 | #if __GNUC__ == 3 && __GNUC_MINOR__ < 3 | ||
56 | # define __used __attribute__((__unused__)) | ||
57 | #else | ||
58 | # define __used __attribute__((__used__)) | ||
59 | #endif | ||
60 | |||
61 | /* Add a table entry. We test function type matches while we're here. */ | ||
62 | #define ADD_TO_DEVTABLE(device_id, type, function) \ | ||
63 | static struct devtable __cat(devtable,__LINE__) = { \ | ||
64 | device_id + 0*sizeof((function)((const char *)NULL, \ | ||
65 | (type *)NULL, \ | ||
66 | (char *)NULL)), \ | ||
67 | sizeof(type), (function) }; \ | ||
68 | static struct devtable *__attribute__((section("__devtable"))) \ | ||
69 | __used __cat(devtable_ptr,__LINE__) = &__cat(devtable,__LINE__) | ||
70 | |||
41 | #define ADD(str, sep, cond, field) \ | 71 | #define ADD(str, sep, cond, field) \ |
42 | do { \ | 72 | do { \ |
43 | strcat(str, sep); \ | 73 | strcat(str, sep); \ |
@@ -289,6 +319,7 @@ static int do_hid_entry(const char *filename, | |||
289 | 319 | ||
290 | return 1; | 320 | return 1; |
291 | } | 321 | } |
322 | ADD_TO_DEVTABLE("hid", struct hid_device_id, do_hid_entry); | ||
292 | 323 | ||
293 | /* Looks like: ieee1394:venNmoNspNverN */ | 324 | /* Looks like: ieee1394:venNmoNspNverN */ |
294 | static int do_ieee1394_entry(const char *filename, | 325 | static int do_ieee1394_entry(const char *filename, |
@@ -313,6 +344,7 @@ static int do_ieee1394_entry(const char *filename, | |||
313 | add_wildcard(alias); | 344 | add_wildcard(alias); |
314 | return 1; | 345 | return 1; |
315 | } | 346 | } |
347 | ADD_TO_DEVTABLE("ieee1394", struct ieee1394_device_id, do_ieee1394_entry); | ||
316 | 348 | ||
317 | /* Looks like: pci:vNdNsvNsdNbcNscNiN. */ | 349 | /* Looks like: pci:vNdNsvNsdNbcNscNiN. */ |
318 | static int do_pci_entry(const char *filename, | 350 | static int do_pci_entry(const char *filename, |
@@ -356,6 +388,7 @@ static int do_pci_entry(const char *filename, | |||
356 | add_wildcard(alias); | 388 | add_wildcard(alias); |
357 | return 1; | 389 | return 1; |
358 | } | 390 | } |
391 | ADD_TO_DEVTABLE("pci", struct pci_device_id, do_pci_entry); | ||
359 | 392 | ||
360 | /* looks like: "ccw:tNmNdtNdmN" */ | 393 | /* looks like: "ccw:tNmNdtNdmN" */ |
361 | static int do_ccw_entry(const char *filename, | 394 | static int do_ccw_entry(const char *filename, |
@@ -379,6 +412,7 @@ static int do_ccw_entry(const char *filename, | |||
379 | add_wildcard(alias); | 412 | add_wildcard(alias); |
380 | return 1; | 413 | return 1; |
381 | } | 414 | } |
415 | ADD_TO_DEVTABLE("ccw", struct ccw_device_id, do_ccw_entry); | ||
382 | 416 | ||
383 | /* looks like: "ap:tN" */ | 417 | /* looks like: "ap:tN" */ |
384 | static int do_ap_entry(const char *filename, | 418 | static int do_ap_entry(const char *filename, |
@@ -387,6 +421,7 @@ static int do_ap_entry(const char *filename, | |||
387 | sprintf(alias, "ap:t%02X*", id->dev_type); | 421 | sprintf(alias, "ap:t%02X*", id->dev_type); |
388 | return 1; | 422 | return 1; |
389 | } | 423 | } |
424 | ADD_TO_DEVTABLE("ap", struct ap_device_id, do_ap_entry); | ||
390 | 425 | ||
391 | /* looks like: "css:tN" */ | 426 | /* looks like: "css:tN" */ |
392 | static int do_css_entry(const char *filename, | 427 | static int do_css_entry(const char *filename, |
@@ -395,6 +430,7 @@ static int do_css_entry(const char *filename, | |||
395 | sprintf(alias, "css:t%01X", id->type); | 430 | sprintf(alias, "css:t%01X", id->type); |
396 | return 1; | 431 | return 1; |
397 | } | 432 | } |
433 | ADD_TO_DEVTABLE("css", struct css_device_id, do_css_entry); | ||
398 | 434 | ||
399 | /* Looks like: "serio:tyNprNidNexN" */ | 435 | /* Looks like: "serio:tyNprNidNexN" */ |
400 | static int do_serio_entry(const char *filename, | 436 | static int do_serio_entry(const char *filename, |
@@ -414,6 +450,7 @@ static int do_serio_entry(const char *filename, | |||
414 | add_wildcard(alias); | 450 | add_wildcard(alias); |
415 | return 1; | 451 | return 1; |
416 | } | 452 | } |
453 | ADD_TO_DEVTABLE("serio", struct serio_device_id, do_serio_entry); | ||
417 | 454 | ||
418 | /* looks like: "acpi:ACPI0003 or acpi:PNP0C0B" or "acpi:LNXVIDEO" */ | 455 | /* looks like: "acpi:ACPI0003 or acpi:PNP0C0B" or "acpi:LNXVIDEO" */ |
419 | static int do_acpi_entry(const char *filename, | 456 | static int do_acpi_entry(const char *filename, |
@@ -422,6 +459,7 @@ static int do_acpi_entry(const char *filename, | |||
422 | sprintf(alias, "acpi*:%s:*", id->id); | 459 | sprintf(alias, "acpi*:%s:*", id->id); |
423 | return 1; | 460 | return 1; |
424 | } | 461 | } |
462 | ADD_TO_DEVTABLE("acpi", struct acpi_device_id, do_acpi_entry); | ||
425 | 463 | ||
426 | /* looks like: "pnp:dD" */ | 464 | /* looks like: "pnp:dD" */ |
427 | static void do_pnp_device_entry(void *symval, unsigned long size, | 465 | static void do_pnp_device_entry(void *symval, unsigned long size, |
@@ -544,8 +582,7 @@ static int do_pcmcia_entry(const char *filename, | |||
544 | add_wildcard(alias); | 582 | add_wildcard(alias); |
545 | return 1; | 583 | return 1; |
546 | } | 584 | } |
547 | 585 | ADD_TO_DEVTABLE("pcmcia", struct pcmcia_device_id, do_pcmcia_entry); | |
548 | |||
549 | 586 | ||
550 | static int do_of_entry (const char *filename, struct of_device_id *of, char *alias) | 587 | static int do_of_entry (const char *filename, struct of_device_id *of, char *alias) |
551 | { | 588 | { |
@@ -568,6 +605,7 @@ static int do_of_entry (const char *filename, struct of_device_id *of, char *ali | |||
568 | add_wildcard(alias); | 605 | add_wildcard(alias); |
569 | return 1; | 606 | return 1; |
570 | } | 607 | } |
608 | ADD_TO_DEVTABLE("of", struct of_device_id, do_of_entry); | ||
571 | 609 | ||
572 | static int do_vio_entry(const char *filename, struct vio_device_id *vio, | 610 | static int do_vio_entry(const char *filename, struct vio_device_id *vio, |
573 | char *alias) | 611 | char *alias) |
@@ -585,6 +623,7 @@ static int do_vio_entry(const char *filename, struct vio_device_id *vio, | |||
585 | add_wildcard(alias); | 623 | add_wildcard(alias); |
586 | return 1; | 624 | return 1; |
587 | } | 625 | } |
626 | ADD_TO_DEVTABLE("vio", struct vio_device_id, do_vio_entry); | ||
588 | 627 | ||
589 | #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) | 628 | #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) |
590 | 629 | ||
@@ -640,6 +679,7 @@ static int do_input_entry(const char *filename, struct input_device_id *id, | |||
640 | do_input(alias, id->swbit, 0, INPUT_DEVICE_ID_SW_MAX); | 679 | do_input(alias, id->swbit, 0, INPUT_DEVICE_ID_SW_MAX); |
641 | return 1; | 680 | return 1; |
642 | } | 681 | } |
682 | ADD_TO_DEVTABLE("input", struct input_device_id, do_input_entry); | ||
643 | 683 | ||
644 | static int do_eisa_entry(const char *filename, struct eisa_device_id *eisa, | 684 | static int do_eisa_entry(const char *filename, struct eisa_device_id *eisa, |
645 | char *alias) | 685 | char *alias) |
@@ -650,6 +690,7 @@ static int do_eisa_entry(const char *filename, struct eisa_device_id *eisa, | |||
650 | strcat(alias, "*"); | 690 | strcat(alias, "*"); |
651 | return 1; | 691 | return 1; |
652 | } | 692 | } |
693 | ADD_TO_DEVTABLE("eisa", struct eisa_device_id, do_eisa_entry); | ||
653 | 694 | ||
654 | /* Looks like: parisc:tNhvNrevNsvN */ | 695 | /* Looks like: parisc:tNhvNrevNsvN */ |
655 | static int do_parisc_entry(const char *filename, struct parisc_device_id *id, | 696 | static int do_parisc_entry(const char *filename, struct parisc_device_id *id, |
@@ -669,6 +710,7 @@ static int do_parisc_entry(const char *filename, struct parisc_device_id *id, | |||
669 | add_wildcard(alias); | 710 | add_wildcard(alias); |
670 | return 1; | 711 | return 1; |
671 | } | 712 | } |
713 | ADD_TO_DEVTABLE("parisc", struct parisc_device_id, do_parisc_entry); | ||
672 | 714 | ||
673 | /* Looks like: sdio:cNvNdN. */ | 715 | /* Looks like: sdio:cNvNdN. */ |
674 | static int do_sdio_entry(const char *filename, | 716 | static int do_sdio_entry(const char *filename, |
@@ -685,6 +727,7 @@ static int do_sdio_entry(const char *filename, | |||
685 | add_wildcard(alias); | 727 | add_wildcard(alias); |
686 | return 1; | 728 | return 1; |
687 | } | 729 | } |
730 | ADD_TO_DEVTABLE("sdio", struct sdio_device_id, do_sdio_entry); | ||
688 | 731 | ||
689 | /* Looks like: ssb:vNidNrevN. */ | 732 | /* Looks like: ssb:vNidNrevN. */ |
690 | static int do_ssb_entry(const char *filename, | 733 | static int do_ssb_entry(const char *filename, |
@@ -701,6 +744,7 @@ static int do_ssb_entry(const char *filename, | |||
701 | add_wildcard(alias); | 744 | add_wildcard(alias); |
702 | return 1; | 745 | return 1; |
703 | } | 746 | } |
747 | ADD_TO_DEVTABLE("ssb", struct ssb_device_id, do_ssb_entry); | ||
704 | 748 | ||
705 | /* Looks like: bcma:mNidNrevNclN. */ | 749 | /* Looks like: bcma:mNidNrevNclN. */ |
706 | static int do_bcma_entry(const char *filename, | 750 | static int do_bcma_entry(const char *filename, |
@@ -719,6 +763,7 @@ static int do_bcma_entry(const char *filename, | |||
719 | add_wildcard(alias); | 763 | add_wildcard(alias); |
720 | return 1; | 764 | return 1; |
721 | } | 765 | } |
766 | ADD_TO_DEVTABLE("bcma", struct bcma_device_id, do_bcma_entry); | ||
722 | 767 | ||
723 | /* Looks like: virtio:dNvN */ | 768 | /* Looks like: virtio:dNvN */ |
724 | static int do_virtio_entry(const char *filename, struct virtio_device_id *id, | 769 | static int do_virtio_entry(const char *filename, struct virtio_device_id *id, |
@@ -734,6 +779,7 @@ static int do_virtio_entry(const char *filename, struct virtio_device_id *id, | |||
734 | add_wildcard(alias); | 779 | add_wildcard(alias); |
735 | return 1; | 780 | return 1; |
736 | } | 781 | } |
782 | ADD_TO_DEVTABLE("virtio", struct virtio_device_id, do_virtio_entry); | ||
737 | 783 | ||
738 | /* | 784 | /* |
739 | * Looks like: vmbus:guid | 785 | * Looks like: vmbus:guid |
@@ -755,6 +801,7 @@ static int do_vmbus_entry(const char *filename, struct hv_vmbus_device_id *id, | |||
755 | 801 | ||
756 | return 1; | 802 | return 1; |
757 | } | 803 | } |
804 | ADD_TO_DEVTABLE("vmbus", struct hv_vmbus_device_id, do_vmbus_entry); | ||
758 | 805 | ||
759 | /* Looks like: i2c:S */ | 806 | /* Looks like: i2c:S */ |
760 | static int do_i2c_entry(const char *filename, struct i2c_device_id *id, | 807 | static int do_i2c_entry(const char *filename, struct i2c_device_id *id, |
@@ -764,6 +811,7 @@ static int do_i2c_entry(const char *filename, struct i2c_device_id *id, | |||
764 | 811 | ||
765 | return 1; | 812 | return 1; |
766 | } | 813 | } |
814 | ADD_TO_DEVTABLE("i2c", struct i2c_device_id, do_i2c_entry); | ||
767 | 815 | ||
768 | /* Looks like: spi:S */ | 816 | /* Looks like: spi:S */ |
769 | static int do_spi_entry(const char *filename, struct spi_device_id *id, | 817 | static int do_spi_entry(const char *filename, struct spi_device_id *id, |
@@ -773,6 +821,7 @@ static int do_spi_entry(const char *filename, struct spi_device_id *id, | |||
773 | 821 | ||
774 | return 1; | 822 | return 1; |
775 | } | 823 | } |
824 | ADD_TO_DEVTABLE("spi", struct spi_device_id, do_spi_entry); | ||
776 | 825 | ||
777 | /* Looks like: mcp:S */ | 826 | /* Looks like: mcp:S */ |
778 | static int do_mcp_entry(const char *filename, struct mcp_device_id *id, | 827 | static int do_mcp_entry(const char *filename, struct mcp_device_id *id, |
@@ -782,6 +831,7 @@ static int do_mcp_entry(const char *filename, struct mcp_device_id *id, | |||
782 | 831 | ||
783 | return 1; | 832 | return 1; |
784 | } | 833 | } |
834 | ADD_TO_DEVTABLE("mcp", struct mcp_device_id, do_mcp_entry); | ||
785 | 835 | ||
786 | static const struct dmifield { | 836 | static const struct dmifield { |
787 | const char *prefix; | 837 | const char *prefix; |
@@ -836,6 +886,7 @@ static int do_dmi_entry(const char *filename, struct dmi_system_id *id, | |||
836 | strcat(alias, ":"); | 886 | strcat(alias, ":"); |
837 | return 1; | 887 | return 1; |
838 | } | 888 | } |
889 | ADD_TO_DEVTABLE("dmi", struct dmi_system_id, do_dmi_entry); | ||
839 | 890 | ||
840 | static int do_platform_entry(const char *filename, | 891 | static int do_platform_entry(const char *filename, |
841 | struct platform_device_id *id, char *alias) | 892 | struct platform_device_id *id, char *alias) |
@@ -843,6 +894,7 @@ static int do_platform_entry(const char *filename, | |||
843 | sprintf(alias, PLATFORM_MODULE_PREFIX "%s", id->name); | 894 | sprintf(alias, PLATFORM_MODULE_PREFIX "%s", id->name); |
844 | return 1; | 895 | return 1; |
845 | } | 896 | } |
897 | ADD_TO_DEVTABLE("platform", struct platform_device_id, do_platform_entry); | ||
846 | 898 | ||
847 | static int do_mdio_entry(const char *filename, | 899 | static int do_mdio_entry(const char *filename, |
848 | struct mdio_device_id *id, char *alias) | 900 | struct mdio_device_id *id, char *alias) |
@@ -865,6 +917,7 @@ static int do_mdio_entry(const char *filename, | |||
865 | 917 | ||
866 | return 1; | 918 | return 1; |
867 | } | 919 | } |
920 | ADD_TO_DEVTABLE("mdio", struct mdio_device_id, do_mdio_entry); | ||
868 | 921 | ||
869 | /* Looks like: zorro:iN. */ | 922 | /* Looks like: zorro:iN. */ |
870 | static int do_zorro_entry(const char *filename, struct zorro_device_id *id, | 923 | static int do_zorro_entry(const char *filename, struct zorro_device_id *id, |
@@ -875,6 +928,7 @@ static int do_zorro_entry(const char *filename, struct zorro_device_id *id, | |||
875 | ADD(alias, "i", id->id != ZORRO_WILDCARD, id->id); | 928 | ADD(alias, "i", id->id != ZORRO_WILDCARD, id->id); |
876 | return 1; | 929 | return 1; |
877 | } | 930 | } |
931 | ADD_TO_DEVTABLE("zorro", struct zorro_device_id, do_zorro_entry); | ||
878 | 932 | ||
879 | /* looks like: "pnp:dD" */ | 933 | /* looks like: "pnp:dD" */ |
880 | static int do_isapnp_entry(const char *filename, | 934 | static int do_isapnp_entry(const char *filename, |
@@ -888,6 +942,7 @@ static int do_isapnp_entry(const char *filename, | |||
888 | (id->function >> 12) & 0x0f, (id->function >> 8) & 0x0f); | 942 | (id->function >> 12) & 0x0f, (id->function >> 8) & 0x0f); |
889 | return 1; | 943 | return 1; |
890 | } | 944 | } |
945 | ADD_TO_DEVTABLE("isa", struct isapnp_device_id, do_isapnp_entry); | ||
891 | 946 | ||
892 | /* | 947 | /* |
893 | * Append a match expression for a single masked hex digit. | 948 | * Append a match expression for a single masked hex digit. |
@@ -956,16 +1011,15 @@ static int do_amba_entry(const char *filename, | |||
956 | 1011 | ||
957 | return 1; | 1012 | return 1; |
958 | } | 1013 | } |
1014 | ADD_TO_DEVTABLE("amba", struct amba_id, do_amba_entry); | ||
959 | 1015 | ||
960 | /* Ignore any prefix, eg. some architectures prepend _ */ | 1016 | /* Does namelen bytes of name exactly match the symbol? */ |
961 | static inline int sym_is(const char *symbol, const char *name) | 1017 | static bool sym_is(const char *name, unsigned namelen, const char *symbol) |
962 | { | 1018 | { |
963 | const char *match; | 1019 | if (namelen != strlen(symbol)) |
1020 | return false; | ||
964 | 1021 | ||
965 | match = strstr(symbol, name); | 1022 | return memcmp(name, symbol, namelen) == 0; |
966 | if (!match) | ||
967 | return 0; | ||
968 | return match[strlen(name)] == '\0'; | ||
969 | } | 1023 | } |
970 | 1024 | ||
971 | static void do_table(void *symval, unsigned long size, | 1025 | static void do_table(void *symval, unsigned long size, |
@@ -998,11 +1052,25 @@ void handle_moddevtable(struct module *mod, struct elf_info *info, | |||
998 | { | 1052 | { |
999 | void *symval; | 1053 | void *symval; |
1000 | char *zeros = NULL; | 1054 | char *zeros = NULL; |
1055 | const char *name; | ||
1056 | unsigned int namelen; | ||
1001 | 1057 | ||
1002 | /* We're looking for a section relative symbol */ | 1058 | /* We're looking for a section relative symbol */ |
1003 | if (!sym->st_shndx || get_secindex(info, sym) >= info->num_sections) | 1059 | if (!sym->st_shndx || get_secindex(info, sym) >= info->num_sections) |
1004 | return; | 1060 | return; |
1005 | 1061 | ||
1062 | /* All our symbols are of form <prefix>__mod_XXX_device_table. */ | ||
1063 | name = strstr(symname, "__mod_"); | ||
1064 | if (!name) | ||
1065 | return; | ||
1066 | name += strlen("__mod_"); | ||
1067 | namelen = strlen(name); | ||
1068 | if (namelen < strlen("_device_table")) | ||
1069 | return; | ||
1070 | if (strcmp(name + namelen - strlen("_device_table"), "_device_table")) | ||
1071 | return; | ||
1072 | namelen -= strlen("_device_table"); | ||
1073 | |||
1006 | /* Handle all-NULL symbols allocated into .bss */ | 1074 | /* Handle all-NULL symbols allocated into .bss */ |
1007 | if (info->sechdrs[get_secindex(info, sym)].sh_type & SHT_NOBITS) { | 1075 | if (info->sechdrs[get_secindex(info, sym)].sh_type & SHT_NOBITS) { |
1008 | zeros = calloc(1, sym->st_size); | 1076 | zeros = calloc(1, sym->st_size); |
@@ -1013,125 +1081,24 @@ void handle_moddevtable(struct module *mod, struct elf_info *info, | |||
1013 | + sym->st_value; | 1081 | + sym->st_value; |
1014 | } | 1082 | } |
1015 | 1083 | ||
1016 | if (sym_is(symname, "__mod_pci_device_table")) | 1084 | /* First handle the "special" cases */ |
1017 | do_table(symval, sym->st_size, | 1085 | if (sym_is(name, namelen, "usb")) |
1018 | sizeof(struct pci_device_id), "pci", | ||
1019 | do_pci_entry, mod); | ||
1020 | else if (sym_is(symname, "__mod_usb_device_table")) | ||
1021 | /* special case to handle bcdDevice ranges */ | ||
1022 | do_usb_table(symval, sym->st_size, mod); | 1086 | do_usb_table(symval, sym->st_size, mod); |
1023 | else if (sym_is(symname, "__mod_hid_device_table")) | 1087 | else if (sym_is(name, namelen, "pnp")) |
1024 | do_table(symval, sym->st_size, | ||
1025 | sizeof(struct hid_device_id), "hid", | ||
1026 | do_hid_entry, mod); | ||
1027 | else if (sym_is(symname, "__mod_ieee1394_device_table")) | ||
1028 | do_table(symval, sym->st_size, | ||
1029 | sizeof(struct ieee1394_device_id), "ieee1394", | ||
1030 | do_ieee1394_entry, mod); | ||
1031 | else if (sym_is(symname, "__mod_ccw_device_table")) | ||
1032 | do_table(symval, sym->st_size, | ||
1033 | sizeof(struct ccw_device_id), "ccw", | ||
1034 | do_ccw_entry, mod); | ||
1035 | else if (sym_is(symname, "__mod_ap_device_table")) | ||
1036 | do_table(symval, sym->st_size, | ||
1037 | sizeof(struct ap_device_id), "ap", | ||
1038 | do_ap_entry, mod); | ||
1039 | else if (sym_is(symname, "__mod_css_device_table")) | ||
1040 | do_table(symval, sym->st_size, | ||
1041 | sizeof(struct css_device_id), "css", | ||
1042 | do_css_entry, mod); | ||
1043 | else if (sym_is(symname, "__mod_serio_device_table")) | ||
1044 | do_table(symval, sym->st_size, | ||
1045 | sizeof(struct serio_device_id), "serio", | ||
1046 | do_serio_entry, mod); | ||
1047 | else if (sym_is(symname, "__mod_acpi_device_table")) | ||
1048 | do_table(symval, sym->st_size, | ||
1049 | sizeof(struct acpi_device_id), "acpi", | ||
1050 | do_acpi_entry, mod); | ||
1051 | else if (sym_is(symname, "__mod_pnp_device_table")) | ||
1052 | do_pnp_device_entry(symval, sym->st_size, mod); | 1088 | do_pnp_device_entry(symval, sym->st_size, mod); |
1053 | else if (sym_is(symname, "__mod_pnp_card_device_table")) | 1089 | else if (sym_is(name, namelen, "pnp_card")) |
1054 | do_pnp_card_entries(symval, sym->st_size, mod); | 1090 | do_pnp_card_entries(symval, sym->st_size, mod); |
1055 | else if (sym_is(symname, "__mod_pcmcia_device_table")) | 1091 | else { |
1056 | do_table(symval, sym->st_size, | 1092 | struct devtable **p; |
1057 | sizeof(struct pcmcia_device_id), "pcmcia", | 1093 | |
1058 | do_pcmcia_entry, mod); | 1094 | for (p = __start___devtable; p < __stop___devtable; p++) { |
1059 | else if (sym_is(symname, "__mod_of_device_table")) | 1095 | if (sym_is(name, namelen, (*p)->device_id)) { |
1060 | do_table(symval, sym->st_size, | 1096 | do_table(symval, sym->st_size, (*p)->id_size, |
1061 | sizeof(struct of_device_id), "of", | 1097 | (*p)->device_id, (*p)->function, mod); |
1062 | do_of_entry, mod); | 1098 | break; |
1063 | else if (sym_is(symname, "__mod_vio_device_table")) | 1099 | } |
1064 | do_table(symval, sym->st_size, | 1100 | } |
1065 | sizeof(struct vio_device_id), "vio", | 1101 | } |
1066 | do_vio_entry, mod); | ||
1067 | else if (sym_is(symname, "__mod_input_device_table")) | ||
1068 | do_table(symval, sym->st_size, | ||
1069 | sizeof(struct input_device_id), "input", | ||
1070 | do_input_entry, mod); | ||
1071 | else if (sym_is(symname, "__mod_eisa_device_table")) | ||
1072 | do_table(symval, sym->st_size, | ||
1073 | sizeof(struct eisa_device_id), "eisa", | ||
1074 | do_eisa_entry, mod); | ||
1075 | else if (sym_is(symname, "__mod_parisc_device_table")) | ||
1076 | do_table(symval, sym->st_size, | ||
1077 | sizeof(struct parisc_device_id), "parisc", | ||
1078 | do_parisc_entry, mod); | ||
1079 | else if (sym_is(symname, "__mod_sdio_device_table")) | ||
1080 | do_table(symval, sym->st_size, | ||
1081 | sizeof(struct sdio_device_id), "sdio", | ||
1082 | do_sdio_entry, mod); | ||
1083 | else if (sym_is(symname, "__mod_ssb_device_table")) | ||
1084 | do_table(symval, sym->st_size, | ||
1085 | sizeof(struct ssb_device_id), "ssb", | ||
1086 | do_ssb_entry, mod); | ||
1087 | else if (sym_is(symname, "__mod_bcma_device_table")) | ||
1088 | do_table(symval, sym->st_size, | ||
1089 | sizeof(struct bcma_device_id), "bcma", | ||
1090 | do_bcma_entry, mod); | ||
1091 | else if (sym_is(symname, "__mod_virtio_device_table")) | ||
1092 | do_table(symval, sym->st_size, | ||
1093 | sizeof(struct virtio_device_id), "virtio", | ||
1094 | do_virtio_entry, mod); | ||
1095 | else if (sym_is(symname, "__mod_vmbus_device_table")) | ||
1096 | do_table(symval, sym->st_size, | ||
1097 | sizeof(struct hv_vmbus_device_id), "vmbus", | ||
1098 | do_vmbus_entry, mod); | ||
1099 | else if (sym_is(symname, "__mod_i2c_device_table")) | ||
1100 | do_table(symval, sym->st_size, | ||
1101 | sizeof(struct i2c_device_id), "i2c", | ||
1102 | do_i2c_entry, mod); | ||
1103 | else if (sym_is(symname, "__mod_spi_device_table")) | ||
1104 | do_table(symval, sym->st_size, | ||
1105 | sizeof(struct spi_device_id), "spi", | ||
1106 | do_spi_entry, mod); | ||
1107 | else if (sym_is(symname, "__mod_mcp_device_table")) | ||
1108 | do_table(symval, sym->st_size, | ||
1109 | sizeof(struct mcp_device_id), "mcp", | ||
1110 | do_mcp_entry, mod); | ||
1111 | else if (sym_is(symname, "__mod_dmi_device_table")) | ||
1112 | do_table(symval, sym->st_size, | ||
1113 | sizeof(struct dmi_system_id), "dmi", | ||
1114 | do_dmi_entry, mod); | ||
1115 | else if (sym_is(symname, "__mod_platform_device_table")) | ||
1116 | do_table(symval, sym->st_size, | ||
1117 | sizeof(struct platform_device_id), "platform", | ||
1118 | do_platform_entry, mod); | ||
1119 | else if (sym_is(symname, "__mod_mdio_device_table")) | ||
1120 | do_table(symval, sym->st_size, | ||
1121 | sizeof(struct mdio_device_id), "mdio", | ||
1122 | do_mdio_entry, mod); | ||
1123 | else if (sym_is(symname, "__mod_zorro_device_table")) | ||
1124 | do_table(symval, sym->st_size, | ||
1125 | sizeof(struct zorro_device_id), "zorro", | ||
1126 | do_zorro_entry, mod); | ||
1127 | else if (sym_is(symname, "__mod_isapnp_device_table")) | ||
1128 | do_table(symval, sym->st_size, | ||
1129 | sizeof(struct isapnp_device_id), "isa", | ||
1130 | do_isapnp_entry, mod); | ||
1131 | else if (sym_is(symname, "__mod_amba_device_table")) | ||
1132 | do_table(symval, sym->st_size, | ||
1133 | sizeof(struct amba_id), "amba", | ||
1134 | do_amba_entry, mod); | ||
1135 | free(zeros); | 1102 | free(zeros); |
1136 | } | 1103 | } |
1137 | 1104 | ||