Since it is used by all the layers, it needs to move to iwl_shared.
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
        u8 scan_tx_antennas = hw_params(priv).valid_tx_ant;
        int ret;
 
-       lockdep_assert_held(&priv->mutex);
+       lockdep_assert_held(&priv->shrd->mutex);
 
        if (vif)
                ctx = iwl_rxon_ctx_from_vif(vif);
 
 void iwlagn_dev_txfifo_flush(struct iwl_priv *priv, u16 flush_control)
 {
-       mutex_lock(&priv->mutex);
+       mutex_lock(&priv->shrd->mutex);
        ieee80211_stop_queues(priv->hw);
        if (iwlagn_txfifo_flush(priv, IWL_DROP_ALL)) {
                IWL_ERR(priv, "flush request fail\n");
        iwlagn_wait_tx_queue_empty(priv);
 done:
        ieee80211_wake_queues(priv->hw);
-       mutex_unlock(&priv->mutex);
+       mutex_unlock(&priv->shrd->mutex);
 }
 
 /*
        struct iwl_rxon_context *ctx, *found_ctx = NULL;
        bool found_ap = false;
 
-       lockdep_assert_held(&priv->mutex);
+       lockdep_assert_held(&priv->shrd->mutex);
 
        /* Check whether AP or GO mode is active. */
        if (rssi_ena) {
                break;
        }
 
-       mutex_lock(&priv->mutex);
+       mutex_lock(&priv->shrd->mutex);
 
        /*
         * We can not send command to firmware while scanning. When the scan
         */
        iwlagn_bt_coex_rssi_monitor(priv);
 out:
-       mutex_unlock(&priv->mutex);
+       mutex_unlock(&priv->shrd->mutex);
 }
 
 /*
 
 static int iwlagn_update_beacon(struct iwl_priv *priv,
                                struct ieee80211_vif *vif)
 {
-       lockdep_assert_held(&priv->mutex);
+       lockdep_assert_held(&priv->shrd->mutex);
 
        dev_kfree_skb(priv->beacon_skb);
        priv->beacon_skb = ieee80211_beacon_get(priv->hw, vif);
 
        BUILD_BUG_ON(NUM_IWL_RXON_CTX != 2);
 
-       lockdep_assert_held(&priv->mutex);
+       lockdep_assert_held(&priv->shrd->mutex);
 
        ctx_bss = &priv->contexts[IWL_RXON_CTX_BSS];
        ctx_pan = &priv->contexts[IWL_RXON_CTX_PAN];
        bool new_assoc = !!(ctx->staging.filter_flags & RXON_FILTER_ASSOC_MSK);
        int ret;
 
-       lockdep_assert_held(&priv->mutex);
+       lockdep_assert_held(&priv->shrd->mutex);
 
        if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
                return -EINVAL;
 
        IWL_DEBUG_MAC80211(priv, "changed %#x", changed);
 
-       mutex_lock(&priv->mutex);
+       mutex_lock(&priv->shrd->mutex);
 
        if (unlikely(test_bit(STATUS_SCANNING, &priv->shrd->status))) {
                IWL_DEBUG_MAC80211(priv, "leave - scanning\n");
                iwlagn_commit_rxon(priv, ctx);
        }
  out:
-       mutex_unlock(&priv->mutex);
+       mutex_unlock(&priv->shrd->mutex);
        return ret;
 }
 
        struct ieee80211_sta_ht_cap *ht_cap;
        bool need_multiple;
 
-       lockdep_assert_held(&priv->mutex);
+       lockdep_assert_held(&priv->shrd->mutex);
 
        switch (vif->type) {
        case NL80211_IFTYPE_STATION:
        int ret;
        bool force = false;
 
-       mutex_lock(&priv->mutex);
+       mutex_lock(&priv->shrd->mutex);
 
        if (unlikely(!iwl_is_ready(priv))) {
                IWL_DEBUG_MAC80211(priv, "leave - not ready\n");
-               mutex_unlock(&priv->mutex);
+               mutex_unlock(&priv->shrd->mutex);
                return;
         }
 
        if (unlikely(!ctx->vif)) {
                IWL_DEBUG_MAC80211(priv, "leave - vif is NULL\n");
-               mutex_unlock(&priv->mutex);
+               mutex_unlock(&priv->shrd->mutex);
                return;
        }
 
                        IWL_ERR(priv, "Error sending IBSS beacon\n");
        }
 
-       mutex_unlock(&priv->mutex);
+       mutex_unlock(&priv->shrd->mutex);
 }
 
 void iwlagn_post_scan(struct iwl_priv *priv)
 
                return NULL;
        }
 
-       lockdep_assert_held(&priv->mutex);
+       lockdep_assert_held(&priv->shrd->mutex);
 
        /* Set up the rate scaling to start at selected rate, fall back
         * all the way down to 1M in IEEE order, and then spin on 1M */
 int iwl_restore_default_wep_keys(struct iwl_priv *priv,
                                 struct iwl_rxon_context *ctx)
 {
-       lockdep_assert_held(&priv->mutex);
+       lockdep_assert_held(&priv->shrd->mutex);
 
        return iwl_send_static_wepkey_cmd(priv, ctx, false);
 }
 {
        int ret;
 
-       lockdep_assert_held(&priv->mutex);
+       lockdep_assert_held(&priv->shrd->mutex);
 
        IWL_DEBUG_WEP(priv, "Removing default WEP key: idx=%d\n",
                      keyconf->keyidx);
 {
        int ret;
 
-       lockdep_assert_held(&priv->mutex);
+       lockdep_assert_held(&priv->shrd->mutex);
 
        if (keyconf->keylen != WEP_KEY_LEN_128 &&
            keyconf->keylen != WEP_KEY_LEN_64) {
        if (sta_id == IWL_INVALID_STATION)
                return 0;
 
-       lockdep_assert_held(&priv->mutex);
+       lockdep_assert_held(&priv->shrd->mutex);
 
        ctx->key_mapping_keys--;
 
        if (sta_id == IWL_INVALID_STATION)
                return -EINVAL;
 
-       lockdep_assert_held(&priv->mutex);
+       lockdep_assert_held(&priv->shrd->mutex);
 
        keyconf->hw_key_idx = iwl_get_free_ucode_key_offset(priv);
        if (keyconf->hw_key_idx == WEP_INVALID_OFFSET)
        unsigned long flags;
        struct iwl_addsta_cmd sta_cmd;
 
-       lockdep_assert_held(&priv->mutex);
+       lockdep_assert_held(&priv->shrd->mutex);
 
        /* Remove "disable" flag, to enable Tx for this TID */
        spin_lock_irqsave(&priv->sta_lock, flags);
        int sta_id;
        struct iwl_addsta_cmd sta_cmd;
 
-       lockdep_assert_held(&priv->mutex);
+       lockdep_assert_held(&priv->shrd->mutex);
 
        sta_id = iwl_sta_id(sta);
        if (sta_id == IWL_INVALID_STATION)
        int sta_id;
        struct iwl_addsta_cmd sta_cmd;
 
-       lockdep_assert_held(&priv->mutex);
+       lockdep_assert_held(&priv->shrd->mutex);
 
        sta_id = iwl_sta_id(sta);
        if (sta_id == IWL_INVALID_STATION) {
 
                        tt->tt_power_mode = IWL_POWER_INDEX_5;
                        break;
                }
-               mutex_lock(&priv->mutex);
+               mutex_lock(&priv->shrd->mutex);
                if (old_state == IWL_TI_CT_KILL)
                        clear_bit(STATUS_CT_KILL, &priv->shrd->status);
                if (tt->state != IWL_TI_CT_KILL &&
                        IWL_DEBUG_TEMP(priv, "Power Index change to %u\n",
                                        tt->tt_power_mode);
                }
-               mutex_unlock(&priv->mutex);
+               mutex_unlock(&priv->shrd->mutex);
        }
 }
 
                         * in case get disabled before */
                        iwl_set_rxon_ht(priv, &priv->current_ht_config);
                }
