iwlwifi: move workqueue to priv
authorJohannes Berg <johannes.berg@intel.com>
Fri, 17 Feb 2012 18:07:44 +0000 (10:07 -0800)
committerWey-Yi Guy <wey-yi.w.guy@intel.com>
Fri, 17 Feb 2012 18:10:28 +0000 (10:10 -0800)
In order to separate the different parts of the
driver better, we are reducing the shared data.
This moves the workqueue to "priv", and removes
it from the transport. To do this, simply use
schedule_work() in the transport.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
13 files changed:
drivers/net/wireless/iwlwifi/iwl-agn-lib.c
drivers/net/wireless/iwlwifi/iwl-agn-rs.c
drivers/net/wireless/iwlwifi/iwl-agn-rx.c
drivers/net/wireless/iwlwifi/iwl-agn-tt.c
drivers/net/wireless/iwlwifi/iwl-agn-tx.c
drivers/net/wireless/iwlwifi/iwl-agn.c
drivers/net/wireless/iwlwifi/iwl-core.c
drivers/net/wireless/iwlwifi/iwl-dev.h
drivers/net/wireless/iwlwifi/iwl-mac80211.c
drivers/net/wireless/iwlwifi/iwl-scan.c
drivers/net/wireless/iwlwifi/iwl-shared.h
drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c
drivers/net/wireless/iwlwifi/iwl-trans-pcie.c

index a8f7689aaacfb91049941c736ff46660c4830313..30b99b9abf7ffe523a9bbb5191887a436da4ff73 100644 (file)
@@ -700,7 +700,7 @@ static void iwlagn_set_kill_msk(struct iwl_priv *priv,
                priv->kill_cts_mask = bt_kill_cts_msg[kill_msk];
 
                /* schedule to send runtime bt_config */
-               queue_work(priv->shrd->workqueue, &priv->bt_runtime_config);
+               queue_work(priv->workqueue, &priv->bt_runtime_config);
        }
 }
 
@@ -745,7 +745,7 @@ int iwlagn_bt_coex_profile_notif(struct iwl_priv *priv,
                                        IWL_BT_COEX_TRAFFIC_LOAD_NONE;
                        }
                        priv->bt_status = coex->bt_status;
-                       queue_work(priv->shrd->workqueue,
+                       queue_work(priv->workqueue,
                                   &priv->bt_traffic_change_work);
                }
        }
index b9ba404d15c1cdd25271175e20848247571aa1de..f88e2e33e2e874a5c6617914d4d793d5791ae207 100644 (file)
@@ -892,7 +892,7 @@ static void rs_bt_update_lq(struct iwl_priv *priv, struct iwl_rxon_context *ctx,
                rs_fill_link_cmd(priv, lq_sta, tbl->current_rate);
                iwl_send_lq_cmd(priv, ctx, &lq_sta->lq, CMD_ASYNC, false);
 
-               queue_work(priv->shrd->workqueue, &priv->bt_full_concurrency);
+               queue_work(priv->workqueue, &priv->bt_full_concurrency);
        }
 }
 
index a14ddab783ea6985907c3693cc131d77bcf60b51..aee7d060d317ab8ea557ffbc1a0ba271cd277240 100644 (file)
@@ -581,7 +581,7 @@ static int iwlagn_rx_statistics(struct iwl_priv *priv,
        if (unlikely(!test_bit(STATUS_SCANNING, &priv->shrd->status)) &&
            (pkt->hdr.cmd == STATISTICS_NOTIFICATION)) {
                iwlagn_rx_calc_noise(priv);
-               queue_work(priv->shrd->workqueue, &priv->run_time_calib_work);
+               queue_work(priv->workqueue, &priv->run_time_calib_work);
        }
        if (cfg(priv)->lib->temperature && change)
                cfg(priv)->lib->temperature(priv);
index c728ed75584e0dad2eecfedb40bf1cb9a8bfd2c6..56d7c0e38163eeb4240f60f43ebe28dd54bf4768 100644 (file)
@@ -568,7 +568,7 @@ void iwl_tt_enter_ct_kill(struct iwl_priv *priv)
                return;
 
        IWL_DEBUG_TEMP(priv, "Queueing critical temperature enter.\n");
-       queue_work(priv->shrd->workqueue, &priv->ct_enter);
+       queue_work(priv->workqueue, &priv->ct_enter);
 }
 
 void iwl_tt_exit_ct_kill(struct iwl_priv *priv)
@@ -577,7 +577,7 @@ void iwl_tt_exit_ct_kill(struct iwl_priv *priv)
                return;
 
        IWL_DEBUG_TEMP(priv, "Queueing critical temperature exit.\n");
-       queue_work(priv->shrd->workqueue, &priv->ct_exit);
+       queue_work(priv->workqueue, &priv->ct_exit);
 }
 
 static void iwl_bg_tt_work(struct work_struct *work)
@@ -600,7 +600,7 @@ void iwl_tt_handler(struct iwl_priv *priv)
                return;
 
        IWL_DEBUG_TEMP(priv, "Queueing thermal throttling work.\n");
