diff options
author | Gabor Juhos <juhosg@openwrt.org> | 2010-12-08 10:15:00 +0000 |
---|---|---|
committer | Gabor Juhos <juhosg@openwrt.org> | 2010-12-08 10:15:00 +0000 |
commit | 418e052c05c9de090fde782ab320e2ca25a16761 (patch) | |
tree | 72c1e4669293fbe110c6ba601e8c25ec52c614bc /target/linux/ramips/files/drivers/net/ramips.c | |
parent | a0e968135aff665d2bf93388bd8e30ac22b607a5 (diff) | |
download | upstream-418e052c05c9de090fde782ab320e2ca25a16761.tar.gz upstream-418e052c05c9de090fde782ab320e2ca25a16761.tar.bz2 upstream-418e052c05c9de090fde782ab320e2ca25a16761.zip |
ramips: ramips_esw: convert it to be a platform driver
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@24331 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/ramips/files/drivers/net/ramips.c')
-rw-r--r-- | target/linux/ramips/files/drivers/net/ramips.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/target/linux/ramips/files/drivers/net/ramips.c b/target/linux/ramips/files/drivers/net/ramips.c index 812507328f..63570c7914 100644 --- a/target/linux/ramips/files/drivers/net/ramips.c +++ b/target/linux/ramips/files/drivers/net/ramips.c @@ -33,6 +33,9 @@ #ifdef CONFIG_RALINK_RT305X #include "ramips_esw.c" +#else +static inline int rt305x_esw_init(void) { return 0; } +static inline void rt305x_esw_exit(void) { } #endif #define phys_to_bus(a) (a & 0x1FFFFFFF) @@ -507,9 +510,6 @@ ramips_eth_plat_probe(struct platform_device *plat) goto err_free_dev; } -#ifdef CONFIG_RALINK_RT305X - rt305x_esw_init(); -#endif printk(KERN_DEBUG "ramips_eth: loaded\n"); return 0; @@ -541,10 +541,23 @@ static struct platform_driver ramips_eth_driver = { static int __init ramips_eth_init(void) { - int ret = platform_driver_register(&ramips_eth_driver); + int ret; + + ret = rt305x_esw_init(); if (ret) + return ret; + + ret = platform_driver_register(&ramips_eth_driver); + if (ret) { printk(KERN_ERR "ramips_eth: Error registering platfom driver!\n"); + goto esw_cleanup; + } + + return 0; + +esw_cleanup: + rt305x_esw_exit(); return ret; } @@ -552,6 +565,7 @@ static void __exit ramips_eth_cleanup(void) { platform_driver_unregister(&ramips_eth_driver); + rt305x_esw_exit(); } module_init(ramips_eth_init); |