aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi
diff options
context:
space:
mode:
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>2012-02-09 09:08:15 -0500
committerWey-Yi Guy <wey-yi.w.guy@intel.com>2012-02-27 16:26:02 -0500
commitd0f76d6869adad1f3757d102af47508be0642949 (patch)
tree01c2813ad16f9a425c60162f6664b7195f897214 /drivers/net/wireless/iwlwifi
parent6459f9871a1218f7a2e6385d1ae6c91e91f9d251 (diff)
iwlwifi: virtualize the op_mode
Define the op_mode as an interface with its ops. All the functions of the op_mode are "private", but its ops is made public in iwl-op-mode.h. The drv object starts the op_mode by using the start function in the public ops. Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-lib.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-rs.c16
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-rxon.c4
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.c32
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-dev.h8
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-drv.c6
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-mac80211.c62
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-op-mode.h108
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-shared.h4
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-testmode.c20
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-ucode.c5
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-wifi.h2
12 files changed, 204 insertions, 65 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
index c368433f8bc8..5be0d3695d03 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
@@ -959,7 +959,7 @@ static void iwlagn_wowlan_program_keys(struct ieee80211_hw *hw,
959 struct ieee80211_key_conf *key, 959 struct ieee80211_key_conf *key,
960 void *_data) 960 void *_data)
961{ 961{
962 struct iwl_priv *priv = hw->priv; 962 struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw);
963 struct wowlan_key_data *data = _data; 963 struct wowlan_key_data *data = _data;
964 struct iwl_rxon_context *ctx = data->ctx; 964 struct iwl_rxon_context *ctx = data->ctx;
965 struct aes_sc *aes_sc, *aes_tx_sc = NULL; 965 struct aes_sc *aes_sc, *aes_tx_sc = NULL;
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
index f88e2e33e2e8..a7d67135e3dc 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
@@ -38,6 +38,7 @@
38#include "iwl-dev.h" 38#include "iwl-dev.h"
39#include "iwl-core.h" 39#include "iwl-core.h"
40#include "iwl-agn.h" 40#include "iwl-agn.h"
41#include "iwl-op-mode.h"
41 42
42#define RS_NAME "iwl-agn-rs" 43#define RS_NAME "iwl-agn-rs"
43 44
@@ -909,7 +910,8 @@ static void rs_tx_status(void *priv_r, struct ieee80211_supported_band *sband,
909 struct iwl_lq_sta *lq_sta = priv_sta; 910 struct iwl_lq_sta *lq_sta = priv_sta;
910 struct iwl_link_quality_cmd *table; 911 struct iwl_link_quality_cmd *table;
911 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; 912 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
912 struct iwl_priv *priv = (struct iwl_priv *)priv_r; 913 struct iwl_op_mode *op_mode = (struct iwl_op_mode *)priv_r;
914 struct iwl_priv *priv = IWL_OP_MODE_GET_DVM(op_mode);
913 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 915 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
914 enum mac80211_rate_control_flags mac_flags; 916 enum mac80211_rate_control_flags mac_flags;
915 u32 tx_rate; 917 u32 tx_rate;
@@ -2737,7 +2739,9 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta, void *priv_sta,
2737 2739
2738 struct sk_buff *skb = txrc->skb; 2740 struct sk_buff *skb = txrc->skb;
2739 struct ieee80211_supported_band *sband = txrc->sband; 2741 struct ieee80211_supported_band *sband = txrc->sband;
2740 struct iwl_priv *priv __maybe_unused = (struct iwl_priv *)priv_r; 2742 struct iwl_op_mode *op_mode __maybe_unused =
2743 (struct iwl_op_mode *)priv_r;
2744 struct iwl_priv *priv __maybe_unused = IWL_OP_MODE_GET_DVM(op_mode);
2741 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 2745 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
2742 struct iwl_lq_sta *lq_sta = priv_sta; 2746 struct iwl_lq_sta *lq_sta = priv_sta;
2743 int rate_idx; 2747 int rate_idx;
@@ -2805,9 +2809,10 @@ static void *rs_alloc_sta(void *priv_rate, struct ieee80211_sta *sta,
2805 gfp_t gfp) 2809 gfp_t gfp)
2806{ 2810{
2807 struct iwl_station_priv *sta_priv = (struct iwl_station_priv *) sta->drv_priv; 2811 struct iwl_station_priv *sta_priv = (struct iwl_station_priv *) sta->drv_priv;
2808 struct iwl_priv *priv; 2812 struct iwl_op_mode *op_mode __maybe_unused =
2813 (struct iwl_op_mode *)priv_rate;
2814 struct iwl_priv *priv __maybe_unused = IWL_OP_MODE_GET_DVM(op_mode);
2809 2815
2810 priv = (struct iwl_priv *)priv_rate;
2811 IWL_DEBUG_RATE(priv, "create station rate scale window\n"); 2816 IWL_DEBUG_RATE(priv, "create station rate scale window\n");
2812 2817
2813 return &sta_priv->lq_sta; 2818 return &sta_priv->lq_sta;
@@ -3074,7 +3079,8 @@ static void rs_free(void *priv_rate)
3074static void rs_free_sta(void *priv_r, struct ieee80211_sta *sta, 3079static void rs_free_sta(void *priv_r, struct ieee80211_sta *sta,
3075 void *priv_sta) 3080 void *priv_sta)
3076{ 3081{
3077 struct iwl_priv *priv __maybe_unused = priv_r; 3082 struct iwl_op_mode *op_mode __maybe_unused = priv_r;
3083 struct iwl_priv *priv __maybe_unused = IWL_OP_MODE_GET_DVM(op_mode);
3078 3084
3079 IWL_DEBUG_RATE(priv, "enter\n"); 3085 IWL_DEBUG_RATE(priv, "enter\n");
3080 IWL_DEBUG_RATE(priv, "leave\n"); 3086 IWL_DEBUG_RATE(priv, "leave\n");
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c b/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c
index 35dd7e364b46..73653a6cf32d 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c
@@ -549,7 +549,7 @@ void iwlagn_config_ht40(struct ieee80211_conf *conf,
549 549
550int iwlagn_mac_config(struct ieee80211_hw *hw, u32 changed) 550int iwlagn_mac_config(struct ieee80211_hw *hw, u32 changed)
551{ 551{
552 struct iwl_priv *priv = hw->priv; 552 struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw);
553 struct iwl_rxon_context *ctx; 553 struct iwl_rxon_context *ctx;
554 struct ieee80211_conf *conf = &hw->conf; 554 struct ieee80211_conf *conf = &hw->conf;
555 struct ieee80211_channel *channel = conf->channel; 555 struct ieee80211_channel *channel = conf->channel;
@@ -805,7 +805,7 @@ void iwlagn_bss_info_changed(struct ieee80211_hw *hw,
805 struct ieee80211_bss_conf *bss_conf, 805 struct ieee80211_bss_conf *bss_conf,
806 u32 changes) 806 u32 changes)
807{ 807{
808 struct iwl_priv *priv = hw->priv; 808 struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw);
809 struct iwl_rxon_context *ctx = iwl_rxon_ctx_from_vif(vif); 809 struct iwl_rxon_context *ctx = iwl_rxon_ctx_from_vif(vif);
810 int ret; 810 int ret;
811 bool force = false; 811 bool force = false;
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index 09f343cd405e..dbef0f48c3ef 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -52,6 +52,7 @@
52#include "iwl-shared.h" 52#include "iwl-shared.h"
53#include "iwl-bus.h" 53#include "iwl-bus.h"
54#include "iwl-trans.h" 54#include "iwl-trans.h"
55#include "iwl-op-mode.h"
55 56
56/****************************************************************************** 57/******************************************************************************
57 * 58 *
@@ -1142,14 +1143,13 @@ static void iwl_debug_config(struct iwl_priv *priv)
1142#endif 1143#endif
1143} 1144}
1144 1145
1145int iwl_op_mode_dvm_start(struct iwl_bus *bus, 1146static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans)
1146 const struct iwl_trans_ops *trans_ops,
1147 struct iwl_cfg *cfg)
1148{ 1147{
1149 struct iwl_fw *fw = &nic(bus)->fw; 1148 struct iwl_fw *fw = &nic(trans)->fw;
1150 int err = 0; 1149 int err = 0;
1151 struct iwl_priv *priv; 1150 struct iwl_priv *priv;
1152 struct ieee80211_hw *hw; 1151 struct ieee80211_hw *hw;
1152 struct iwl_op_mode *op_mode;
1153 u16 num_mac; 1153 u16 num_mac;
1154 u32 ucode_flags; 1154 u32 ucode_flags;
1155 1155
@@ -1158,18 +1158,21 @@ int iwl_op_mode_dvm_start(struct iwl_bus *bus,
1158 ************************/ 1158 ************************/
1159 hw = iwl_alloc_all(); 1159 hw = iwl_alloc_all();
1160 if (!hw) { 1160 if (!hw) {
1161 pr_err("%s: Cannot allocate network device\n", cfg->name); 1161 pr_err("%s: Cannot allocate network device\n",
1162 cfg(trans)->name);
1162 err = -ENOMEM; 1163 err = -ENOMEM;
1163 goto out; 1164 goto out;
1164 } 1165 }
1165 1166
1166 priv = hw->priv; 1167 op_mode = hw->priv;
1167 priv->shrd = bus->shrd; 1168 op_mode->ops = &iwl_dvm_ops;
1169 priv = IWL_OP_MODE_GET_DVM(op_mode);
1170 priv->shrd = trans->shrd;
1168 priv->shrd->priv = priv; 1171 priv->shrd->priv = priv;
1169 1172
1170 /* At this point both hw and priv are allocated. */ 1173 /* At this point both hw and priv are allocated. */
1171 1174
1172 SET_IEEE80211_DEV(hw, trans(priv)->dev); 1175 SET_IEEE80211_DEV(priv->hw, trans(priv)->dev);
1173 1176
1174 /* show what debugging capabilities we have */ 1177 /* show what debugging capabilities we have */
1175 iwl_debug_config(priv); 1178 iwl_debug_config(priv);
@@ -1316,7 +1319,7 @@ int iwl_op_mode_dvm_start(struct iwl_bus *bus,
1316 "failed to create debugfs files. Ignoring error: %d\n", 1319 "failed to create debugfs files. Ignoring error: %d\n",
1317 err); 1320 err);
1318 1321
1319 return 0; 1322 return op_mode;
1320 1323
1321out_destroy_workqueue: 1324out_destroy_workqueue:
1322 destroy_workqueue(priv->workqueue); 1325 destroy_workqueue(priv->workqueue);
@@ -1328,11 +1331,14 @@ out_free_traffic_mem:
1328 iwl_free_traffic_mem(priv); 1331 iwl_free_traffic_mem(priv);
1329 ieee80211_free_hw(priv->hw); 1332 ieee80211_free_hw(priv->hw);
1330out: 1333out:
1331 return err; 1334 op_mode = NULL;
1335 return op_mode;
1332} 1336}
1333 1337
1334void iwl_op_mode_dvm_stop(struct iwl_priv *priv) 1338static void iwl_op_mode_dvm_stop(struct iwl_op_mode *op_mode)
1335{ 1339{
1340 struct iwl_priv *priv = IWL_OP_MODE_GET_DVM(op_mode);
1341
1336 wait_for_completion(&nic(priv)->request_firmware_complete); 1342 wait_for_completion(&nic(priv)->request_firmware_complete);
1337 1343
1338 IWL_DEBUG_INFO(priv, "*** UNLOAD DRIVER ***\n"); 1344 IWL_DEBUG_INFO(priv, "*** UNLOAD DRIVER ***\n");
@@ -1374,6 +1380,10 @@ void iwl_op_mode_dvm_stop(struct iwl_priv *priv)
1374 ieee80211_free_hw(priv->hw); 1380 ieee80211_free_hw(priv->hw);
1375} 1381}
1376 1382
1383const struct iwl_op_mode_ops iwl_dvm_ops = {
1384 .start = iwl_op_mode_dvm_start,
1385 .stop = iwl_op_mode_dvm_stop,
1386};
1377 1387
1378/***************************************************************************** 1388/*****************************************************************************
1379 * 1389 *
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h
index 494c696dc177..479d3281a972 100644
--- a/drivers/net/wireless/iwlwifi/iwl-dev.h
+++ b/drivers/net/wireless/iwlwifi/iwl-dev.h
@@ -50,6 +50,7 @@
50#include "iwl-bus.h" 50#include "iwl-bus.h"
51#include "iwl-trans.h" 51#include "iwl-trans.h"
52#include "iwl-shared.h" 52#include "iwl-shared.h"
53#include "iwl-op-mode.h"
53 54
54struct iwl_tx_queue; 55struct iwl_tx_queue;
55 56
@@ -710,6 +711,13 @@ struct iwl_wipan_noa_data {
710 u8 data[]; 711 u8 data[];
711}; 712};
712 713
714#define IWL_OP_MODE_GET_DVM(_iwl_op_mode) \
715 ((struct iwl_priv *) ((_iwl_op_mode)->op_mode_specific))
716
717#define IWL_MAC80211_GET_DVM(_hw) \
718 ((struct iwl_priv *) ((struct iwl_op_mode *) \
719 (_hw)->priv)->op_mode_specific)
720
713struct iwl_priv { 721struct iwl_priv {
714 722
715 /*data shared among all the driver's layers */ 723 /*data shared among all the driver's layers */
diff --git a/drivers/net/wireless/iwlwifi/iwl-drv.c b/drivers/net/wireless/iwlwifi/iwl-drv.c
index db430c7d27d7..8ff52568cf6e 100644
--- a/drivers/net/wireless/iwlwifi/iwl-drv.c
+++ b/drivers/net/wireless/iwlwifi/iwl-drv.c
@@ -65,6 +65,7 @@
65#include "iwl-drv.h" 65#include "iwl-drv.h"
66#include "iwl-trans.h" 66#include "iwl-trans.h"
67#include "iwl-wifi.h" 67#include "iwl-wifi.h"
68#include "iwl-op-mode.h"
68 69
69int iwl_drv_start(struct iwl_shared *shrd, 70int iwl_drv_start(struct iwl_shared *shrd,
70 struct iwl_trans *trans, struct iwl_cfg *cfg) 71 struct iwl_trans *trans, struct iwl_cfg *cfg)
@@ -94,8 +95,9 @@ int iwl_drv_start(struct iwl_shared *shrd,
94 95
95void iwl_drv_stop(struct iwl_shared *shrd) 96void iwl_drv_stop(struct iwl_shared *shrd)
96{ 97{
97 iwl_op_mode_dvm_stop(shrd->priv); 98 /* op_mode can be NULL if its start failed */
99 if (shrd->nic->op_mode)
100 iwl_op_mode_stop(shrd->nic->op_mode);
98 101
99 kfree(shrd->nic); 102 kfree(shrd->nic);
100} 103}
101
diff --git a/drivers/net/wireless/iwlwifi/iwl-mac80211.c b/drivers/net/wireless/iwlwifi/iwl-mac80211.c
index 9c29234221fd..3ca89ab67029 100644
--- a/drivers/net/wireless/iwlwifi/iwl-mac80211.c
+++ b/drivers/net/wireless/iwlwifi/iwl-mac80211.c
@@ -53,6 +53,7 @@
53#include "iwl-shared.h" 53#include "iwl-shared.h"
54#include "iwl-bus.h" 54#include "iwl-bus.h"
55#include "iwl-trans.h" 55#include "iwl-trans.h"
56#include "iwl-op-mode.h"
56 57
57/***************************************************************************** 58/*****************************************************************************
58 * 59 *
@@ -305,7 +306,7 @@ static int __iwl_up(struct iwl_priv *priv)
305 306
306static int iwlagn_mac_start(struct ieee80211_hw *hw) 307static int iwlagn_mac_start(struct ieee80211_hw *hw)
307{ 308{
308 struct iwl_priv *priv = hw->priv; 309 struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw);
309 int ret; 310 int ret;
310 311
311 IWL_DEBUG_MAC80211(priv, "enter\n"); 312 IWL_DEBUG_MAC80211(priv, "enter\n");
@@ -332,7 +333,7 @@ static int iwlagn_mac_start(struct ieee80211_hw *hw)
332 333
333static void iwlagn_mac_stop(struct ieee80211_hw *hw) 334static void iwlagn_mac_stop(struct ieee80211_hw *hw)
334{ 335{
335 struct iwl_priv *priv = hw->priv; 336 struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw);
336 337
337 IWL_DEBUG_MAC80211(priv, "enter\n"); 338 IWL_DEBUG_MAC80211(priv, "enter\n");
338 339
@@ -362,7 +363,7 @@ static void iwlagn_mac_set_rekey_data(struct ieee80211_hw *hw,
362 struct ieee80211_vif *vif, 363 struct ieee80211_vif *vif,
363 struct cfg80211_gtk_rekey_data *data) 364 struct cfg80211_gtk_rekey_data *data)
364{ 365{
365 struct iwl_priv *priv = hw->priv; 366 struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw);
366 367
367 if (iwlagn_mod_params.sw_crypto) 368 if (iwlagn_mod_params.sw_crypto)
368 return; 369 return;
@@ -389,7 +390,7 @@ static void iwlagn_mac_set_rekey_data(struct ieee80211_hw *hw,
389static int iwlagn_mac_suspend(struct ieee80211_hw *hw, 390static int iwlagn_mac_suspend(struct ieee80211_hw *hw,
390 struct cfg80211_wowlan *wowlan) 391 struct cfg80211_wowlan *wowlan)
391{ 392{
392 struct iwl_priv *priv = hw->priv; 393 struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw);
393 struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; 394 struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS];
394 int ret; 395 int ret;
395 396
@@ -431,7 +432,7 @@ static int iwlagn_mac_suspend(struct ieee80211_hw *hw,
431 432
432static int iwlagn_mac_resume(struct ieee80211_hw *hw) 433static int iwlagn_mac_resume(struct ieee80211_hw *hw)
433{ 434{
434 struct iwl_priv *priv = hw->priv; 435 struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw);
435 struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; 436 struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS];
436 struct ieee80211_vif *vif; 437 struct ieee80211_vif *vif;
437 unsigned long flags; 438 unsigned long flags;
@@ -497,7 +498,7 @@ static int iwlagn_mac_resume(struct ieee80211_hw *hw)
497 498
498static void iwlagn_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb) 499static void iwlagn_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
499{ 500{
500 struct iwl_priv *priv = hw->priv; 501 struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw);
501 502
502 IWL_DEBUG_TX(priv, "dev->xmit(%d bytes) at rate 0x%02x\n", skb->len, 503 IWL_DEBUG_TX(priv, "dev->xmit(%d bytes) at rate 0x%02x\n", skb->len,
503 ieee80211_get_tx_rate(hw, IEEE80211_SKB_CB(skb))->bitrate); 504 ieee80211_get_tx_rate(hw, IEEE80211_SKB_CB(skb))->bitrate);
@@ -512,7 +513,7 @@ static void iwlagn_mac_update_tkip_key(struct ieee80211_hw *hw,
512 struct ieee80211_sta *sta, 513 struct ieee80211_sta *sta,
513 u32 iv32, u16 *phase1key) 514 u32 iv32, u16 *phase1key)
514{ 515{
515 struct iwl_priv *priv = hw->priv; 516 struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw);
516 517
517 iwl_update_tkip_key(priv, vif, keyconf, sta, iv32, phase1key); 518 iwl_update_tkip_key(priv, vif, keyconf, sta, iv32, phase1key);
518} 519}
@@ -522,7 +523,7 @@ static int iwlagn_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
522 struct ieee80211_sta *sta, 523 struct ieee80211_sta *sta,
523 struct ieee80211_key_conf *key) 524 struct ieee80211_key_conf *key)
524{ 525{
525 struct iwl_priv *priv = hw->priv; 526 struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw);
526 struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv; 527 struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv;
527 struct iwl_rxon_context *ctx = vif_priv->ctx; 528 struct iwl_rxon_context *ctx = vif_priv->ctx;
528 int ret; 529 int ret;
@@ -626,7 +627,7 @@ static int iwlagn_mac_ampdu_action(struct ieee80211_hw *hw,
626 struct ieee80211_sta *sta, u16 tid, u16 *ssn, 627 struct ieee80211_sta *sta, u16 tid, u16 *ssn,
627 u8 buf_size) 628 u8 buf_size)
628{ 629{
629 struct iwl_priv *priv = hw->priv; 630 struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw);
630 int ret = -EINVAL; 631 int ret = -EINVAL;
631 struct iwl_station_priv *sta_priv = (void *) sta->drv_priv; 632 struct iwl_station_priv *sta_priv = (void *) sta->drv_priv;
632 633
@@ -692,7 +693,7 @@ static int iwlagn_mac_sta_add(struct ieee80211_hw *hw,
692 struct ieee80211_vif *vif, 693 struct ieee80211_vif *vif,
693 struct ieee80211_sta *sta) 694 struct ieee80211_sta *sta)
694{ 695{
695 struct iwl_priv *priv = hw->priv; 696 struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw);
696 struct iwl_station_priv *sta_priv = (void *)sta->drv_priv; 697 struct iwl_station_priv *sta_priv = (void *)sta->drv_priv;
697 struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv; 698 struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv;
698 bool is_ap = vif->type == NL80211_IFTYPE_STATION; 699 bool is_ap = vif->type == NL80211_IFTYPE_STATION;
@@ -735,7 +736,7 @@ static int iwlagn_mac_sta_add(struct ieee80211_hw *hw,
735static void iwlagn_mac_channel_switch(struct ieee80211_hw *hw, 736static void iwlagn_mac_channel_switch(struct ieee80211_hw *hw,
736 struct ieee80211_channel_switch *ch_switch) 737 struct ieee80211_channel_switch *ch_switch)
737{ 738{
738 struct iwl_priv *priv = hw->priv; 739 struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw);
739 const struct iwl_channel_info *ch_info; 740 const struct iwl_channel_info *ch_info;
740 struct ieee80211_conf *conf = &hw->conf; 741 struct ieee80211_conf *conf = &hw->conf;
741 struct ieee80211_channel *channel = ch_switch->channel; 742 struct ieee80211_channel *channel = ch_switch->channel;
@@ -822,7 +823,7 @@ static void iwlagn_configure_filter(struct ieee80211_hw *hw,
822 unsigned int *total_flags, 823 unsigned int *total_flags,
823 u64 multicast) 824 u64 multicast)
824{ 825{
825 struct iwl_priv *priv = hw->priv; 826 struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw);
826 __le32 filter_or = 0, filter_nand = 0; 827 __le32 filter_or = 0, filter_nand = 0;
827 struct iwl_rxon_context *ctx; 828 struct iwl_rxon_context *ctx;
828 829
@@ -869,7 +870,7 @@ static void iwlagn_configure_filter(struct ieee80211_hw *hw,
869 870
870static void iwlagn_mac_flush(struct ieee80211_hw *hw, bool drop) 871static void iwlagn_mac_flush(struct ieee80211_hw *hw, bool drop)
871{ 872{
872 struct iwl_priv *priv = hw->priv; 873 struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw);
873 874
874 mutex_lock(&priv->shrd->mutex); 875 mutex_lock(&priv->shrd->mutex);
875 IWL_DEBUG_MAC80211(priv, "enter\n"); 876 IWL_DEBUG_MAC80211(priv, "enter\n");
@@ -906,7 +907,7 @@ static int iwlagn_mac_remain_on_channel(struct ieee80211_hw *hw,
906 enum nl80211_channel_type channel_type, 907 enum nl80211_channel_type channel_type,
907 int duration) 908 int duration)
908{ 909{
909 struct iwl_priv *priv = hw->priv; 910 struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw);
910 struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_PAN]; 911 struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_PAN];
911 int err = 0; 912 int err = 0;
912 913
@@ -996,7 +997,7 @@ static int iwlagn_mac_remain_on_channel(struct ieee80211_hw *hw,
996 997
997static int iwlagn_mac_cancel_remain_on_channel(struct ieee80211_hw *hw) 998static int iwlagn_mac_cancel_remain_on_channel(struct ieee80211_hw *hw)
998{ 999{
999 struct iwl_priv *priv = hw->priv; 1000 struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw);
1000 1001
1001 if (!(priv->shrd->valid_contexts & BIT(IWL_RXON_CTX_PAN))) 1002 if (!(priv->shrd->valid_contexts & BIT(IWL_RXON_CTX_PAN)))
1002 return -EOPNOTSUPP; 1003 return -EOPNOTSUPP;
@@ -1016,7 +1017,7 @@ static int iwlagn_mac_tx_sync(struct ieee80211_hw *hw,
1016 const u8 *bssid, 1017 const u8 *bssid,
1017 enum ieee80211_tx_sync_type type) 1018 enum ieee80211_tx_sync_type type)
1018{ 1019{
1019 struct iwl_priv *priv = hw->priv; 1020 struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw);
1020 struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv; 1021 struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv;
1021 struct iwl_rxon_context *ctx = vif_priv->ctx; 1022 struct iwl_rxon_context *ctx = vif_priv->ctx;
1022 int ret; 1023 int ret;
@@ -1070,7 +1071,7 @@ static void iwlagn_mac_finish_tx_sync(struct ieee80211_hw *hw,
1070 const u8 *bssid, 1071 const u8 *bssid,
1071 enum ieee80211_tx_sync_type type) 1072 enum ieee80211_tx_sync_type type)
1072{ 1073{
1073 struct iwl_priv *priv = hw->priv; 1074 struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw);
1074 struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv; 1075 struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv;
1075 struct iwl_rxon_context *ctx = vif_priv->ctx; 1076 struct iwl_rxon_context *ctx = vif_priv->ctx;
1076 1077
@@ -1094,7 +1095,7 @@ static void iwlagn_mac_finish_tx_sync(struct ieee80211_hw *hw,
1094static void iwlagn_mac_rssi_callback(struct ieee80211_hw *hw, 1095static void iwlagn_mac_rssi_callback(struct ieee80211_hw *hw,
1095 enum ieee80211_rssi_event rssi_event) 1096 enum ieee80211_rssi_event rssi_event)
1096{ 1097{
1097 struct iwl_priv *priv = hw->priv; 1098 struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw);
1098 1099
1099 IWL_DEBUG_MAC80211(priv, "enter\n"); 1100 IWL_DEBUG_MAC80211(priv, "enter\n");
1100 mutex_lock(&priv->shrd->mutex); 1101 mutex_lock(&priv->shrd->mutex);
@@ -1119,7 +1120,7 @@ static void iwlagn_mac_rssi_callback(struct ieee80211_hw *hw,
1119static int iwlagn_mac_set_tim(struct ieee80211_hw *hw, 1120static int iwlagn_mac_set_tim(struct ieee80211_hw *hw,
1120 struct ieee80211_sta *sta, bool set) 1121 struct ieee80211_sta *sta, bool set)
1121{ 1122{
1122 struct iwl_priv *priv = hw->priv; 1123 struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw);
1123 1124
1124 queue_work(priv->workqueue, &priv->beacon_update); 1125 queue_work(priv->workqueue, &priv->beacon_update);
1125 1126
@@ -1130,7 +1131,7 @@ static int iwlagn_mac_conf_tx(struct ieee80211_hw *hw,
1130 struct ieee80211_vif *vif, u16 queue, 1131 struct ieee80211_vif *vif, u16 queue,
1131 const struct ieee80211_tx_queue_params *params) 1132 const struct ieee80211_tx_queue_params *params)
1132{ 1133{
1133 struct iwl_priv *priv = hw->priv; 1134 struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw);
1134 struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv; 1135 struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv;
1135 struct iwl_rxon_context *ctx = vif_priv->ctx; 1136 struct iwl_rxon_context *ctx = vif_priv->ctx;
1136 unsigned long flags; 1137 unsigned long flags;
@@ -1173,7 +1174,7 @@ static int iwlagn_mac_conf_tx(struct ieee80211_hw *hw,
1173 1174
1174static int iwlagn_mac_tx_last_beacon(struct ieee80211_hw *hw) 1175static int iwlagn_mac_tx_last_beacon(struct ieee80211_hw *hw)
1175{ 1176{
1176 struct iwl_priv *priv = hw->priv; 1177 struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw);
1177 1178
1178 return priv->ibss_manager == IWL_IBSS_MANAGER; 1179 return priv->ibss_manager == IWL_IBSS_MANAGER;
1179} 1180}
@@ -1227,7 +1228,7 @@ static int iwl_setup_interface(struct iwl_priv *priv,
1227static int iwlagn_mac_add_interface(struct ieee80211_hw *hw, 1228static int iwlagn_mac_add_interface(struct ieee80211_hw *hw,
1228 struct ieee80211_vif *vif) 1229 struct ieee80211_vif *vif)
1229{ 1230{
1230 struct iwl_priv *priv = hw->priv; 1231 struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw);
1231 struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv; 1232 struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv;
1232 struct iwl_rxon_context *tmp, *ctx = NULL; 1233 struct iwl_rxon_context *tmp, *ctx = NULL;
1233 int err; 1234 int err;
@@ -1324,7 +1325,7 @@ static void iwl_teardown_interface(struct iwl_priv *priv,
1324static void iwlagn_mac_remove_interface(struct ieee80211_hw *hw, 1325static void iwlagn_mac_remove_interface(struct ieee80211_hw *hw,
1325 struct ieee80211_vif *vif) 1326 struct ieee80211_vif *vif)
1326{ 1327{
1327 struct iwl_priv *priv = hw->priv; 1328 struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw);
1328 struct iwl_rxon_context *ctx = iwl_rxon_ctx_from_vif(vif); 1329 struct iwl_rxon_context *ctx = iwl_rxon_ctx_from_vif(vif);
1329 1330
1330 IWL_DEBUG_MAC80211(priv, "enter\n"); 1331 IWL_DEBUG_MAC80211(priv, "enter\n");
@@ -1352,7 +1353,7 @@ static int iwlagn_mac_change_interface(struct ieee80211_hw *hw,
1352 struct ieee80211_vif *vif, 1353 struct ieee80211_vif *vif,
1353 enum nl80211_iftype newtype, bool newp2p) 1354 enum nl80211_iftype newtype, bool newp2p)
1354{ 1355{
1355 struct iwl_priv *priv = hw->priv; 1356 struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw);
1356 struct iwl_rxon_context *ctx = iwl_rxon_ctx_from_vif(vif); 1357 struct iwl_rxon_context *ctx = iwl_rxon_ctx_from_vif(vif);
1357 struct iwl_rxon_context *bss_ctx = &priv->contexts[IWL_RXON_CTX_BSS]; 1358 struct iwl_rxon_context *bss_ctx = &priv->contexts[IWL_RXON_CTX_BSS];
1358 struct iwl_rxon_context *tmp; 1359 struct iwl_rxon_context *tmp;
@@ -1438,7 +1439,7 @@ static int iwlagn_mac_hw_scan(struct ieee80211_hw *hw,
1438 struct ieee80211_vif *vif, 1439 struct ieee80211_vif *vif,
1439 struct cfg80211_scan_request *req) 1440 struct cfg80211_scan_request *req)
1440{ 1441{
1441 struct iwl_priv *priv = hw->priv; 1442 struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw);
1442 int ret; 1443 int ret;
1443 1444
1444 IWL_DEBUG_MAC80211(priv, "enter\n"); 1445 IWL_DEBUG_MAC80211(priv, "enter\n");
@@ -1484,7 +1485,7 @@ static int iwlagn_mac_sta_remove(struct ieee80211_hw *hw,
1484 struct ieee80211_vif *vif, 1485 struct ieee80211_vif *vif,
1485 struct ieee80211_sta *sta) 1486 struct ieee80211_sta *sta)
1486{ 1487{
1487 struct iwl_priv *priv = hw->priv; 1488 struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw);
1488 struct iwl_station_priv *sta_priv = (void *)sta->drv_priv; 1489 struct iwl_station_priv *sta_priv = (void *)sta->drv_priv;
1489 int ret; 1490 int ret;
1490 1491
@@ -1523,7 +1524,7 @@ static void iwlagn_mac_sta_notify(struct ieee80211_hw *hw,
1523 enum sta_notify_cmd cmd, 1524 enum sta_notify_cmd cmd,
1524 struct ieee80211_sta *sta) 1525 struct ieee80211_sta *sta)
1525{ 1526{
1526 struct iwl_priv *priv = hw->priv; 1527 struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw);
1527 struct iwl_station_priv *sta_priv = (void *)sta->drv_priv; 1528 struct iwl_station_priv *sta_priv = (void *)sta->drv_priv;
1528 int sta_id; 1529 int sta_id;
1529 1530
@@ -1591,15 +1592,18 @@ struct ieee80211_ops iwlagn_hw_ops = {
1591struct ieee80211_hw *iwl_alloc_all(void) 1592struct ieee80211_hw *iwl_alloc_all(void)
1592{ 1593{
1593 struct iwl_priv *priv; 1594 struct iwl_priv *priv;
1595 struct iwl_op_mode *op_mode;
1594 /* mac80211 allocates memory for this device instance, including 1596 /* mac80211 allocates memory for this device instance, including
1595 * space for this driver's private structure */ 1597 * space for this driver's private structure */
1596 struct ieee80211_hw *hw; 1598 struct ieee80211_hw *hw;
1597 1599
1598 hw = ieee80211_alloc_hw(sizeof(struct iwl_priv), &iwlagn_hw_ops); 1600 hw = ieee80211_alloc_hw(sizeof(struct iwl_priv) +
1601 sizeof(struct iwl_op_mode), &iwlagn_hw_ops);
1599 if (!hw) 1602 if (!hw)
1600 goto out; 1603 goto out;
1601 1604
1602 priv = hw->priv; 1605 op_mode = hw->priv;
1606 priv = IWL_OP_MODE_GET_DVM(op_mode);
1603 priv->hw = hw; 1607 priv->hw = hw;
1604 1608
1605out: 1609out:
diff --git a/drivers/net/wireless/iwlwifi/iwl-op-mode.h b/drivers/net/wireless/iwlwifi/iwl-op-mode.h
new file mode 100644
index 000000000000..c85c8dcabb49
--- /dev/null
+++ b/drivers/net/wireless/iwlwifi/iwl-op-mode.h
@@ -0,0 +1,108 @@
1/******************************************************************************
2 *
3 * This file is provided under a dual BSD/GPLv2 license. When using or
4 * redistributing this file, you may do so under either license.
5 *
6 * GPL LICENSE SUMMARY
7 *
8 * Copyright(c) 2007 - 2012 Intel Corporation. All rights reserved.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of version 2 of the GNU General Public License as
12 * published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
22 * USA
23 *
24 * The full GNU General Public License is included in this distribution
25 * in the file called LICENSE.GPL.
26 *
27 * Contact Information:
28 * Intel Linux Wireless <ilw@linux.intel.com>
29 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
30 *
31 * BSD LICENSE
32 *
33 * Copyright(c) 2005 - 2012 Intel Corporation. All rights reserved.
34 * All rights reserved.
35 *
36 * Redistribution and use in source and binary forms, with or without
37 * modification, are permitted provided that the following conditions
38 * are met:
39 *
40 * * Redistributions of source code must retain the above copyright
41 * notice, this list of conditions and the following disclaimer.
42 * * Redistributions in binary form must reproduce the above copyright
43 * notice, this list of conditions and the following disclaimer in
44 * the documentation and/or other materials provided with the
45 * distribution.
46 * * Neither the name Intel Corporation nor the names of its
47 * contributors may be used to endorse or promote products derived
48 * from this software without specific prior written permission.
49 *
50 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
51 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
52 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
53 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
54 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
55 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
56 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
57 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
58 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
59 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
60 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
61 *
62 *****************************************************************************/
63#ifndef __iwl_op_mode_h__
64#define __iwl_op_mode_h__
65
66struct iwl_op_mode;
67struct iwl_trans;
68
69/**
70 * struct iwl_op_mode_ops - op_mode specific operations
71 *
72 * All the handlers MUST be implemented
73 *
74 * @start: start the op_mode
75 * May sleep
76 * @stop: stop the op_mode
77 * May sleep
78 */
79struct iwl_op_mode_ops {
80 struct iwl_op_mode *(*start)(struct iwl_trans *trans);
81 void (*stop)(struct iwl_op_mode *op_mode);
82};
83
84/**
85 * struct iwl_op_mode - operational mode
86 *
87 * This holds an implementation of the mac80211 / fw API.
88 *
89 * @ops - pointer to its own ops
90 */
91struct iwl_op_mode {
92 const struct iwl_op_mode_ops *ops;
93 const struct iwl_trans *trans;
94
95 char op_mode_specific[0] __aligned(sizeof(void *));
96};
97
98static inline void iwl_op_mode_stop(struct iwl_op_mode *op_mode)
99{
100 op_mode->ops->stop(op_mode);
101}
102
103/*****************************************************
104* Op mode layers implementations
105******************************************************/
106extern const struct iwl_op_mode_ops iwl_dvm_ops;
107
108#endif /* __iwl_op_mode_h__ */
diff --git a/drivers/net/wireless/iwlwifi/iwl-shared.h b/drivers/net/wireless/iwlwifi/iwl-shared.h
index 392b33a59410..635e3eb4f86d 100644
--- a/drivers/net/wireless/iwlwifi/iwl-shared.h
+++ b/drivers/net/wireless/iwlwifi/iwl-shared.h
@@ -532,10 +532,6 @@ enum iwl_rxon_context_id {
532 NUM_IWL_RXON_CTX 532 NUM_IWL_RXON_CTX
533}; 533};
534 534
535int iwl_op_mode_dvm_start(struct iwl_bus *bus,
536 const struct iwl_trans_ops *trans_ops,
537 struct iwl_cfg *cfg);
538void iwl_op_mode_dvm_stop(struct iwl_priv *priv);
539struct iwl_device_cmd; 535struct iwl_device_cmd;
540int __must_check iwl_rx_dispatch(struct iwl_priv *priv, 536int __must_check iwl_rx_dispatch(struct iwl_priv *priv,
541 struct iwl_rx_mem_buffer *rxb, 537 struct iwl_rx_mem_buffer *rxb,
diff --git a/drivers/net/wireless/iwlwifi/iwl-testmode.c b/drivers/net/wireless/iwlwifi/iwl-testmode.c
index 80955ed06e82..e3cca664c19f 100644
--- a/drivers/net/wireless/iwlwifi/iwl-testmode.c
+++ b/drivers/net/wireless/iwlwifi/iwl-testmode.c
@@ -255,7 +255,7 @@ void iwl_testmode_cleanup(struct iwl_priv *priv)
255 */ 255 */
256static int iwl_testmode_ucode(struct ieee80211_hw *hw, struct nlattr **tb) 256static int iwl_testmode_ucode(struct ieee80211_hw *hw, struct nlattr **tb)
257{ 257{
258 struct iwl_priv *priv = hw->priv; 258 struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw);
259 struct iwl_host_cmd cmd; 259 struct iwl_host_cmd cmd;
260 struct iwl_rx_packet *pkt; 260 struct iwl_rx_packet *pkt;
261 struct sk_buff *skb; 261 struct sk_buff *skb;
@@ -341,7 +341,7 @@ nla_put_failure:
341 */ 341 */
342static int iwl_testmode_reg(struct ieee80211_hw *hw, struct nlattr **tb) 342static int iwl_testmode_reg(struct ieee80211_hw *hw, struct nlattr **tb)
343{ 343{
344 struct iwl_priv *priv = hw->priv; 344 struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw);
345 u32 ofs, val32, cmd; 345 u32 ofs, val32, cmd;
346 u8 val8; 346 u8 val8;
347 struct sk_buff *skb; 347 struct sk_buff *skb;
@@ -458,7 +458,7 @@ cfg_init_calib_error:
458 */ 458 */
459static int iwl_testmode_driver(struct ieee80211_hw *hw, struct nlattr **tb) 459static int iwl_testmode_driver(struct ieee80211_hw *hw, struct nlattr **tb)
460{ 460{
461 struct iwl_priv *priv = hw->priv; 461 struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw);
462 struct iwl_trans *trans = trans(priv); 462 struct iwl_trans *trans = trans(priv);
463 struct sk_buff *skb; 463 struct sk_buff *skb;
464 unsigned char *rsp_data_ptr = NULL; 464 unsigned char *rsp_data_ptr = NULL;
@@ -643,7 +643,7 @@ nla_put_failure:
643 */ 643 */
644static int iwl_testmode_trace(struct ieee80211_hw *hw, struct nlattr **tb) 644static int iwl_testmode_trace(struct ieee80211_hw *hw, struct nlattr **tb)
645{ 645{
646 struct iwl_priv *priv = hw->priv; 646 struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw);
647 struct sk_buff *skb; 647 struct sk_buff *skb;
648 int status = 0; 648 int status = 0;
649 struct device *dev = trans(priv)->dev; 649 struct device *dev = trans(priv)->dev;
@@ -718,7 +718,7 @@ static int iwl_testmode_trace_dump(struct ieee80211_hw *hw, struct nlattr **tb,
718 struct sk_buff *skb, 718 struct sk_buff *skb,
719 struct netlink_callback *cb) 719 struct netlink_callback *cb)
720{ 720{
721 struct iwl_priv *priv = hw->priv; 721 struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw);
722 int idx, length; 722 int idx, length;
723 723
724 if (priv->testmode_trace.trace_enabled && 724 if (priv->testmode_trace.trace_enabled &&
@@ -762,7 +762,7 @@ static int iwl_testmode_trace_dump(struct ieee80211_hw *hw, struct nlattr **tb,
762 */ 762 */
763static int iwl_testmode_ownership(struct ieee80211_hw *hw, struct nlattr **tb) 763static int iwl_testmode_ownership(struct ieee80211_hw *hw, struct nlattr **tb)
764{ 764{
765 struct iwl_priv *priv = hw->priv; 765 struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw);
766 u8 owner; 766 u8 owner;
767 767
768 if (!tb[IWL_TM_ATTR_UCODE_OWNER]) { 768 if (!tb[IWL_TM_ATTR_UCODE_OWNER]) {
@@ -876,7 +876,7 @@ static int iwl_testmode_indirect_write(struct iwl_priv *priv, u32 addr,
876static int iwl_testmode_indirect_mem(struct ieee80211_hw *hw, 876static int iwl_testmode_indirect_mem(struct ieee80211_hw *hw,
877 struct nlattr **tb) 877 struct nlattr **tb)
878{ 878{
879 struct iwl_priv *priv = hw->priv; 879 struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw);
880 u32 addr, size, cmd; 880 u32 addr, size, cmd;
881 unsigned char *buf; 881 unsigned char *buf;
882 882
@@ -910,7 +910,7 @@ static int iwl_testmode_buffer_dump(struct ieee80211_hw *hw, struct nlattr **tb,
910 struct sk_buff *skb, 910 struct sk_buff *skb,
911 struct netlink_callback *cb) 911 struct netlink_callback *cb)
912{ 912{
913 struct iwl_priv *priv = hw->priv; 913 struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw);
914 int idx, length; 914 int idx, length;
915 915
916 if (priv->testmode_mem.read_in_progress) { 916 if (priv->testmode_mem.read_in_progress) {
@@ -961,7 +961,7 @@ static int iwl_testmode_buffer_dump(struct ieee80211_hw *hw, struct nlattr **tb,
961int iwlagn_mac_testmode_cmd(struct ieee80211_hw *hw, void *data, int len) 961int iwlagn_mac_testmode_cmd(struct ieee80211_hw *hw, void *data, int len)
962{ 962{
963 struct nlattr *tb[IWL_TM_ATTR_MAX]; 963 struct nlattr *tb[IWL_TM_ATTR_MAX];
964 struct iwl_priv *priv = hw->priv; 964 struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw);
965 int result; 965 int result;
966 966
967 result = nla_parse(tb, IWL_TM_ATTR_MAX - 1, data, len, 967 result = nla_parse(tb, IWL_TM_ATTR_MAX - 1, data, len,
@@ -1038,7 +1038,7 @@ int iwlagn_mac_testmode_dump(struct ieee80211_hw *hw, struct sk_buff *skb,
1038 void *data, int len) 1038 void *data, int len)
1039{ 1039{
1040 struct nlattr *tb[IWL_TM_ATTR_MAX]; 1040 struct nlattr *tb[IWL_TM_ATTR_MAX];
1041 struct iwl_priv *priv = hw->priv; 1041 struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw);
1042 int result; 1042 int result;
1043 u32 cmd; 1043 u32 cmd;
1044 1044
diff --git a/drivers/net/wireless/iwlwifi/iwl-ucode.c b/drivers/net/wireless/iwlwifi/iwl-ucode.c
index 3645bf3d61c6..b16efc00ba6e 100644
--- a/drivers/net/wireless/iwlwifi/iwl-ucode.c
+++ b/drivers/net/wireless/iwlwifi/iwl-ucode.c
@@ -44,6 +44,7 @@
44#include "iwl-agn-calib.h" 44#include "iwl-agn-calib.h"
45#include "iwl-trans.h" 45#include "iwl-trans.h"
46#include "iwl-fh.h" 46#include "iwl-fh.h"
47#include "iwl-op-mode.h"
47 48
48static struct iwl_wimax_coex_event_entry cu_priorities[COEX_NUM_OF_EVENTS] = { 49static struct iwl_wimax_coex_event_entry cu_priorities[COEX_NUM_OF_EVENTS] = {
49 {COEX_CU_UNASSOC_IDLE_RP, COEX_CU_UNASSOC_IDLE_WP, 50 {COEX_CU_UNASSOC_IDLE_RP, COEX_CU_UNASSOC_IDLE_WP,
@@ -1240,7 +1241,9 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context)
1240 release_firmware(ucode_raw); 1241 release_firmware(ucode_raw);
1241 complete(&nic->request_firmware_complete); 1242 complete(&nic->request_firmware_complete);
1242 1243
1243 if (iwl_op_mode_dvm_start(bus(nic), trans(nic)->ops, cfg)) 1244 nic->op_mode = iwl_dvm_ops.start(nic->shrd->trans);
1245
1246 if (!nic->op_mode)
1244 goto out_unbind; 1247 goto out_unbind;
1245 1248
1246 return; 1249 return;
diff --git a/drivers/net/wireless/iwlwifi/iwl-wifi.h b/drivers/net/wireless/iwlwifi/iwl-wifi.h
index a78120e89fe1..d5cba07a24c8 100644
--- a/drivers/net/wireless/iwlwifi/iwl-wifi.h
+++ b/drivers/net/wireless/iwlwifi/iwl-wifi.h
@@ -72,6 +72,7 @@
72 * struct iwl_nic - nic common data 72 * struct iwl_nic - nic common data
73 * @fw: the iwl_fw structure 73 * @fw: the iwl_fw structure
74 * @shrd: pointer to common shared structure 74 * @shrd: pointer to common shared structure
75 * @op_mode: the running op_mode
75 * @fw_index: firmware revision to try loading 76 * @fw_index: firmware revision to try loading
76 * @firmware_name: composite filename of ucode file to load 77 * @firmware_name: composite filename of ucode file to load
77 * @init_evtlog_ptr: event log offset for init ucode. 78 * @init_evtlog_ptr: event log offset for init ucode.
@@ -86,6 +87,7 @@ struct iwl_nic {
86 struct iwl_fw fw; 87 struct iwl_fw fw;
87 88
88 struct iwl_shared *shrd; 89 struct iwl_shared *shrd;
90 struct iwl_op_mode *op_mode;
89 91
90 int fw_index; /* firmware we're trying to load */ 92 int fw_index; /* firmware we're trying to load */
91 char firmware_name[25]; /* name of firmware file to load */ 93 char firmware_name[25]; /* name of firmware file to load */