-               mutex_lock(&priv->mutex);
+               mutex_lock(&priv->shrd->mutex);
                if (old_state == IWL_TI_CT_KILL)
                        clear_bit(STATUS_CT_KILL, &priv->shrd->status);
                if (tt->state != IWL_TI_CT_KILL &&
                                iwl_perform_ct_kill_task(priv, false);
                        }
                }
-               mutex_unlock(&priv->mutex);
+               mutex_unlock(&priv->shrd->mutex);
        }
 }
 
 
        struct iwl_notification_wait calib_wait;
        int ret;
 
-       lockdep_assert_held(&priv->mutex);
+       lockdep_assert_held(&priv->shrd->mutex);
 
        /* No init ucode required? Curious, but maybe ok */
        if (!priv->ucode_init.code.len)
 
         * beacon contents.
         */
 
-       lockdep_assert_held(&priv->mutex);
+       lockdep_assert_held(&priv->shrd->mutex);
 
        if (!priv->beacon_ctx) {
                IWL_ERR(priv, "trying to build beacon w/o beacon context!\n");
                container_of(work, struct iwl_priv, beacon_update);
        struct sk_buff *beacon;
 
-       mutex_lock(&priv->mutex);
+       mutex_lock(&priv->shrd->mutex);
        if (!priv->beacon_ctx) {
                IWL_ERR(priv, "updating beacon w/o beacon context!\n");
                goto out;
 
        iwlagn_send_beacon_cmd(priv);
  out:
-       mutex_unlock(&priv->mutex);
+       mutex_unlock(&priv->shrd->mutex);
 }
 
 static void iwl_bg_bt_runtime_config(struct work_struct *work)
                container_of(work, struct iwl_priv, bt_full_concurrency);
        struct iwl_rxon_context *ctx;
 
-       mutex_lock(&priv->mutex);
+       mutex_lock(&priv->shrd->mutex);
 
        if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
                goto out;
 
        iwlagn_send_advance_bt_config(priv);
 out:
-       mutex_unlock(&priv->mutex);
+       mutex_unlock(&priv->shrd->mutex);
 }
 
 /**
 
 static void iwl_down(struct iwl_priv *priv)
 {
-       mutex_lock(&priv->mutex);
+       mutex_lock(&priv->shrd->mutex);
        __iwl_down(priv);
-       mutex_unlock(&priv->mutex);
+       mutex_unlock(&priv->shrd->mutex);
 
        iwl_cancel_deferred_work(priv);
 }
        struct iwl_rxon_context *ctx;
        int ret;
 
-       lockdep_assert_held(&priv->mutex);
+       lockdep_assert_held(&priv->shrd->mutex);
 
        if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status)) {
                IWL_WARN(priv, "Exit pending; will not bring the NIC up\n");
        struct iwl_priv *priv = container_of(work, struct iwl_priv,
                        run_time_calib_work);
 
-       mutex_lock(&priv->mutex);
+       mutex_lock(&priv->shrd->mutex);
 
        if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status) ||
            test_bit(STATUS_SCANNING, &priv->shrd->status)) {
-               mutex_unlock(&priv->mutex);
+               mutex_unlock(&priv->shrd->mutex);
                return;
        }
 
                iwl_sensitivity_calibration(priv);
        }
 
-       mutex_unlock(&priv->mutex);
+       mutex_unlock(&priv->shrd->mutex);
 }
 
 static void iwlagn_prepare_restart(struct iwl_priv *priv)
        u8 bt_status;
        bool bt_is_sco;
 
-       lockdep_assert_held(&priv->mutex);
+       lockdep_assert_held(&priv->shrd->mutex);
 
        for_each_context(priv, ctx)
                ctx->vif = NULL;
                return;
 
        if (test_and_clear_bit(STATUS_FW_ERROR, &priv->shrd->status)) {
-               mutex_lock(&priv->mutex);
+               mutex_lock(&priv->shrd->mutex);
                iwlagn_prepare_restart(priv);
-               mutex_unlock(&priv->mutex);
+               mutex_unlock(&priv->shrd->mutex);
                iwl_cancel_deferred_work(priv);
                ieee80211_restart_hw(priv->hw);
        } else {
        IWL_DEBUG_MAC80211(priv, "enter\n");
 
        /* we should be verifying the device is ready to be opened */
