iwlwifi: move wait_command_queue from shared to trans
authorMeenakshi Venkataraman <meenakshi.venkataraman@intel.com>
Sat, 10 Mar 2012 21:00:09 +0000 (13:00 -0800)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 12 Mar 2012 18:22:00 +0000 (14:22 -0400)
This wait queue really belongs to the transport
layer, as it is used for sending synchronous
commands to the HW.

However, only op_mode knows about errors and
exceptional conditions, so make this queue
accessible by the op_mode.

Signed-off-by: Meenakshi Venkataraman <meenakshi.venkataraman@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/iwlwifi/iwl-agn-rx.c
drivers/net/wireless/iwlwifi/iwl-agn.c
drivers/net/wireless/iwlwifi/iwl-core.c
drivers/net/wireless/iwlwifi/iwl-shared.h
drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c
drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c
drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
drivers/net/wireless/iwlwifi/iwl-trans.h

index cc0227c1f3525bb9cf45b9088c777741c4f7b933..44c6f712b77d5f9b5a39359ff7e5e17c86e7b9ab 100644 (file)
@@ -671,7 +671,7 @@ static int iwlagn_rx_card_state_notif(struct iwl_priv *priv,
                wiphy_rfkill_set_hw_state(priv->hw->wiphy,
                        test_bit(STATUS_RF_KILL_HW, &priv->status));
        else
-               wake_up(&priv->shrd->wait_command_queue);
+               wake_up(&trans(priv)->wait_command_queue);
        return 0;
 }
 
index 5ef15855be2f8876f80711bd79a634d48bf3ac30..66d7446ff07b3ba269cf73ec52c4a1a6ad08663a 100644 (file)
@@ -962,8 +962,6 @@ static void iwl_setup_deferred_work(struct iwl_priv *priv)
 {
        priv->workqueue = create_singlethread_workqueue(DRV_NAME);
 
-       init_waitqueue_head(&priv->shrd->wait_command_queue);
-
        INIT_WORK(&priv->restart, iwl_bg_restart);
        INIT_WORK(&priv->beacon_update, iwl_bg_beacon_update);
        INIT_WORK(&priv->run_time_calib_work, iwl_bg_run_time_calib_work);
index 8b85940731f22992e51bca762727e5b5855e8420..e3eda50a5a67309526ba1769204664ffc8fb3a6a 100644 (file)
@@ -850,7 +850,7 @@ static void iwlagn_fw_error(struct iwl_priv *priv, bool ondemand)
         * commands by clearing the ready bit */
        clear_bit(STATUS_READY, &priv->status);
 
-       wake_up(&priv->shrd->wait_command_queue);
+       wake_up(&trans(priv)->wait_command_queue);
 
        if (!ondemand) {
                /*
index cf34087aa2fe8445a714b3a916fb5dfb3dc59c1b..29d2a85232fc79adefd4a7b4a53a35c3979c9dcc 100644 (file)
@@ -376,7 +376,6 @@ struct iwl_cfg {
  * @nic: pointer to the nic data
  * @hw_params: see struct iwl_hw_params
  * @lock: protect general shared data
- * @wait_command_queue: the wait_queue for SYNC host commands
  * @eeprom: pointer to the eeprom/OTP image
  * @ucode_type: indicator of loaded ucode image
  * @device_pointers: pointers to ucode event tables
@@ -391,8 +390,6 @@ struct iwl_shared {
        struct iwl_hw_params hw_params;
        const struct iwl_fw *fw;
 
-       wait_queue_head_t wait_command_queue;
-
        /* eeprom -- this is in the card's little endian byte order */
        u8 *eeprom;
 
index 8bec0e1ccb5466884467c437d8a0e51e9bd8fc3e..8b1a7988e176ee715f611035b9756c066bfbbd57 100644 (file)
@@ -684,7 +684,7 @@ static void iwl_irq_handle_error(struct iwl_trans *trans)
                 */
                clear_bit(STATUS_READY, &trans->shrd->status);
                clear_bit(STATUS_HCMD_ACTIVE, &trans->shrd->status);
-               wake_up(&trans->shrd->wait_command_queue);
+               wake_up(&trans->wait_command_queue);
                IWL_ERR(trans, "RF is used by WiMAX\n");
                return;
        }
index 565c664f6dce2d58610847ca82a3dc227a3bae98..a66ad9b590a4e2eeac1e43d53935407e0731f3cf 100644 (file)
@@ -928,7 +928,7 @@ void iwl_tx_cmd_complete(struct iwl_trans *trans, struct iwl_rx_cmd_buffer *rxb,
                clear_bit(STATUS_HCMD_ACTIVE, &trans->shrd->status);
                IWL_DEBUG_INFO(trans, "Clearing HCMD_ACTIVE for command %s\n",
                               get_cmd_string(cmd->hdr.cmd));
-               wake_up(&trans->shrd->wait_command_queue);
+               wake_up(&trans->wait_command_queue);
        }
 
        meta->flags = 0;
@@ -992,7 +992,7 @@ static int iwl_send_cmd_sync(struct iwl_trans *trans, struct iwl_host_cmd *cmd)
                return ret;
        }
 
-       ret = wait_event_timeout(trans->shrd->wait_command_queue,
+       ret = wait_event_timeout(trans->wait_command_queue,
                        !test_bit(STATUS_HCMD_ACTIVE, &trans->shrd->status),
                        HOST_COMPLETE_TIMEOUT);
        if (!ret) {
index 4900dfa59df71728f929702c55b05a50fa8726a1..0e8e31a53c7ac4438eddd75134b1ebd291252ed4 100644 (file)
@@ -2327,6 +2327,9 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct iwl_shared *shrd,
                pci_write_config_word(pdev, PCI_COMMAND, pci_cmd);
        }
 
+       /* Initialize the wait queue for commands */
+       init_waitqueue_head(&trans->wait_command_queue);
+
        return trans;
 
 out_pci_release_regions:
index 782cb0ddc962623bfdb450454c6c21a27d6cfb77..0c81cbaa80888dfbf13d00010c19675f3202bd50 100644 (file)
@@ -413,6 +413,7 @@ enum iwl_trans_state {
  * @hw_id_str: a string with info about HW ID. Set during transport allocation.
  * @nvm_device_type: indicates OTP or eeprom
  * @pm_support: set to true in start_hw if link pm is supported
+ * @wait_command_queue: the wait_queue for SYNC host commands
  */
 struct iwl_trans {
        const struct iwl_trans_ops *ops;
@@ -429,6 +430,8 @@ struct iwl_trans {
        int    nvm_device_type;
        bool pm_support;
 
+       wait_queue_head_t wait_command_queue;
+
        /* pointer to trans specific struct */
        /*Ensure that this pointer will always be aligned to sizeof pointer */
        char trans_specific[0] __aligned(sizeof(void *));