diff options
author | David Woodhouse <dwmw2@infradead.org> | 2010-04-01 21:05:27 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-04-02 17:30:39 -0400 |
commit | 8626d3b4328061f5b82b11ae1d6918a0c3602f42 (patch) | |
tree | be2b509a0d47903ff2ac1d10255a760ade82daca /scripts | |
parent | 9092c658bab215b2752fa59d2a36c05b74d1e9e9 (diff) |
phylib: Support phy module autoloading
We don't use the normal hotplug mechanism because it doesn't work. It will
load the module some time after the device appears, but that's not good
enough for us -- we need the driver loaded _immediately_ because otherwise
the NIC driver may just abort and then the phy 'device' goes away.
[bwh: s/phy/mdio/ in module alias, kerneldoc for struct mdio_device_id]
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Acked-by: Andy Fleming <afleming@freescale.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/mod/file2alias.c | 26 |
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 | ||
799 | static 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 _ */ |
800 | static inline int sym_is(const char *symbol, const char *name) | 822 | static 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 | ||