-       mutex_lock(&priv->mutex);
+       mutex_lock(&priv->shrd->mutex);
        ret = __iwl_up(priv);
-       mutex_unlock(&priv->mutex);
+       mutex_unlock(&priv->shrd->mutex);
        if (ret)
                return ret;
 
        if (iwlagn_mod_params.sw_crypto)
                return;
 
-       mutex_lock(&priv->mutex);
+       mutex_lock(&priv->shrd->mutex);
 
        if (priv->contexts[IWL_RXON_CTX_BSS].vif != vif)
                goto out;
        priv->have_rekey_data = true;
 
  out:
-       mutex_unlock(&priv->mutex);
+       mutex_unlock(&priv->shrd->mutex);
 }
 
 struct wowlan_key_data {
        u16 p1k[IWLAGN_P1K_SIZE];
        int ret, i;
 
-       mutex_lock(&priv->mutex);
+       mutex_lock(&priv->shrd->mutex);
 
        if ((key->cipher == WLAN_CIPHER_SUITE_WEP40 ||
             key->cipher == WLAN_CIPHER_SUITE_WEP104) &&
                break;
        }
 
-       mutex_unlock(&priv->mutex);
+       mutex_unlock(&priv->shrd->mutex);
 }
 
 static int iwlagn_mac_suspend(struct ieee80211_hw *hw,
        if (WARN_ON(!wowlan))
                return -EINVAL;
 
-       mutex_lock(&priv->mutex);
+       mutex_lock(&priv->shrd->mutex);
 
        /* Don't attempt WoWLAN when not associated, tear down instead. */
        if (!ctx->vif || ctx->vif->type != NL80211_IFTYPE_STATION ||
                 * constraints. Since we're in the suspend path
                 * that isn't really a problem though.
                 */
-               mutex_unlock(&priv->mutex);
+               mutex_unlock(&priv->shrd->mutex);
                ieee80211_iter_keys(priv->hw, ctx->vif,
                                    iwlagn_wowlan_program_keys,
                                    &key_data);
-               mutex_lock(&priv->mutex);
+               mutex_lock(&priv->shrd->mutex);
                if (key_data.error) {
                        ret = -EIO;
                        goto error;
        iwlagn_prepare_restart(priv);
        ieee80211_restart_hw(priv->hw);
  out:
-       mutex_unlock(&priv->mutex);
+       mutex_unlock(&priv->shrd->mutex);
        kfree(key_data.rsc_tsc);
        return ret;
 }
        u32 base, status = 0xffffffff;
        int ret = -EIO;
 
-       mutex_lock(&priv->mutex);
+       mutex_lock(&priv->shrd->mutex);
 
        iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR,
                          CSR_UCODE_DRV_GP1_BIT_D3_CFG_COMPLETE);
        iwl_connection_init_rx_config(priv, ctx);
        iwlagn_set_rxon_chain(priv, ctx);
 
-       mutex_unlock(&priv->mutex);
+       mutex_unlock(&priv->shrd->mutex);
 
        ieee80211_resume_disconnect(vif);
 
        if (cmd == DISABLE_KEY && key->hw_key_idx == WEP_INVALID_OFFSET)
                return 0;
 
-       mutex_lock(&priv->mutex);
+       mutex_lock(&priv->shrd->mutex);
        iwl_scan_cancel_timeout(priv, 100);
 
        BUILD_BUG_ON(WEP_INVALID_OFFSET == IWLAGN_HW_KEY_DEFAULT);
                ret = -EINVAL;
        }
 
