iwlwifi: move calib_results list from iwl_priv to iwl_trans
authorDon Fry <donald.h.fry@intel.com>
Thu, 1 Dec 2011 00:58:39 +0000 (16:58 -0800)
committerWey-Yi Guy <wey-yi.w.guy@intel.com>
Thu, 8 Dec 2011 23:55:24 +0000 (15:55 -0800)
Move the calib_results list from the upper layer iwl_priv structure
to the lower layer iwl_trans structure.

Signed-off-by: Don Fry <donald.h.fry@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
drivers/net/wireless/iwlwifi/iwl-agn-calib.c
drivers/net/wireless/iwlwifi/iwl-agn-calib.h
drivers/net/wireless/iwlwifi/iwl-agn.c
drivers/net/wireless/iwlwifi/iwl-dev.h
drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
drivers/net/wireless/iwlwifi/iwl-trans.h
drivers/net/wireless/iwlwifi/iwl-ucode.c

index 4d0210594956fae5200767d37663d77112eb55f0..16971a020297dab59e8efc8c99a052bd65ee384c 100644 (file)
@@ -82,7 +82,7 @@ struct statistics_general_data {
        u32 beacon_energy_c;
 };
 
-int iwl_send_calib_results(struct iwl_priv *priv)
+int iwl_send_calib_results(struct iwl_trans *trans)
 {
        struct iwl_host_cmd hcmd = {
                .id = REPLY_PHY_CALIBRATION_CMD,
@@ -90,15 +90,15 @@ int iwl_send_calib_results(struct iwl_priv *priv)
        };
        struct iwl_calib_result *res;
 
-       list_for_each_entry(res, &priv->calib_results, list) {
+       list_for_each_entry(res, &trans->calib_results, list) {
                int ret;
 
                hcmd.len[0] = res->cmd_len;
                hcmd.data[0] = &res->hdr;
                hcmd.dataflags[0] = IWL_HCMD_DFL_NOCOPY;
-               ret = iwl_trans_send_cmd(trans(priv), &hcmd);
+               ret = iwl_trans_send_cmd(trans, &hcmd);
                if (ret) {
-                       IWL_ERR(priv, "Error %d on calib cmd %d\n",
+                       IWL_ERR(trans, "Error %d on calib cmd %d\n",
                                ret, res->hdr.op_code);
                        return ret;
                }
@@ -107,7 +107,7 @@ int iwl_send_calib_results(struct iwl_priv *priv)
        return 0;
 }
 
-int iwl_calib_set(struct iwl_priv *priv,
+int iwl_calib_set(struct iwl_trans *trans,
                  const struct iwl_calib_hdr *cmd, int len)
 {
        struct iwl_calib_result *res, *tmp;
@@ -119,7 +119,7 @@ int iwl_calib_set(struct iwl_priv *priv,
        memcpy(&res->hdr, cmd, len);
        res->cmd_len = len;
 
-       list_for_each_entry(tmp, &priv->calib_results, list) {
+       list_for_each_entry(tmp, &trans->calib_results, list) {
                if (tmp->hdr.op_code == res->hdr.op_code) {
                        list_replace(&tmp->list, &res->list);
                        kfree(tmp);
@@ -128,16 +128,16 @@ int iwl_calib_set(struct iwl_priv *priv,
        }
 
        /* wasn't in list already */
-       list_add_tail(&res->list, &priv->calib_results);
+       list_add_tail(&res->list, &trans->calib_results);
 
        return 0;
 }
 
-void iwl_calib_free_results(struct iwl_priv *priv)
+void iwl_calib_free_results(struct iwl_trans *trans)
 {
        struct iwl_calib_result *res, *tmp;
 
-       list_for_each_entry_safe(res, tmp, &priv->calib_results, list) {
+       list_for_each_entry_safe(res, tmp, &trans->calib_results, list) {
                list_del(&res->list);
                kfree(res);
        }
index 6ed806c8f80f2fb9cdf8ede9acb4c8e22bc79c5f..10275ce92bde8875f9807245cf32a0ec00addae6 100644 (file)
@@ -72,9 +72,4 @@ void iwl_sensitivity_calibration(struct iwl_priv *priv);
 void iwl_init_sensitivity(struct iwl_priv *priv);
 void iwl_reset_run_time_calib(struct iwl_priv *priv);
 
-int iwl_send_calib_results(struct iwl_priv *priv);
-int iwl_calib_set(struct iwl_priv *priv,
-                 const struct iwl_calib_hdr *cmd, int len);
-void iwl_calib_free_results(struct iwl_priv *priv);
-
 #endif /* __iwl_calib_h__ */
index 02927faa61783a259d415db542c118e410ae1207..f5fe42dbb3b0639001fb081fd2852515bc29ebc1 100644 (file)
@@ -1577,7 +1577,7 @@ static int iwl_init_drv(struct iwl_priv *priv)
 
        mutex_init(&priv->shrd->mutex);
 
-       INIT_LIST_HEAD(&priv->calib_results);
+       INIT_LIST_HEAD(&trans(priv)->calib_results);
 
        priv->ieee_channels = NULL;
        priv->ieee_rates = NULL;
@@ -1635,7 +1635,6 @@ err:
 
 static void iwl_uninit_drv(struct iwl_priv *priv)
 {
-       iwl_calib_free_results(priv);
        iwl_free_geos(priv);
        iwl_free_channel_map(priv);
        if (priv->tx_cmd_pool)
index aa225be8dee893b38950c21c47cb04a36b1dde11..69ecf6e2e658ae1c0e777d4b5f36faf185c8148b 100644 (file)
@@ -440,15 +440,6 @@ enum iwlagn_chain_noise_state {
        IWL_CHAIN_NOISE_DONE,
 };
 
-
-/* Opaque calibration results */
-struct iwl_calib_result {
-       struct list_head list;
-       size_t cmd_len;
-       struct iwl_calib_hdr hdr;
-       /* data follows */
-};
-
 /* Sensitivity calib data */
 struct iwl_sensitivity_data {
        u32 auto_corr_ofdm;
@@ -830,9 +821,6 @@ struct iwl_priv {
        s32 temperature;        /* Celsius */
        s32 last_temperature;
 
-       /* init calibration results */
-       struct list_head calib_results;
-
        struct iwl_wipan_noa_data __rcu *noa_data;
 
        /* Scan related variables */
index 304b2ea0375c26d91d18d64f280560c877bf1089..66e1b9fa0b8b9bfa2079a1b70817413e1aab41f4 100644 (file)
@@ -1373,6 +1373,7 @@ static void iwl_trans_pcie_reclaim(struct iwl_trans *trans, int sta_id, int tid,
 
 static void iwl_trans_pcie_free(struct iwl_trans *trans)
 {
+       iwl_calib_free_results(trans);
        iwl_trans_pcie_tx_free(trans);
        iwl_trans_pcie_rx_free(trans);
        free_irq(bus(trans)->irq, trans);
index 4a29b8ab998ecc5a2d78582961b08b48522f9d4a..f94a6ee5f82f6693d866bab58d606652eae87112 100644 (file)
@@ -220,6 +220,14 @@ struct fw_img {
        struct fw_desc data;    /* firmware data image */
 };
 
+/* Opaque calibration results */
+struct iwl_calib_result {
+       struct list_head list;
+       size_t cmd_len;
+       struct iwl_calib_hdr hdr;
+       /* data follows */
+};
+
 /**
  * struct iwl_trans - transport common data
  * @ops - pointer to iwl_trans_ops
@@ -229,6 +237,8 @@ struct fw_img {
  * @ucode_rt: run time ucode image
  * @ucode_init: init ucode image
  * @ucode_wowlan: wake on wireless ucode image (optional)
+ * @nvm_device_type: indicates OTP or eeprom
+ * @calib_results: list head for init calibration results
  */
 struct iwl_trans {
        const struct iwl_trans_ops *ops;
@@ -243,6 +253,9 @@ struct iwl_trans {
        /* eeprom related variables */
        int    nvm_device_type;
 
+       /* init calibration results */
+       struct list_head calib_results;
+
        /* pointer to trans specific struct */
        /*Ensure that this pointer will always be aligned to sizeof pointer */
        char trans_specific[0] __attribute__((__aligned__(sizeof(void *))));
@@ -379,4 +392,9 @@ int iwl_alloc_fw_desc(struct iwl_bus *bus, struct fw_desc *desc,
                      const void *data, size_t len);
 void iwl_dealloc_ucode(struct iwl_trans *trans);
 
+int iwl_send_calib_results(struct iwl_trans *trans);
+int iwl_calib_set(struct iwl_trans *trans,
+                 const struct iwl_calib_hdr *cmd, int len);
+void iwl_calib_free_results(struct iwl_trans *trans);
+
 #endif /* __iwl_trans_h__ */
index 256f647763aa16464a52c3d853c7ba58b427e54b..0577212ad3f35cc90ea89ec30be44c1f174b8889 100644 (file)
@@ -222,7 +222,7 @@ static int iwl_set_Xtal_calib(struct iwl_priv *priv)
        iwl_set_calib_hdr(&cmd.hdr, IWL_PHY_CALIBRATE_CRYSTAL_FRQ_CMD);
        cmd.cap_pin1 = le16_to_cpu(xtal_calib[0]);
        cmd.cap_pin2 = le16_to_cpu(xtal_calib[1]);
-       return iwl_calib_set(priv, (void *)&cmd, sizeof(cmd));
+       return iwl_calib_set(trans(priv), (void *)&cmd, sizeof(cmd));
 }
 
 static int iwl_set_temperature_offset_calib(struct iwl_priv *priv)
@@ -240,7 +240,7 @@ static int iwl_set_temperature_offset_calib(struct iwl_priv *priv)
 
        IWL_DEBUG_CALIB(priv, "Radio sensor offset: %d\n",
                        le16_to_cpu(cmd.radio_sensor_offset));
-       return iwl_calib_set(priv, (void *)&cmd, sizeof(cmd));
+       return iwl_calib_set(trans(priv), (void *)&cmd, sizeof(cmd));
 }
 
 static int iwl_set_temperature_offset_calib_v2(struct iwl_priv *priv)
@@ -276,7 +276,7 @@ static int iwl_set_temperature_offset_calib_v2(struct iwl_priv *priv)
        IWL_DEBUG_CALIB(priv, "Voltage Ref: %d\n",
                        le16_to_cpu(cmd.burntVoltageRef));
 
-       return iwl_calib_set(priv, (void *)&cmd, sizeof(cmd));
+       return iwl_calib_set(trans(priv), (void *)&cmd, sizeof(cmd));
 }
 
 static int iwl_send_calib_cfg(struct iwl_trans *trans)
@@ -309,7 +309,7 @@ int iwlagn_rx_calib_result(struct iwl_priv *priv,
        /* reduce the size of the length field itself */
        len -= 4;
 
-       if (iwl_calib_set(priv, hdr, len))
+       if (iwl_calib_set(trans(priv), hdr, len))
                IWL_ERR(priv, "Failed to record calibration data %d\n",
                        hdr->op_code);
 
@@ -459,7 +459,7 @@ static int iwl_alive_notify(struct iwl_priv *priv)
                        return ret;
        }
 
-       return iwl_send_calib_results(priv);
+       return iwl_send_calib_results(trans(priv));
 }