aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/mod/file2alias.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index 220213e603db..36a60a853173 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -796,6 +796,28 @@ static int do_platform_entry(const char *filename,
796 return 1; 796 return 1;
797} 797}
798 798
799static int do_mdio_entry(const char *filename,
800 struct mdio_device_id *id, char *alias)
801{
802 int i;
803
804 alias += sprintf(alias, MDIO_MODULE_PREFIX);
805
806 for (i = 0; i < 32; i++) {
807 if (!((id->phy_id_mask >> (31-i)) & 1))
808 *(alias++) = '?';
809 else if ((id->phy_id >> (31-i)) & 1)
810 *(alias++) = '1';
811 else
812 *(alias++) = '0';
813 }
814
815 /* Terminate the string */
816 *alias = 0;
817
818 return 1;
819}
820
799/* Ignore any prefix, eg. some architectures prepend _ */ 821/* Ignore any prefix, eg. some architectures prepend _ */
800static inline int sym_is(const char *symbol, const char *name) 822static inline int sym_is(const char *symbol, const char *name)
801{ 823{
@@ -943,6 +965,10 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
943 do_table(symval, sym->st_size, 965 do_table(symval, sym->st_size,
944 sizeof(struct platform_device_id), "platform", 966 sizeof(struct platform_device_id), "platform",
945 do_platform_entry, mod); 967 do_platform_entry, mod);
968 else if (sym_is(symname, "__mod_mdio_device_table"))
969 do_table(symval, sym->st_size,
970 sizeof(struct mdio_device_id), "mdio",
971 do_mdio_entry, mod);
946 free(zeros); 972 free(zeros);
947} 973}
948 974