-       mutex_unlock(&priv->mutex);
+       mutex_unlock(&priv->shrd->mutex);
        IWL_DEBUG_MAC80211(priv, "leave\n");
 
        return ret;
        if (!(priv->cfg->sku & EEPROM_SKU_CAP_11N_ENABLE))
                return -EACCES;
 
-       mutex_lock(&priv->mutex);
+       mutex_lock(&priv->shrd->mutex);
 
        switch (action) {
        case IEEE80211_AMPDU_RX_START:
                ret = 0;
                break;
        }
-       mutex_unlock(&priv->mutex);
+       mutex_unlock(&priv->shrd->mutex);
 
        return ret;
 }
 
        IWL_DEBUG_INFO(priv, "received request to add station %pM\n",
                        sta->addr);
-       mutex_lock(&priv->mutex);
+       mutex_lock(&priv->shrd->mutex);
        IWL_DEBUG_INFO(priv, "proceeding to add station %pM\n",
                        sta->addr);
        sta_priv->common.sta_id = IWL_INVALID_STATION;
                IWL_ERR(priv, "Unable to add station %pM (%d)\n",
                        sta->addr, ret);
                /* Should we return success if return code is EEXIST ? */
-               mutex_unlock(&priv->mutex);
+               mutex_unlock(&priv->shrd->mutex);
                return ret;
        }
 
        IWL_DEBUG_INFO(priv, "Initializing rate scaling for station %pM\n",
                       sta->addr);
        iwl_rs_rate_init(priv, sta, sta_id);
