aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi
diff options
context:
space:
mode:
authorStanislaw Gruszka <sgruszka@redhat.com>2010-02-10 08:07:45 -0500
committerReinette Chatre <reinette.chatre@intel.com>2010-02-11 13:27:18 -0500
commitf36d04abe684f9e2b07c6ebe9f77ae20eb5c1e84 (patch)
tree80c559f22c2806c0627d4f49c6081d3a4888327b /drivers/net/wireless/iwlwifi
parent6c3872e1d52290dcd506473028867cacc6b7393d (diff)
iwlwifi: use dma_alloc_coherent
Change pci_alloc_consistent() to dma_alloc_coherent() so we can use GFP_KERNEL flag. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945.c8
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.c12
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-helpers.h7
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-rx.c21
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-tx.c23
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c16
6 files changed, 44 insertions, 43 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c
index 57194bbd2762..5913418872ec 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.c
@@ -2470,11 +2470,9 @@ int iwl3945_hw_set_hw_params(struct iwl_priv *priv)
2470 memset((void *)&priv->hw_params, 0, 2470 memset((void *)&priv->hw_params, 0,
2471 sizeof(struct iwl_hw_params)); 2471 sizeof(struct iwl_hw_params));
2472 2472
2473 priv->shared_virt = 2473 priv->shared_virt = dma_alloc_coherent(&priv->pci_dev->dev,
2474 pci_alloc_consistent(priv->pci_dev, 2474 sizeof(struct iwl3945_shared),
2475 sizeof(struct iwl3945_shared), 2475 &priv->shared_phys, GFP_KERNEL);
2476 &priv->shared_phys);
2477
2478 if (!priv->shared_virt) { 2476 if (!priv->shared_virt) {
2479 IWL_ERR(priv, "failed to allocate pci memory\n"); 2477 IWL_ERR(priv, "failed to allocate pci memory\n");
2480 mutex_unlock(&priv->mutex); 2478 mutex_unlock(&priv->mutex);
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
index 500ced452098..bd56827b8fef 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.c
+++ b/drivers/net/wireless/iwlwifi/iwl-core.c
@@ -1670,9 +1670,9 @@ EXPORT_SYMBOL(iwl_set_tx_power);
1670void iwl_free_isr_ict(struct iwl_priv *priv) 1670void iwl_free_isr_ict(struct iwl_priv *priv)
1671{ 1671{
1672 if (priv->ict_tbl_vir) { 1672 if (priv->ict_tbl_vir) {
1673 pci_free_consistent(priv->pci_dev, (sizeof(u32) * ICT_COUNT) + 1673 dma_free_coherent(&priv->pci_dev->dev,
1674 PAGE_SIZE, priv->ict_tbl_vir, 1674 (sizeof(u32) * ICT_COUNT) + PAGE_SIZE,
1675 priv->ict_tbl_dma); 1675 priv->ict_tbl_vir, priv->ict_tbl_dma);
1676 priv->ict_tbl_vir = NULL; 1676 priv->ict_tbl_vir = NULL;
1677 } 1677 }
1678} 1678}
@@ -1688,9 +1688,9 @@ int iwl_alloc_isr_ict(struct iwl_priv *priv)
1688 if (priv->cfg->use_isr_legacy) 1688 if (priv->cfg->use_isr_legacy)
1689 return 0; 1689 return 0;
1690 /* allocate shrared data table */ 1690 /* allocate shrared data table */
1691 priv->ict_tbl_vir = pci_alloc_consistent(priv->pci_dev, (sizeof(u32) * 1691 priv->ict_tbl_vir = dma_alloc_coherent(&priv->pci_dev->dev,
1692 ICT_COUNT) + PAGE_SIZE, 1692 (sizeof(u32) * ICT_COUNT) + PAGE_SIZE,
1693 &priv->ict_tbl_dma); 1693 &priv->ict_tbl_dma, GFP_KERNEL);
1694 if (!priv->ict_tbl_vir) 1694 if (!priv->ict_tbl_vir)
1695 return -ENOMEM; 1695 return -ENOMEM;
1696 1696
diff --git a/drivers/net/wireless/iwlwifi/iwl-helpers.h b/drivers/net/wireless/iwlwifi/iwl-helpers.h
index 45af5bbc1c56..51a67fb2e185 100644
--- a/drivers/net/wireless/iwlwifi/iwl-helpers.h
+++ b/drivers/net/wireless/iwlwifi/iwl-helpers.h
@@ -80,8 +80,8 @@ static inline void iwl_free_fw_desc(struct pci_dev *pci_dev,
80 struct fw_desc *desc) 80 struct fw_desc *desc)
81{ 81{
82 if (desc->v_addr) 82 if (desc->v_addr)
83 pci_free_consistent(pci_dev, desc->len, 83 dma_free_coherent(&pci_dev->dev, desc->len,
84 desc->v_addr, desc->p_addr); 84 desc->v_addr, desc->p_addr);
85 desc->v_addr = NULL; 85 desc->v_addr = NULL;
86 desc->len = 0; 86 desc->len = 0;
87} 87}
@@ -89,7 +89,8 @@ static inline void iwl_free_fw_desc(struct pci_dev *pci_dev,
89static inline int iwl_alloc_fw_desc(struct pci_dev *pci_dev, 89static inline int iwl_alloc_fw_desc(struct pci_dev *pci_dev,
90 struct fw_desc *desc) 90 struct fw_desc *desc)
91{ 91{
92 desc->v_addr = pci_alloc_consistent(pci_dev, desc->len, &desc->p_addr); 92 desc->v_addr = dma_alloc_coherent(&pci_dev->dev, desc->len,
93 &desc->p_addr, GFP_KERNEL);
93 return (desc->v_addr != NULL) ? 0 : -ENOMEM; 94 return (desc->v_addr != NULL) ? 0 : -ENOMEM;
94} 95}
95 96
diff --git a/drivers/net/wireless/iwlwifi/iwl-rx.c b/drivers/net/wireless/iwlwifi/iwl-rx.c
index 428c9d689d4c..aba8f4c20c1b 100644
--- a/drivers/net/wireless/iwlwifi/iwl-rx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-rx.c
@@ -345,10 +345,10 @@ void iwl_rx_queue_free(struct iwl_priv *priv, struct iwl_rx_queue *rxq)
345 } 345 }
346 } 346 }
347 347
348 pci_free_consistent(priv->pci_dev, 4 * RX_QUEUE_SIZE, rxq->bd, 348 dma_free_coherent(&priv->pci_dev->dev, 4 * RX_QUEUE_SIZE, rxq->bd,
349 rxq->dma_addr); 349 rxq->dma_addr);
350 pci_free_consistent(priv->pci_dev, sizeof(struct iwl_rb_status), 350 dma_free_coherent(&priv->pci_dev->dev, sizeof(struct iwl_rb_status),
351 rxq->rb_stts, rxq->rb_stts_dma); 351 rxq->rb_stts, rxq->rb_stts_dma);
352 rxq->bd = NULL; 352 rxq->bd = NULL;
353 rxq->rb_stts = NULL; 353 rxq->rb_stts = NULL;
354} 354}
@@ -357,7 +357,7 @@ EXPORT_SYMBOL(iwl_rx_queue_free);
357int iwl_rx_queue_alloc(struct iwl_priv *priv) 357int iwl_rx_queue_alloc(struct iwl_priv *priv)
358{ 358{
359 struct iwl_rx_queue *rxq = &priv->rxq; 359 struct iwl_rx_queue *rxq = &priv->rxq;
360 struct pci_dev *dev = priv->pci_dev; 360 struct device *dev = &priv->pci_dev->dev;
361 int i; 361 int i;
362 362
363 spin_lock_init(&rxq->lock); 363 spin_lock_init(&rxq->lock);
@@ -365,12 +365,13 @@ int iwl_rx_queue_alloc(struct iwl_priv *priv)
365 INIT_LIST_HEAD(&rxq->rx_used); 365 INIT_LIST_HEAD(&rxq->rx_used);
366 366
367 /* Alloc the circular buffer of Read Buffer Descriptors (RBDs) */ 367 /* Alloc the circular buffer of Read Buffer Descriptors (RBDs) */
368 rxq->bd = pci_alloc_consistent(dev, 4 * RX_QUEUE_SIZE, &rxq->dma_addr); 368 rxq->bd = dma_alloc_coherent(dev, 4 * RX_QUEUE_SIZE, &rxq->dma_addr,
369 GFP_KERNEL);
369 if (!rxq->bd) 370 if (!rxq->bd)
370 goto err_bd; 371 goto err_bd;
371 372
372 rxq->rb_stts = pci_alloc_consistent(dev, sizeof(struct iwl_rb_status), 373 rxq->rb_stts = dma_alloc_coherent(dev, sizeof(struct iwl_rb_status),
373 &rxq->rb_stts_dma); 374 &rxq->rb_stts_dma, GFP_KERNEL);
374 if (!rxq->rb_stts) 375 if (!rxq->rb_stts)
375 goto err_rb; 376 goto err_rb;
376 377
@@ -387,8 +388,8 @@ int iwl_rx_queue_alloc(struct iwl_priv *priv)
387 return 0; 388 return 0;
388 389
389err_rb: 390err_rb:
390 pci_free_consistent(priv->pci_dev, 4 * RX_QUEUE_SIZE, rxq->bd, 391 dma_free_coherent(&priv->pci_dev->dev, 4 * RX_QUEUE_SIZE, rxq->bd,
391 rxq->dma_addr); 392 rxq->dma_addr);
392err_bd: 393err_bd:
393 return -ENOMEM; 394 return -ENOMEM;
394} 395}
diff --git a/drivers/net/wireless/iwlwifi/iwl-tx.c b/drivers/net/wireless/iwlwifi/iwl-tx.c
index 2199b1bc1c28..d8c11f955e42 100644
--- a/drivers/net/wireless/iwlwifi/iwl-tx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-tx.c
@@ -60,7 +60,8 @@ static const u16 default_tid_to_tx_fifo[] = {
60static inline int iwl_alloc_dma_ptr(struct iwl_priv *priv, 60static inline int iwl_alloc_dma_ptr(struct iwl_priv *priv,
61 struct iwl_dma_ptr *ptr, size_t size) 61 struct iwl_dma_ptr *ptr, size_t size)
62{ 62{
63 ptr->addr = pci_alloc_consistent(priv->pci_dev, size, &ptr->dma); 63 ptr->addr = dma_alloc_coherent(&priv->pci_dev->dev, size, &ptr->dma,
64 GFP_KERNEL);
64 if (!ptr->addr) 65 if (!ptr->addr)
65 return -ENOMEM; 66 return -ENOMEM;
66 ptr->size = size; 67 ptr->size = size;
@@ -73,7 +74,7 @@ static inline void iwl_free_dma_ptr(struct iwl_priv *priv,
73 if (unlikely(!ptr->addr)) 74 if (unlikely(!ptr->addr))
74 return; 75 return;
75 76
76 pci_free_consistent(priv->pci_dev, ptr->size, ptr->addr, ptr->dma); 77 dma_free_coherent(&priv->pci_dev->dev, ptr->size, ptr->addr, ptr->dma);
77 memset(ptr, 0, sizeof(*ptr)); 78 memset(ptr, 0, sizeof(*ptr));
78} 79}
79 80
@@ -129,7 +130,7 @@ void iwl_tx_queue_free(struct iwl_priv *priv, int txq_id)
129{ 130{
130 struct iwl_tx_queue *txq = &priv->txq[txq_id]; 131 struct iwl_tx_queue *txq = &priv->txq[txq_id];
131 struct iwl_queue *q = &txq->q; 132 struct iwl_queue *q = &txq->q;
132 struct pci_dev *dev = priv->pci_dev; 133 struct device *dev = &priv->pci_dev->dev;
133 int i; 134 int i;
134 135
135 if (q->n_bd == 0) 136 if (q->n_bd == 0)
@@ -146,8 +147,8 @@ void iwl_tx_queue_free(struct iwl_priv *priv, int txq_id)
146 147
147 /* De-alloc circular buffer of TFDs */ 148 /* De-alloc circular buffer of TFDs */
148 if (txq->q.n_bd) 149 if (txq->q.n_bd)
149 pci_free_consistent(dev, priv->hw_params.tfd_size * 150 dma_free_coherent(dev, priv->hw_params.tfd_size *
150 txq->q.n_bd, txq->tfds, txq->q.dma_addr); 151 txq->q.n_bd, txq->tfds, txq->q.dma_addr);
151 152
152 /* De-alloc array of per-TFD driver data */ 153 /* De-alloc array of per-TFD driver data */
153 kfree(txq->txb); 154 kfree(txq->txb);
@@ -176,7 +177,7 @@ void iwl_cmd_queue_free(struct iwl_priv *priv)
176{ 177{
177 struct iwl_tx_queue *txq = &priv->txq[IWL_CMD_QUEUE_NUM]; 178 struct iwl_tx_queue *txq = &priv->txq[IWL_CMD_QUEUE_NUM];
178 struct iwl_queue *q = &txq->q; 179 struct iwl_queue *q = &txq->q;
179 struct pci_dev *dev = priv->pci_dev; 180 struct device *dev = &priv->pci_dev->dev;
180 int i; 181 int i;
181 182
182 if (q->n_bd == 0) 183 if (q->n_bd == 0)
@@ -188,8 +189,8 @@ void iwl_cmd_queue_free(struct iwl_priv *priv)
188 189
189 /* De-alloc circular buffer of TFDs */ 190 /* De-alloc circular buffer of TFDs */
190 if (txq->q.n_bd) 191 if (txq->q.n_bd)
191 pci_free_consistent(dev, priv->hw_params.tfd_size * 192 dma_free_coherent(dev, priv->hw_params.tfd_size * txq->q.n_bd,
192 txq->q.n_bd, txq->tfds, txq->q.dma_addr); 193 txq->tfds, txq->q.dma_addr);
193 194
194 /* deallocate arrays */ 195 /* deallocate arrays */
195 kfree(txq->cmd); 196 kfree(txq->cmd);
@@ -280,7 +281,7 @@ static int iwl_queue_init(struct iwl_priv *priv, struct iwl_queue *q,
280static int iwl_tx_queue_alloc(struct iwl_priv *priv, 281static int iwl_tx_queue_alloc(struct iwl_priv *priv,
281 struct iwl_tx_queue *txq, u32 id) 282 struct iwl_tx_queue *txq, u32 id)
282{ 283{
283 struct pci_dev *dev = priv->pci_dev; 284 struct device *dev = &priv->pci_dev->dev;
284 size_t tfd_sz = priv->hw_params.tfd_size * TFD_QUEUE_SIZE_MAX; 285 size_t tfd_sz = priv->hw_params.tfd_size * TFD_QUEUE_SIZE_MAX;
285 286
286 /* Driver private data, only for Tx (not command) queues, 287 /* Driver private data, only for Tx (not command) queues,
@@ -299,8 +300,8 @@ static int iwl_tx_queue_alloc(struct iwl_priv *priv,
299 300
300 /* Circular buffer of transmit frame descriptors (TFDs), 301 /* Circular buffer of transmit frame descriptors (TFDs),
301 * shared with device */ 302 * shared with device */
302 txq->tfds = pci_alloc_consistent(dev, tfd_sz, &txq->q.dma_addr); 303 txq->tfds = dma_alloc_coherent(dev, tfd_sz, &txq->q.dma_addr,
303 304 GFP_KERNEL);
304 if (!txq->tfds) { 305 if (!txq->tfds) {
305 IWL_ERR(priv, "pci_alloc_consistent(%zd) failed\n", tfd_sz); 306 IWL_ERR(priv, "pci_alloc_consistent(%zd) failed\n", tfd_sz);
306 goto error; 307 goto error;
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 7af8ab80dcf1..3df488a8cf75 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -352,10 +352,10 @@ static int iwl3945_send_beacon_cmd(struct iwl_priv *priv)
352static void iwl3945_unset_hw_params(struct iwl_priv *priv) 352static void iwl3945_unset_hw_params(struct iwl_priv *priv)
353{ 353{
354 if (priv->shared_virt) 354 if (priv->shared_virt)
355 pci_free_consistent(priv->pci_dev, 355 dma_free_coherent(&priv->pci_dev->dev,
356 sizeof(struct iwl3945_shared), 356 sizeof(struct iwl3945_shared),
357 priv->shared_virt, 357 priv->shared_virt,
358 priv->shared_phys); 358 priv->shared_phys);
359} 359}
360 360
361static void iwl3945_build_tx_cmd_hwcrypto(struct iwl_priv *priv, 361static void iwl3945_build_tx_cmd_hwcrypto(struct iwl_priv *priv,
@@ -1241,10 +1241,10 @@ static void iwl3945_rx_queue_free(struct iwl_priv *priv, struct iwl_rx_queue *rx
1241 } 1241 }
1242 } 1242 }
1243 1243
1244 pci_free_consistent(priv->pci_dev, 4 * RX_QUEUE_SIZE, rxq->bd, 1244 dma_free_coherent(&priv->pci_dev->dev, 4 * RX_QUEUE_SIZE, rxq->bd,
1245 rxq->dma_addr); 1245 rxq->dma_addr);
1246 pci_free_consistent(priv->pci_dev, sizeof(struct iwl_rb_status), 1246 dma_free_coherent(&priv->pci_dev->dev, sizeof(struct iwl_rb_status),
1247 rxq->rb_stts, rxq->rb_stts_dma); 1247 rxq->rb_stts, rxq->rb_stts_dma);
1248 rxq->bd = NULL; 1248 rxq->bd = NULL;
1249 rxq->rb_stts = NULL; 1249 rxq->rb_stts = NULL;
1250} 1250}