1 /* 2 * Entry code of XRadio drivers 3 * 4 * Copyright (c) 2013 5 * Xradio Technology Co., Ltd. <www.xradiotech.com> 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License version 2 as 9 * published by the Free Software Foundation. 10 */ 11 12 #include <linux/version.h> 13 #include <linux/module.h> 14 #include <linux/init.h> 15 #include <linux/delay.h> 16 #include <linux/moduleparam.h> 17 18 #ifdef CONFIG_DRIVERS_HDF_XR829 19 #include <linux/netdevice.h> 20 #endif 21 22 #ifndef CONFIG_DRIVERS_HDF_XR829 23 MODULE_AUTHOR("XRadioTech"); 24 MODULE_DESCRIPTION("XRadioTech WLAN driver"); 25 MODULE_LICENSE("GPL"); 26 MODULE_ALIAS("xradio_wlan"); 27 #endif 28 29 /* external interfaces */ 30 extern int xradio_core_init(void); 31 extern void xradio_core_deinit(void); 32 33 #ifndef CONFIG_DRIVERS_HDF_XR829 34 extern int __init ieee80211_init(void); 35 #else 36 extern int ieee80211_init(void); 37 #endif 38 39 extern void ieee80211_exit(void); 40 #ifndef CONFIG_DRIVERS_HDF_XR829 41 extern int __init xradio_core_entry(void); 42 #else 43 extern int xradio_core_entry(void); 44 #endif 45 46 extern void xradio_core_exit(void); 47 48 #ifdef CONFIG_XRADIO_ETF 49 void xradio_etf_to_wlan(u32 change); 50 #endif 51 52 static int etf_enable = -1; 53 54 #ifndef CONFIG_DRIVERS_HDF_XR829 55 module_param(etf_enable, int, S_IRUSR); 56 #endif 57 58 /* Init Module function -> Called by insmod */ 59 #ifndef CONFIG_DRIVERS_HDF_XR829 xradio_init(void)60static int __init xradio_init(void) 61 #else 62 int xradio_init(void) 63 #endif 64 { 65 int ret = 0; 66 printk(KERN_ERR "======== XRADIO WIFI OPEN ========\n"); 67 ret = ieee80211_init(); 68 if (ret) { 69 printk(KERN_ERR "ieee80211_init failed (%d)!\n", ret); 70 goto ieee80211_fail; 71 } 72 73 ret = xradio_core_entry(); 74 if (ret) { 75 printk(KERN_ERR "xradio_core_entry failed (%d)!\n", ret); 76 goto core_entry_fail; 77 } 78 79 if (etf_enable == 1) 80 goto ieee80211_fail; 81 82 #ifdef CONFIG_XRADIO_ETF 83 xradio_etf_to_wlan(1); 84 #endif 85 ret = xradio_core_init(); /* wlan driver init */ 86 if (ret) { 87 printk(KERN_ERR "xradio_core_init failed (%d)!\n", ret); 88 #ifdef CONFIG_XRADIO_ETF 89 xradio_etf_to_wlan(0); 90 #endif 91 goto core_init_fail; 92 } 93 return ret; 94 95 core_init_fail: 96 xradio_core_exit(); 97 core_entry_fail: 98 ieee80211_exit(); 99 ieee80211_fail: 100 return ret; 101 } 102 103 /* Called at Driver Unloading */ 104 #ifndef CONFIG_DRIVERS_HDF_XR829 xradio_exit(void)105static void __exit xradio_exit(void) 106 #else 107 void xradio_exit(void) 108 #endif 109 { 110 if (etf_enable == 1) 111 goto exit_end; 112 113 xradio_core_deinit(); 114 #ifdef CONFIG_XRADIO_ETF 115 xradio_etf_to_wlan(0); 116 #endif 117 exit_end: 118 xradio_core_exit(); 119 ieee80211_exit(); 120 printk(KERN_ERR "======== XRADIO WIFI CLOSE ========\n"); 121 } 122 123 #ifndef CONFIG_DRIVERS_HDF_XR829 124 module_init(xradio_init); 125 module_exit(xradio_exit); 126 #else 127 EXPORT_SYMBOL(xradio_init); 128 EXPORT_SYMBOL(xradio_exit); 129 #endif 130