-       mutex_unlock(&priv->mutex);
+       mutex_unlock(&priv->shrd->mutex);
 
        return 0;
 }
 
        IWL_DEBUG_MAC80211(priv, "enter\n");
 
-       mutex_lock(&priv->mutex);
+       mutex_lock(&priv->shrd->mutex);
 
        if (iwl_is_rfkill(priv))
                goto out;
        }
 
 out:
-       mutex_unlock(&priv->mutex);
+       mutex_unlock(&priv->shrd->mutex);
        IWL_DEBUG_MAC80211(priv, "leave\n");
 }
 
 
 #undef CHK
 
-       mutex_lock(&priv->mutex);
+       mutex_lock(&priv->shrd->mutex);
 
        for_each_context(priv, ctx) {
                ctx->staging.filter_flags &= ~filter_nand;
                 */
        }
 
-       mutex_unlock(&priv->mutex);
+       mutex_unlock(&priv->shrd->mutex);
 
        /*
         * Receiving all multicast frames is always enabled by the
 {
        struct iwl_priv *priv = hw->priv;
 
-       mutex_lock(&priv->mutex);
+       mutex_lock(&priv->shrd->mutex);
        IWL_DEBUG_MAC80211(priv, "enter\n");
 
        if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status)) {
        IWL_DEBUG_MAC80211(priv, "wait transmit/flush all frames\n");
        iwlagn_wait_tx_queue_empty(priv);
 done:
-       mutex_unlock(&priv->mutex);
+       mutex_unlock(&priv->shrd->mutex);
        IWL_DEBUG_MAC80211(priv, "leave\n");
 }
 
 {
        struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_PAN];
 
-       lockdep_assert_held(&priv->mutex);
+       lockdep_assert_held(&priv->shrd->mutex);
 
        if (!priv->hw_roc_setup)
                return;
        struct iwl_priv *priv = container_of(work, struct iwl_priv,
                                             hw_roc_disable_work.work);
 
-       mutex_lock(&priv->mutex);
+       mutex_lock(&priv->shrd->mutex);
        iwlagn_disable_roc(priv);
-       mutex_unlock(&priv->mutex);
+       mutex_unlock(&priv->shrd->mutex);
 }
 
 static int iwl_mac_remain_on_channel(struct ieee80211_hw *hw,
        if (!(ctx->interface_modes & BIT(NL80211_IFTYPE_P2P_CLIENT)))
                return -EOPNOTSUPP;
 
-       mutex_lock(&priv->mutex);
+       mutex_lock(&priv->shrd->mutex);
 
        /*
         * TODO: Remove this hack! Firmware needs to be updated
                iwlagn_disable_roc(priv);
 
  out:
-       mutex_unlock(&priv->mutex);
+       mutex_unlock(&priv->shrd->mutex);
 
        return err;
 }
        if (!(priv->valid_contexts & BIT(IWL_RXON_CTX_PAN)))
                return -EOPNOTSUPP;
 
-       mutex_lock(&priv->mutex);
+       mutex_lock(&priv->shrd->mutex);
        iwl_scan_cancel_timeout(priv, priv->hw_roc_duration);
        iwlagn_disable_roc(priv);
-       mutex_unlock(&priv->mutex);
+       mutex_unlock(&priv->shrd->mutex);
 
        return 0;
 }
        spin_lock_init(&priv->sta_lock);
        spin_lock_init(&priv->hcmd_lock);
 
-       mutex_init(&priv->mutex);
+       mutex_init(&priv->shrd->mutex);
 
        priv->ieee_channels = NULL;
        priv->ieee_rates = NULL;
 {
        struct iwl_priv *priv = hw->priv;
 
-       mutex_lock(&priv->mutex);
+       mutex_lock(&priv->shrd->mutex);
 
        if (priv->cfg->bt_params &&
                        priv->cfg->bt_params->advanced_bt_coexist) {
                                "ignoring RSSI callback\n");
        }
 
-       mutex_unlock(&priv->mutex);
+       mutex_unlock(&priv->shrd->mutex);
 }
 
 struct ieee80211_ops iwlagn_hw_ops = {
 
 
        conf = ieee80211_get_hw_conf(priv->hw);
 
-       lockdep_assert_held(&priv->mutex);
+       lockdep_assert_held(&priv->shrd->mutex);
 
        memset(&ctx->timing, 0, sizeof(struct iwl_rxon_time_cmd));
 
        bool defer;
        struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS];
 
-       lockdep_assert_held(&priv->mutex);
+       lockdep_assert_held(&priv->shrd->mutex);
 
        if (priv->tx_power_user_lmt == tx_power && !force)
                return 0;
        struct ieee80211_vif *vif = ctx->vif;
        int err;
 
-       lockdep_assert_held(&priv->mutex);
+       lockdep_assert_held(&priv->shrd->mutex);
 
        /*
         * This variable will be correct only when there's just
 
        cancel_delayed_work_sync(&priv->hw_roc_disable_work);
 
-       mutex_lock(&priv->mutex);
+       mutex_lock(&priv->shrd->mutex);
 
        iwlagn_disable_roc(priv);
 
        ctx->vif = NULL;
        priv->iw_mode = NL80211_IFTYPE_STATION;
  out:
-       mutex_unlock(&priv->mutex);
+       mutex_unlock(&priv->shrd->mutex);
 
        IWL_DEBUG_MAC80211(priv, "leave\n");
        return err;
 {
        struct iwl_rxon_context *ctx = iwl_rxon_ctx_from_vif(vif);
 
-       lockdep_assert_held(&priv->mutex);
+       lockdep_assert_held(&priv->shrd->mutex);
 
        if (priv->scan_vif == vif) {
                iwl_scan_cancel_timeout(priv, 200);
 
        IWL_DEBUG_MAC80211(priv, "enter\n");
 
-       mutex_lock(&priv->mutex);
+       mutex_lock(&priv->shrd->mutex);
 
        WARN_ON(ctx->vif != vif);
        ctx->vif = NULL;
 
        iwl_teardown_interface(priv, vif, false);
 
-       mutex_unlock(&priv->mutex);
+       mutex_unlock(&priv->shrd->mutex);
 
        IWL_DEBUG_MAC80211(priv, "leave\n");
 
 
        newtype = ieee80211_iftype_p2p(newtype, newp2p);
 
-       mutex_lock(&priv->mutex);
+       mutex_lock(&priv->shrd->mutex);
 
        if (!ctx->vif || !iwl_is_ready_rf(priv)) {
                /*
        err = 0;
 
  out:
-       mutex_unlock(&priv->mutex);
+       mutex_unlock(&priv->shrd->mutex);
        return err;
 }
 
 
 
        priv->power_data.debug_sleep_level_override = value;
 
-       mutex_lock(&priv->mutex);
+       mutex_lock(&priv->shrd->mutex);
        iwl_power_update_mode(priv, true);
-       mutex_unlock(&priv->mutex);
+       mutex_unlock(&priv->shrd->mutex);
 
        return count;
 }
                return -EINVAL;
 
        /* make request to uCode to retrieve statistics information */