-       queue_work(priv->shrd->workqueue, &priv->tt_work);
+       queue_work(priv->workqueue, &priv->tt_work);
 }
 
 /* Thermal throttling initialization
index 64f8db685dc50fbdf72a5927331fc93d344a9f10..da18a8fc9af71516abd2a839062a5620489892d0 100644 (file)
@@ -983,7 +983,7 @@ static void iwl_check_abort_status(struct iwl_priv *priv,
        if (frame_count == 1 && status == TX_STATUS_FAIL_RFKILL_FLUSH) {
                IWL_ERR(priv, "Tx flush command to flush out all frames\n");
                if (!test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
-                       queue_work(priv->shrd->workqueue, &priv->tx_flush);
+                       queue_work(priv->workqueue, &priv->tx_flush);
        }
 }
 
index 8837171ad55301af44eb72873beed8b5536b20f5..1cf99a586ec9626324758d9402258943139e88dd 100644 (file)
@@ -939,7 +939,7 @@ static void iwlagn_disable_roc_work(struct work_struct *work)
 
 static void iwl_setup_deferred_work(struct iwl_priv *priv)
 {
-       priv->shrd->workqueue = create_singlethread_workqueue(DRV_NAME);
+       priv->workqueue = create_singlethread_workqueue(DRV_NAME);
 
        init_waitqueue_head(&priv->shrd->wait_command_queue);
 
@@ -1282,8 +1282,8 @@ int iwl_probe(struct iwl_bus *bus, const struct iwl_trans_ops *trans_ops,
        return 0;
 
 out_destroy_workqueue:
-       destroy_workqueue(priv->shrd->workqueue);
-       priv->shrd->workqueue = NULL;
+       destroy_workqueue(priv->workqueue);
+       priv->workqueue = NULL;
        iwl_uninit_drv(priv);
 out_free_eeprom:
        iwl_eeprom_free(priv->shrd);
@@ -1321,13 +1321,13 @@ void __devexit iwl_remove(struct iwl_priv * priv)
        iwl_eeprom_free(priv->shrd);
 
        /*netif_stop_queue(dev); */
-       flush_workqueue(priv->shrd->workqueue);
+       flush_workqueue(priv->workqueue);
 
        /* ieee80211_unregister_hw calls iwlagn_mac_stop, which flushes
-        * priv->shrd->workqueue... so we can't take down the workqueue
+        * priv->workqueue... so we can't take down the workqueue
         * until now... */
-       destroy_workqueue(priv->shrd->workqueue);
-       priv->shrd->workqueue = NULL;
+       destroy_workqueue(priv->workqueue);
+       priv->workqueue = NULL;
        iwl_free_traffic_mem(priv);
 
        iwl_uninit_drv(priv);
index 0677b3dfbfb2de98b351db54666f37841d4daeb1..6dff9c41c5551f9599fc204b40f0ff1be16edb47 100644 (file)
@@ -875,7 +875,7 @@ void iwlagn_fw_error(struct iwl_priv *priv, bool ondemand)
                if (iwlagn_mod_params.restart_fw) {
                        IWL_DEBUG_FW_ERRORS(priv,
                                  "Restarting adapter due to uCode error.\n");
-                       queue_work(priv->shrd->workqueue, &priv->restart);
+                       queue_work(priv->workqueue, &priv->restart);
                } else
                        IWL_DEBUG_FW_ERRORS(priv,
                                  "Detected FW error, but not restarting\n");
