Skip to content

Commit

Permalink
iwlwifi: move calib_results list from iwl_priv to iwl_trans
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Don Fry authored and Wey-Yi Guy committed Dec 8, 2011
1 parent ae6130f commit 45c30db
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 33 deletions.
18 changes: 9 additions & 9 deletions drivers/net/wireless/iwlwifi/iwl-agn-calib.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,23 +82,23 @@ 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,
.flags = CMD_SYNC,
};
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;
}
Expand All @@ -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;
Expand All @@ -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);
Expand All @@ -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);
}
Expand Down
5 changes: 0 additions & 5 deletions drivers/net/wireless/iwlwifi/iwl-agn-calib.h
Original file line number Diff line number Diff line change
Expand Up @@ -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__ */
3 changes: 1 addition & 2 deletions drivers/net/wireless/iwlwifi/iwl-agn.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -1635,7 +1635,6 @@ static int iwl_init_drv(struct iwl_priv *priv)

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)
Expand Down
12 changes: 0 additions & 12 deletions drivers/net/wireless/iwlwifi/iwl-dev.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 */
Expand Down
1 change: 1 addition & 0 deletions drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
18 changes: 18 additions & 0 deletions drivers/net/wireless/iwlwifi/iwl-trans.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
Expand All @@ -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 *))));
Expand Down Expand Up @@ -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__ */
10 changes: 5 additions & 5 deletions drivers/net/wireless/iwlwifi/iwl-ucode.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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));
}


Expand Down

0 comments on commit 45c30db

Please sign in to comment.