aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath6kl
diff options
context:
space:
mode:
authorVasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>2012-02-28 09:50:23 -0500
committerKalle Valo <kvalo@qca.qualcomm.com>2012-03-01 01:30:19 -0500
commitb796f0934ae07fdd26d265ac9bf87e18921d7fef (patch)
tree21813707c27ebcc2257b1c1a6a8565b0091ee3ad /drivers/net/wireless/ath/ath6kl
parent81db48dc295e16aced8ece912098fda078b1ba8c (diff)
ath6kl: Defer wiphy and netdev registration till the end of ath6kl_core_init()
This makes the wiphy and initial netdev registration the last step in dev initialization. Apart from the fact that this looks right, it can also be used to setup wiphy with the regulatory information received from firmware after uploading the firmware. Also it fixes a FIXME in ath6kl_core_init() where mac address is copied into netdev->dev_addr, ath6kl_interface_add() takes care of this as well. Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath6kl')
-rw-r--r--drivers/net/wireless/ath/ath6kl/core.c76
1 files changed, 32 insertions, 44 deletions
diff --git a/drivers/net/wireless/ath/ath6kl/core.c b/drivers/net/wireless/ath/ath6kl/core.c
index d5c06c0dddab..e66cf4399b61 100644
--- a/drivers/net/wireless/ath/ath6kl/core.c
+++ b/drivers/net/wireless/ath/ath6kl/core.c
@@ -98,38 +98,6 @@ int ath6kl_core_init(struct ath6kl *ar)
98 98
99 ath6kl_dbg(ATH6KL_DBG_TRC, "%s: got wmi @ 0x%p.\n", __func__, ar->wmi); 99 ath6kl_dbg(ATH6KL_DBG_TRC, "%s: got wmi @ 0x%p.\n", __func__, ar->wmi);
100 100
101 ret = ath6kl_cfg80211_init(ar);
102 if (ret)
103 goto err_node_cleanup;
104
105 ret = ath6kl_debug_init(ar);
106 if (ret) {
107 wiphy_unregister(ar->wiphy);
108 goto err_node_cleanup;
109 }
110
111 for (i = 0; i < ar->vif_max; i++)
112 ar->avail_idx_map |= BIT(i);
113
114 rtnl_lock();
115
116 /* Add an initial station interface */
117 ndev = ath6kl_interface_add(ar, "wlan%d", NL80211_IFTYPE_STATION, 0,
118 INFRA_NETWORK);
119
120 rtnl_unlock();
121
122 if (!ndev) {
123 ath6kl_err("Failed to instantiate a network device\n");
124 ret = -ENOMEM;
125 wiphy_unregister(ar->wiphy);
126 goto err_debug_init;
127 }
128
129
130 ath6kl_dbg(ATH6KL_DBG_TRC, "%s: name=%s dev=0x%p, ar=0x%p\n",
131 __func__, ndev->name, ndev, ar);
132
133 /* setup access class priority mappings */ 101 /* setup access class priority mappings */
134 ar->ac_stream_pri_map[WMM_AC_BK] = 0; /* lowest */ 102 ar->ac_stream_pri_map[WMM_AC_BK] = 0; /* lowest */
135 ar->ac_stream_pri_map[WMM_AC_BE] = 1; 103 ar->ac_stream_pri_map[WMM_AC_BE] = 1;
@@ -166,24 +134,44 @@ int ath6kl_core_init(struct ath6kl *ar)
166 ath6kl_rx_refill(ar->htc_target, ar->ctrl_ep); 134 ath6kl_rx_refill(ar->htc_target, ar->ctrl_ep);
167 ath6kl_rx_refill(ar->htc_target, ar->ac2ep_map[WMM_AC_BE]); 135 ath6kl_rx_refill(ar->htc_target, ar->ac2ep_map[WMM_AC_BE]);
168 136
169 /* 137 ret = ath6kl_cfg80211_init(ar);
170 * Set mac address which is received in ready event 138 if (ret)
171 * FIXME: Move to ath6kl_interface_add() 139 goto err_rxbuf_cleanup;
172 */
173 memcpy(ndev->dev_addr, ar->mac_addr, ETH_ALEN);
174 140
175 return ret; 141 ret = ath6kl_debug_init(ar);
142 if (ret) {
143 wiphy_unregister(ar->wiphy);
144 goto err_rxbuf_cleanup;
145 }
146
147 for (i = 0; i < ar->vif_max; i++)
148 ar->avail_idx_map |= BIT(i);
176 149
177err_rxbuf_cleanup:
178 ath6kl_htc_flush_rx_buf(ar->htc_target);
179 ath6kl_cleanup_amsdu_rxbufs(ar);
180 rtnl_lock(); 150 rtnl_lock();
181 ath6kl_cfg80211_vif_cleanup(netdev_priv(ndev)); 151
152 /* Add an initial station interface */
153 ndev = ath6kl_interface_add(ar, "wlan%d", NL80211_IFTYPE_STATION, 0,
154 INFRA_NETWORK);
155
182 rtnl_unlock(); 156 rtnl_unlock();
183 wiphy_unregister(ar->wiphy); 157
158 if (!ndev) {
159 ath6kl_err("Failed to instantiate a network device\n");
160 ret = -ENOMEM;
161 wiphy_unregister(ar->wiphy);
162 goto err_debug_init;
163 }
164
165 ath6kl_dbg(ATH6KL_DBG_TRC, "%s: name=%s dev=0x%p, ar=0x%p\n",
166 __func__, ndev->name, ndev, ar);
167
168 return ret;
169
184err_debug_init: 170err_debug_init:
185 ath6kl_debug_cleanup(ar); 171 ath6kl_debug_cleanup(ar);
186err_node_cleanup: 172err_rxbuf_cleanup:
173 ath6kl_htc_flush_rx_buf(ar->htc_target);
174 ath6kl_cleanup_amsdu_rxbufs(ar);
187 ath6kl_wmi_shutdown(ar->wmi); 175 ath6kl_wmi_shutdown(ar->wmi);
188 clear_bit(WMI_ENABLED, &ar->flag); 176 clear_bit(WMI_ENABLED, &ar->flag);
189 ar->wmi = NULL; 177 ar->wmi = NULL;