bd62781188c37c339ab5eafb8434b6a5d07677bd
[openwrt/staging/yousong.git] / package / kernel / mac80211 / patches / 344-0013-brcmfmac-move-module-init-and-exit-to-common.patch
1 From: Hante Meuleman <meuleman@broadcom.com>
2 Date: Wed, 17 Feb 2016 11:27:02 +0100
3 Subject: [PATCH] brcmfmac: move module init and exit to common
4
5 In preparation of module parameters for all devices the module init
6 and exit routines are moved to the common file.
7
8 Reviewed-by: Arend Van Spriel <arend@broadcom.com>
9 Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
10 Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
11 Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
12 Signed-off-by: Arend van Spriel <arend@broadcom.com>
13 Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
14 ---
15
16 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
17 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
18 @@ -28,6 +28,10 @@
19 #include "tracepoint.h"
20 #include "common.h"
21
22 +MODULE_AUTHOR("Broadcom Corporation");
23 +MODULE_DESCRIPTION("Broadcom 802.11 wireless LAN fullmac driver.");
24 +MODULE_LICENSE("Dual BSD/GPL");
25 +
26 const u8 ALLFFMAC[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
27
28 #define BRCMF_DEFAULT_SCAN_CHANNEL_TIME 40
29 @@ -221,7 +225,7 @@ void __brcmf_dbg(u32 level, const char *
30 }
31 #endif
32
33 -void brcmf_mp_attach(void)
34 +static void brcmf_mp_attach(void)
35 {
36 strlcpy(brcmf_mp_global.firmware_path, brcmf_firmware_path,
37 BRCMF_FW_ALTPATH_LEN);
38 @@ -249,3 +253,33 @@ void brcmf_mp_device_detach(struct brcmf
39 kfree(drvr->settings);
40 }
41
42 +static int __init brcmfmac_module_init(void)
43 +{
44 + int err;
45 +
46 + /* Initialize debug system first */
47 + brcmf_debugfs_init();
48 +
49 +#ifdef CPTCFG_BRCMFMAC_SDIO
50 + brcmf_sdio_init();
51 +#endif
52 + /* Initialize global module paramaters */
53 + brcmf_mp_attach();
54 +
55 + /* Continue the initialization by registering the different busses */
56 + err = brcmf_core_init();
57 + if (err)
58 + brcmf_debugfs_exit();
59 +
60 + return err;
61 +}
62 +
63 +static void __exit brcmfmac_module_exit(void)
64 +{
65 + brcmf_core_exit();
66 + brcmf_debugfs_exit();
67 +}
68 +
69 +module_init(brcmfmac_module_init);
70 +module_exit(brcmfmac_module_exit);
71 +
72 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h
73 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h
74 @@ -89,7 +89,6 @@ struct brcmf_mp_device {
75 struct cc_translate *country_codes;
76 };
77
78 -void brcmf_mp_attach(void);
79 int brcmf_mp_device_attach(struct brcmf_pub *drvr);
80 void brcmf_mp_device_detach(struct brcmf_pub *drvr);
81 #ifdef DEBUG
82 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
83 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
84 @@ -38,10 +38,6 @@
85 #include "pcie.h"
86 #include "common.h"
87
88 -MODULE_AUTHOR("Broadcom Corporation");
89 -MODULE_DESCRIPTION("Broadcom 802.11 wireless LAN fullmac driver.");
90 -MODULE_LICENSE("Dual BSD/GPL");
91 -
92 #define MAX_WAIT_FOR_8021X_TX msecs_to_jiffies(950)
93
94 /* AMPDU rx reordering definitions */
95 @@ -1422,19 +1418,15 @@ static void brcmf_driver_register(struct
96 }
97 static DECLARE_WORK(brcmf_driver_work, brcmf_driver_register);
98
99 -static int __init brcmfmac_module_init(void)
100 +int __init brcmf_core_init(void)
101 {
102 - brcmf_debugfs_init();
103 -#ifdef CPTCFG_BRCMFMAC_SDIO
104 - brcmf_sdio_init();
105 -#endif
106 if (!schedule_work(&brcmf_driver_work))
107 return -EBUSY;
108
109 return 0;
110 }
111
112 -static void __exit brcmfmac_module_exit(void)
113 +void __exit brcmf_core_exit(void)
114 {
115 cancel_work_sync(&brcmf_driver_work);
116
117 @@ -1447,8 +1439,5 @@ static void __exit brcmfmac_module_exit(
118 #ifdef CPTCFG_BRCMFMAC_PCIE
119 brcmf_pcie_exit();
120 #endif
121 - brcmf_debugfs_exit();
122 }
123
124 -module_init(brcmfmac_module_init);
125 -module_exit(brcmfmac_module_exit);
126 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
127 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
128 @@ -227,5 +227,7 @@ void brcmf_txflowblock_if(struct brcmf_i
129 void brcmf_txfinalize(struct brcmf_if *ifp, struct sk_buff *txp, bool success);
130 void brcmf_netif_rx(struct brcmf_if *ifp, struct sk_buff *skb);
131 void brcmf_net_setcarrier(struct brcmf_if *ifp, bool on);
132 +int __init brcmf_core_init(void);
133 +void __exit brcmf_core_exit(void);
134
135 #endif /* BRCMFMAC_CORE_H */