-       mutex_lock(&priv->mutex);
+       mutex_lock(&priv->shrd->mutex);
        ret = iwl_send_statistics_request(priv, CMD_SYNC, false);
-       mutex_unlock(&priv->mutex);
+       mutex_unlock(&priv->shrd->mutex);
 
        if (ret) {
                IWL_ERR(priv,
                return -EFAULT;
 
        /* make request to uCode to retrieve statistics information */
-       mutex_lock(&priv->mutex);
+       mutex_lock(&priv->shrd->mutex);
        iwl_send_statistics_request(priv, CMD_SYNC, true);
-       mutex_unlock(&priv->mutex);
+       mutex_unlock(&priv->shrd->mutex);
 
        return count;
 }
 
        /* spinlock */
        spinlock_t hcmd_lock;   /* protect hcmd */
        spinlock_t reg_lock;    /* protect hw register access */
-       struct mutex mutex;
 
+       /*TODO: remove these pointers - use bus(priv) instead */
        struct iwl_bus *bus;    /* bus specific data */
        struct iwl_trans trans;
 
 
        int ret;
        bool update_chains;
 
-       lockdep_assert_held(&priv->mutex);
+       lockdep_assert_held(&priv->shrd->mutex);
 
        /* Don't update the RX chain when chain noise calibration is running */
        update_chains = priv->chain_noise_data.state == IWL_CHAIN_NOISE_DONE ||
 
 
 void iwl_force_scan_end(struct iwl_priv *priv)
 {
-       lockdep_assert_held(&priv->mutex);
+       lockdep_assert_held(&priv->shrd->mutex);
 
        if (!test_bit(STATUS_SCANNING, &priv->shrd->status)) {
                IWL_DEBUG_SCAN(priv, "Forcing scan end while not scanning\n");
 {
        int ret;
 
-       lockdep_assert_held(&priv->mutex);
+       lockdep_assert_held(&priv->shrd->mutex);
 
        if (!test_bit(STATUS_SCANNING, &priv->shrd->status)) {
                IWL_DEBUG_SCAN(priv, "Not performing scan to abort\n");
 {
        unsigned long timeout = jiffies + msecs_to_jiffies(ms);
 
-       lockdep_assert_held(&priv->mutex);
+       lockdep_assert_held(&priv->shrd->mutex);
 
        IWL_DEBUG_SCAN(priv, "Scan cancel timeout\n");
 
 {
        int ret;
 
-       lockdep_assert_held(&priv->mutex);
+       lockdep_assert_held(&priv->shrd->mutex);
 
        cancel_delayed_work(&priv->scan_check);
 
        if (req->n_channels == 0)
                return -EINVAL;
 
-       mutex_lock(&priv->mutex);
+       mutex_lock(&priv->shrd->mutex);
 
        if (test_bit(STATUS_SCANNING, &priv->shrd->status) &&
            priv->scan_type != IWL_SCAN_NORMAL) {
        IWL_DEBUG_MAC80211(priv, "leave\n");
 
 out_unlock:
-       mutex_unlock(&priv->mutex);
+       mutex_unlock(&priv->shrd->mutex);
 
        return ret;
 }
 
        IWL_DEBUG_SCAN(priv, "Start internal scan\n");
 
-       mutex_lock(&priv->mutex);
+       mutex_lock(&priv->shrd->mutex);
 
        if (priv->scan_type == IWL_SCAN_RADIO_RESET) {
                IWL_DEBUG_SCAN(priv, "Internal scan already in progress\n");
        if (iwl_scan_initiate(priv, NULL, IWL_SCAN_RADIO_RESET, priv->band))
                IWL_DEBUG_SCAN(priv, "failed to start internal short scan\n");
  unlock:
-       mutex_unlock(&priv->mutex);
+       mutex_unlock(&priv->shrd->mutex);
 }
 
 static void iwl_bg_scan_check(struct work_struct *data)
        /* Since we are here firmware does not finish scan and
         * most likely is in bad shape, so we don't bother to
         * send abort command, just force scan complete to mac80211 */
-       mutex_lock(&priv->mutex);
+       mutex_lock(&priv->shrd->mutex);
        iwl_force_scan_end(priv);
-       mutex_unlock(&priv->mutex);
+       mutex_unlock(&priv->shrd->mutex);
 }
 
 /**
 
        /* We keep scan_check work queued in case when firmware will not
         * report back scan completed notification */
-       mutex_lock(&priv->mutex);
+       mutex_lock(&priv->shrd->mutex);
        iwl_scan_cancel_timeout(priv, 200);
-       mutex_unlock(&priv->mutex);
+       mutex_unlock(&priv->shrd->mutex);
 }
 
 static void iwl_bg_scan_completed(struct work_struct *work)
 
        cancel_delayed_work(&priv->scan_check);
 
-       mutex_lock(&priv->mutex);
+       mutex_lock(&priv->shrd->mutex);
 
        aborted = test_and_clear_bit(STATUS_SCAN_ABORTING, &priv->shrd->status);
        if (aborted)
        iwlagn_post_scan(priv);
 
 out:
-       mutex_unlock(&priv->mutex);
+       mutex_unlock(&priv->shrd->mutex);
 }
 
 void iwl_setup_scan_deferred_work(struct iwl_priv *priv)
        cancel_work_sync(&priv->scan_completed);
 
        if (cancel_delayed_work_sync(&priv->scan_check)) {
-               mutex_lock(&priv->mutex);
+               mutex_lock(&priv->shrd->mutex);
                iwl_force_scan_end(priv);
-               mutex_unlock(&priv->mutex);
+               mutex_unlock(&priv->shrd->mutex);
        }
 }
 
  * @hw_params: see struct iwl_hw_params
  * @workqueue: the workqueue used by all the layers of the driver
  * @lock: protect general shared data
+ * @mutex:
  */
 struct iwl_shared {
 #ifdef CONFIG_IWLWIFI_DEBUG
 
        struct workqueue_struct *workqueue;
        spinlock_t lock;
+       struct mutex mutex;
 };
 
 /*Whatever _m is (iwl_trans, iwl_priv, iwl_bus, these macros will work */
 
 
        IWL_DEBUG_INFO(priv, "received request to remove station %pM\n",
                        sta->addr);
-       mutex_lock(&priv->mutex);
+       mutex_lock(&priv->shrd->mutex);
        IWL_DEBUG_INFO(priv, "proceeding to remove station %pM\n",
                        sta->addr);
        ret = iwl_remove_station(priv, sta_common->sta_id, sta->addr);
        if (ret)
                IWL_ERR(priv, "Error removing station %pM\n",
                        sta->addr);
-       mutex_unlock(&priv->mutex);
+       mutex_unlock(&priv->shrd->mutex);
        return ret;
 }
 
                return -ENOMSG;
        }
        /* in case multiple accesses to the device happens */
-       mutex_lock(&priv->mutex);
+       mutex_lock(&priv->shrd->mutex);
 
        switch (nla_get_u32(tb[IWL_TM_ATTR_COMMAND])) {
        case IWL_TM_CMD_APP2DEV_UCODE:
                break;
        }
 
-       mutex_unlock(&priv->mutex);
+       mutex_unlock(&priv->shrd->mutex);
        return result;
 }
 
        }
 
        /* in case multiple accesses to the device happens */
-       mutex_lock(&priv->mutex);
+       mutex_lock(&priv->shrd->mutex);
        switch (cmd) {
        case IWL_TM_CMD_APP2DEV_READ_TRACE:
                IWL_DEBUG_INFO(priv, "uCode trace cmd to driver\n");
                break;
        }
 
-       mutex_unlock(&priv->mutex);
+       mutex_unlock(&priv->shrd->mutex);
        return result;
 }
 
        if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
                return;
 
-       mutex_lock(&priv->mutex);
+       mutex_lock(&priv->shrd->mutex);
        iwlagn_rx_replenish(priv);
-       mutex_unlock(&priv->mutex);
+       mutex_unlock(&priv->shrd->mutex);
 }
 
 /**
 
        int cmd_idx;
        int ret;
 
-       lockdep_assert_held(&priv->mutex);
+       lockdep_assert_held(&priv->shrd->mutex);
 
         /* A synchronous command can not have a callback set. */
        if (WARN_ON(cmd->callback))