index 0e8f13705dbed475bf8ec5892a06dd52d699b156..db37877eed7737a73ce46d0076ce7fc1e59570e9 100644 (file)
@@ -721,6 +721,8 @@ struct iwl_priv {
        struct ieee80211_rate *ieee_rates;
        struct kmem_cache *tx_cmd_pool;
 
+       struct workqueue_struct *workqueue;
+
        enum ieee80211_band band;
 
        void (*pre_rx_handler)(struct iwl_priv *priv,
index d8025fee7e0d56e7d8bf3ce434d2fd9991b3de66..17358cfb68a900475f499405264eff443f617ba3 100644 (file)
@@ -343,7 +343,7 @@ static void iwlagn_mac_stop(struct ieee80211_hw *hw)
 
        iwl_down(priv);
 
-       flush_workqueue(priv->shrd->workqueue);
+       flush_workqueue(priv->workqueue);
 
        /* User space software may expect getting rfkill changes
         * even if interface is down, trans->down will leave the RF
@@ -1117,7 +1117,7 @@ static int iwlagn_mac_set_tim(struct ieee80211_hw *hw,
 {
        struct iwl_priv *priv = hw->priv;
 
-       queue_work(priv->shrd->workqueue, &priv->beacon_update);
+       queue_work(priv->workqueue, &priv->beacon_update);
 
        return 0;
 }
index 7f2e3a1c80efeaea0ae6b7828cd05f6866c19173..42ee1c410efd7cbfc621749c89b72b333ded4a29 100644 (file)
@@ -218,7 +218,7 @@ static void iwl_do_scan_abort(struct iwl_priv *priv)
 int iwl_scan_cancel(struct iwl_priv *priv)
 {
        IWL_DEBUG_SCAN(priv, "Queuing abort scan\n");
-       queue_work(priv->shrd->workqueue, &priv->abort_scan);
+       queue_work(priv->workqueue, &priv->abort_scan);
        return 0;
 }
 
@@ -354,7 +354,7 @@ static int iwl_rx_scan_complete_notif(struct iwl_priv *priv,
         */
        set_bit(STATUS_SCAN_COMPLETE, &priv->shrd->status);
        clear_bit(STATUS_SCAN_HW, &priv->shrd->status);
-       queue_work(priv->shrd->workqueue, &priv->scan_completed);
+       queue_work(priv->workqueue, &priv->scan_completed);
 
        if (priv->iw_mode != NL80211_IFTYPE_ADHOC &&
            iwl_advanced_bt_coexist(priv) &&
@@ -374,7 +374,7 @@ static int iwl_rx_scan_complete_notif(struct iwl_priv *priv,
                                IWL_BT_COEX_TRAFFIC_LOAD_NONE;
                }
                priv->bt_status = scan_notif->bt_status;
-               queue_work(priv->shrd->workqueue,
+               queue_work(priv->workqueue,
                           &priv->bt_traffic_change_work);
        }
        return 0;
@@ -950,7 +950,7 @@ int __must_check iwl_scan_initiate(struct iwl_priv *priv,
                return ret;
        }
 
-       queue_delayed_work(priv->shrd->workqueue, &priv->scan_check,
+       queue_delayed_work(priv->workqueue, &priv->scan_check,
                           IWL_SCAN_CHECK_WATCHDOG);
 
        return 0;
@@ -963,7 +963,7 @@ int __must_check iwl_scan_initiate(struct iwl_priv *priv,
  */
 void iwl_internal_short_hw_scan(struct iwl_priv *priv)
 {
-       queue_work(priv->shrd->workqueue, &priv->start_internal_scan);
+       queue_work(priv->workqueue, &priv->start_internal_scan);
 }
 
 static void iwl_bg_start_internal_scan(struct work_struct *work)
index 63d4a4fc5b9e38586389a6ead2eae59f50730e66..42bf43b9c4064ef3714cd7972e8df20a2c2a5b6d 100644 (file)
@@ -359,7 +359,6 @@ struct iwl_cfg {
  * @priv: pointer to the upper layer data
  * @trans: pointer to the transport layer data
  * @hw_params: see struct iwl_hw_params
- * @workqueue: the workqueue used by all the layers of the driver
  * @lock: protect general shared data
  * @sta_lock: protects the station table.
  *     If lock and sta_lock are needed, lock must be acquired first.
@@ -391,7 +390,6 @@ struct iwl_shared {
        struct iwl_trans *trans;
        struct iwl_hw_params hw_params;
 
-       struct workqueue_struct *workqueue;
        spinlock_t lock;
        spinlock_t sta_lock;
        struct mutex mutex;
index 3826852ec5f07e0f2d10712aa556bb806c6fe63a..1b11cfec5da6fe253200547673c35c08f6518225 100644 (file)
@@ -227,7 +227,7 @@ static void iwlagn_rx_queue_restock(struct iwl_trans *trans)
        /* If the pre-allocated buffer pool is dropping low, schedule to
         * refill it */
        if (rxq->free_count <= RX_LOW_WATERMARK)
-               queue_work(trans->shrd->workqueue, &trans_pcie->rx_replenish);
+               schedule_work(&trans_pcie->rx_replenish);
 
 
        /* If we've added more space for the firmware to place data, tell it.
@@ -351,14 +351,8 @@ void iwl_bg_rx_replenish(struct work_struct *data)
 {
        struct iwl_trans_pcie *trans_pcie =
            container_of(data, struct iwl_trans_pcie, rx_replenish);
-       struct iwl_trans *trans = trans_pcie->trans;
 
-       if (test_bit(STATUS_EXIT_PENDING, &trans->shrd->status))
-               return;
-
-       mutex_lock(&trans->shrd->mutex);
-       iwlagn_rx_replenish(trans);
-       mutex_unlock(&trans->shrd->mutex);
+       iwlagn_rx_replenish(trans_pcie->trans);
 }
 
 /**
index f5cb5d3cd92641826cb12c33248184e56c8c1b16..e8d1dbfa1aeae114ba4c42583abe5a12863a0bd1 100644 (file)
@@ -1293,6 +1293,8 @@ static void iwl_trans_pcie_stop_device(struct iwl_trans *trans)
        synchronize_irq(trans->irq);
        tasklet_kill(&trans_pcie->irq_tasklet);
 
+       cancel_work_sync(&trans_pcie->rx_replenish);
+
        /* stop and reset the on-board processor */
        iwl_write32(trans, CSR_RESET, CSR_RESET_REG_FLAG_NEVO_RESET);
 }