aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-trans.c
diff options
context:
space:
mode:
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>2011-08-26 02:11:19 -0400
committerJohn W. Linville <linville@tuxdriver.com>2011-08-29 15:30:31 -0400
commitfd656935cd05f522d7db97386633f6a0d7751218 (patch)
treec4633b2033c45e85f759789602116c84757f0dd5 /drivers/net/wireless/iwlwifi/iwl-trans.c
parent5f85a7890cbfd2be8f4c6620b2a6774d6b5ac647 (diff)
iwlagn: remove dereferences of priv from transport
There are still quite a few, but much less. A few fields have been moved /copied to hw_params which sits in the shared area: * priv->cfg->base_params->num_of_ampdu_queues * priv->cfg->base_params->shadow_reg_enable * priv->cfg->sku * priv->ucode_owner 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>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-trans.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-trans.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans.c b/drivers/net/wireless/iwlwifi/iwl-trans.c
index a18ed425c24..ac401b805c6 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans.c
+++ b/drivers/net/wireless/iwlwifi/iwl-trans.c
@@ -138,13 +138,12 @@ static void iwl_trans_rxq_free_rx_bufs(struct iwl_trans *trans)
138 } 138 }
139} 139}
140 140
141static void iwl_trans_rx_hw_init(struct iwl_priv *priv, 141static void iwl_trans_rx_hw_init(struct iwl_trans *trans,
142 struct iwl_rx_queue *rxq) 142 struct iwl_rx_queue *rxq)
143{ 143{
144 u32 rb_size; 144 u32 rb_size;
145 const u32 rfdnlog = RX_QUEUE_SIZE_LOG; /* 256 RBDs */ 145 const u32 rfdnlog = RX_QUEUE_SIZE_LOG; /* 256 RBDs */
146 u32 rb_timeout = 0; /* FIXME: RX_RB_TIMEOUT for all devices? */ 146 u32 rb_timeout = 0; /* FIXME: RX_RB_TIMEOUT for all devices? */
147 struct iwl_trans *trans = trans(priv);
148 147
149 rb_timeout = RX_RB_TIMEOUT; 148 rb_timeout = RX_RB_TIMEOUT;
150 149
@@ -221,7 +220,7 @@ static int iwl_rx_init(struct iwl_trans *trans)
221 220
222 iwlagn_rx_replenish(trans); 221 iwlagn_rx_replenish(trans);
223 222
224 iwl_trans_rx_hw_init(priv(trans), rxq); 223 iwl_trans_rx_hw_init(trans, rxq);
225 224
226 spin_lock_irqsave(&trans->shrd->lock, flags); 225 spin_lock_irqsave(&trans->shrd->lock, flags);
227 rxq->need_update = 1; 226 rxq->need_update = 1;
@@ -509,7 +508,7 @@ static int iwl_trans_tx_alloc(struct iwl_trans *trans)
509 struct iwl_trans_pcie *trans_pcie = 508 struct iwl_trans_pcie *trans_pcie =
510 IWL_TRANS_GET_PCIE_TRANS(trans); 509 IWL_TRANS_GET_PCIE_TRANS(trans);
511 510
512 u16 scd_bc_tbls_size = priv->cfg->base_params->num_of_queues * 511 u16 scd_bc_tbls_size = hw_params(trans).max_txq_num *
513 sizeof(struct iwlagn_scd_bc_tbl); 512 sizeof(struct iwlagn_scd_bc_tbl);
514 513
515 /*It is not allowed to alloc twice, so warn when this happens. 514 /*It is not allowed to alloc twice, so warn when this happens.
@@ -534,7 +533,7 @@ static int iwl_trans_tx_alloc(struct iwl_trans *trans)
534 } 533 }
535 534
536 priv->txq = kzalloc(sizeof(struct iwl_tx_queue) * 535 priv->txq = kzalloc(sizeof(struct iwl_tx_queue) *
537 priv->cfg->base_params->num_of_queues, GFP_KERNEL); 536 hw_params(trans).max_txq_num, GFP_KERNEL);
538 if (!priv->txq) { 537 if (!priv->txq) {
539 IWL_ERR(trans, "Not enough memory for txq\n"); 538 IWL_ERR(trans, "Not enough memory for txq\n");
540 ret = ENOMEM; 539 ret = ENOMEM;
@@ -652,7 +651,7 @@ static int iwl_nic_init(struct iwl_trans *trans)
652 if (iwl_tx_init(trans)) 651 if (iwl_tx_init(trans))
653 return -ENOMEM; 652 return -ENOMEM;
654 653
655 if (priv->cfg->base_params->shadow_reg_enable) { 654 if (hw_params(trans).shadow_reg_enable) {
656 /* enable shadow regs in HW */ 655 /* enable shadow regs in HW */
657 iwl_set_bit(bus(trans), CSR_MAC_SHADOW_REG_CTRL, 656 iwl_set_bit(bus(trans), CSR_MAC_SHADOW_REG_CTRL,
658 0x800FFFFF); 657 0x800FFFFF);
@@ -717,9 +716,9 @@ static int iwl_trans_pcie_start_device(struct iwl_trans *trans)
717 int ret; 716 int ret;
718 struct iwl_priv *priv = priv(trans); 717 struct iwl_priv *priv = priv(trans);
719 718
720 priv->ucode_owner = IWL_OWNERSHIP_DRIVER; 719 priv->shrd->ucode_owner = IWL_OWNERSHIP_DRIVER;
721 720
722 if ((priv->cfg->sku & EEPROM_SKU_CAP_AMT_ENABLE) && 721 if ((hw_params(priv).sku & EEPROM_SKU_CAP_AMT_ENABLE) &&
723 iwl_trans_pcie_prepare_card_hw(trans)) { 722 iwl_trans_pcie_prepare_card_hw(trans)) {
724 IWL_WARN(trans, "Exit HW not ready\n"); 723 IWL_WARN(trans, "Exit HW not ready\n");
725 return -EIO; 724 return -EIO;
@@ -1131,7 +1130,7 @@ static int iwl_trans_pcie_tx(struct iwl_priv *priv, struct sk_buff *skb,
1131 1130
1132 /* Tell device the write index *just past* this latest filled TFD */ 1131 /* Tell device the write index *just past* this latest filled TFD */
1133 q->write_ptr = iwl_queue_inc_wrap(q->write_ptr, q->n_bd); 1132 q->write_ptr = iwl_queue_inc_wrap(q->write_ptr, q->n_bd);
1134 iwl_txq_update_write_ptr(priv, txq); 1133 iwl_txq_update_write_ptr(trans(priv), txq);
1135 1134
1136 /* 1135 /*
1137 * At this point the frame is "transmitted" successfully 1136 * At this point the frame is "transmitted" successfully
@@ -1142,7 +1141,7 @@ static int iwl_trans_pcie_tx(struct iwl_priv *priv, struct sk_buff *skb,
1142 if (iwl_queue_space(q) < q->high_mark) { 1141 if (iwl_queue_space(q) < q->high_mark) {
1143 if (wait_write_ptr) { 1142 if (wait_write_ptr) {
1144 txq->need_update = 1; 1143 txq->need_update = 1;
1145 iwl_txq_update_write_ptr(priv, txq); 1144 iwl_txq_update_write_ptr(trans(priv), txq);
1146 } else { 1145 } else {
1147 iwl_stop_queue(priv, txq); 1146 iwl_stop_queue(priv, txq);
1148 } 1147 }
@@ -1366,7 +1365,7 @@ static ssize_t iwl_dbgfs_traffic_log_read(struct file *file,
1366 struct iwl_rx_queue *rxq = &trans_pcie->rxq; 1365 struct iwl_rx_queue *rxq = &trans_pcie->rxq;
1367 char *buf; 1366 char *buf;
1368 int bufsz = ((IWL_TRAFFIC_ENTRIES * IWL_TRAFFIC_ENTRY_SIZE * 64) * 2) + 1367 int bufsz = ((IWL_TRAFFIC_ENTRIES * IWL_TRAFFIC_ENTRY_SIZE * 64) * 2) +
1369 (priv->cfg->base_params->num_of_queues * 32 * 8) + 400; 1368 (hw_params(trans).max_txq_num * 32 * 8) + 400;
1370 const u8 *ptr; 1369 const u8 *ptr;
1371 ssize_t ret; 1370 ssize_t ret;
1372 1371
@@ -1468,8 +1467,7 @@ static ssize_t iwl_dbgfs_tx_queue_read(struct file *file,
1468 int pos = 0; 1467 int pos = 0;
1469 int cnt; 1468 int cnt;
1470 int ret; 1469 int ret;
1471 const size_t bufsz = sizeof(char) * 64 * 1470 const size_t bufsz = sizeof(char) * 64 * hw_params(trans).max_txq_num;
1472 priv->cfg->base_params->num_of_queues;
1473 1471
1474 if (!priv->txq) { 1472 if (!priv->txq) {
1475 IWL_ERR(priv, "txq not ready\n"); 1473 IWL_ERR(priv, "txq not ready\n");