aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorStanislaw Gruszka <sgruszka@redhat.com>2010-02-10 08:07:45 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2010-04-01 19:01:22 -0400
commit095a7d07b8e852ba8bbcd1f3f6c056819fed5d29 (patch)
tree48e69a638a1db1702c60c55823999ab6a40ed13b /drivers/net
parentee644b71926ee1a1fc44320b67fbcdc214441a00 (diff)
iwlwifi: use dma_alloc_coherent
commit f36d04abe684f9e2b07c6ebe9f77ae20eb5c1e84 upstream. 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> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/net')
-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 234891d8cc10..e9555154d6fc 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.c
@@ -2474,11 +2474,9 @@ int iwl3945_hw_set_hw_params(struct iwl_priv *priv)
2474 memset((void *)&priv->hw_params, 0, 2474 memset((void *)&priv->hw_params, 0,
2475 sizeof(struct iwl_hw_params)); 2475 sizeof(struct iwl_hw_params));
2476 2476
2477 priv->shared_virt = 2477 priv->shared_virt = dma_alloc_coherent(&priv->pci_dev->dev,
2478 pci_alloc_consistent(priv->pci_dev, 2478 sizeof(struct iwl3945_shared),
2479 sizeof(struct iwl3945_shared), 2479 &priv->shared_phys, GFP_KERNEL);
2480 &priv->shared_phys);
2481
2482 if (!priv->shared_virt) { 2480 if (!priv->shared_virt) {
2483 IWL_ERR(priv, "failed to allocate pci memory\n"); 2481 IWL_ERR(priv, "failed to allocate pci memory\n");
2484 mutex_unlock(&priv->mutex); 2482 mutex_unlock(&priv->mutex);
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
index f36f804804fc..6e9e15655a82 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.c
+++ b/drivers/net/wireless/iwlwifi/iwl-core.c
@@ -1658,9 +1658,9 @@ EXPORT_SYMBOL(iwl_set_tx_power);
1658void iwl_free_isr_ict(struct iwl_priv *priv) 1658void iwl_free_isr_ict(struct iwl_priv *priv)
1659{ 1659{
1660 if (priv->ict_tbl_vir) { 1660 if (priv->ict_tbl_vir) {
1661 pci_free_consistent(priv->pci_dev, (sizeof(u32) * ICT_COUNT) + 1661 dma_free_coherent(&priv->pci_dev->dev,
1662 PAGE_SIZE, priv->ict_tbl_vir, 1662 (sizeof(u32) * ICT_COUNT) + PAGE_SIZE,
1663 priv->ict_tbl_dma); 1663 priv->ict_tbl_vir, priv->ict_tbl_dma);
1664 priv->ict_tbl_vir = NULL; 1664 priv->ict_tbl_vir = NULL;
1665 } 1665 }
1666} 1666}
@@ -1676,9 +1676,9 @@ int iwl_alloc_isr_ict(struct iwl_priv *priv)
1676 if (priv->cfg->use_isr_legacy) 1676 if (priv->cfg->use_isr_legacy)
1677 return 0; 1677 return 0;
1678 /* allocate shrared data table */ 1678 /* allocate shrared data table */
1679 priv->ict_tbl_vir = pci_alloc_consistent(priv->pci_dev, (sizeof(u32) * 1679 priv->ict_tbl_vir = dma_alloc_coherent(&priv->pci_dev->dev,
1680 ICT_COUNT) + PAGE_SIZE, 1680 (sizeof(u32) * ICT_COUNT) + PAGE_SIZE,
1681 &priv->ict_tbl_dma); 1681 &priv->ict_tbl_dma, GFP_KERNEL);
1682 if (!priv->ict_tbl_vir) 1682 if (!priv->ict_tbl_vir)
1683 return -ENOMEM; 1683 return -ENOMEM;
1684 1684
diff --git a/drivers/net/wireless/iwlwifi/iwl-helpers.h b/drivers/net/wireless/iwlwifi/iwl-helpers.h
index bd0b12efb5c7..f8481e8bf04a 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 2dbce85404aa..4ac16d91f773 100644
--- a/drivers/net/wireless/iwlwifi/iwl-rx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-rx.c
@@ -350,10 +350,10 @@ void iwl_rx_queue_free(struct iwl_priv *priv, struct iwl_rx_queue *rxq)
350 } 350 }
351 } 351 }
352 352
353 pci_free_consistent(priv->pci_dev, 4 * RX_QUEUE_SIZE, rxq->bd, 353 dma_free_coherent(&priv->pci_dev->dev, 4 * RX_QUEUE_SIZE, rxq->bd,
354 rxq->dma_addr); 354 rxq->dma_addr);
355 pci_free_consistent(priv->pci_dev, sizeof(struct iwl_rb_status), 355 dma_free_coherent(&priv->pci_dev->dev, sizeof(struct iwl_rb_status),
356 rxq->rb_stts, rxq->rb_stts_dma); 356 rxq->rb_stts, rxq->rb_stts_dma);
357 rxq->bd = NULL; 357 rxq->bd = NULL;
358 rxq->rb_stts = NULL; 358 rxq->rb_stts = NULL;
359} 359}
@@ -362,7 +362,7 @@ EXPORT_SYMBOL(iwl_rx_queue_free);
362int iwl_rx_queue_alloc(struct iwl_priv *priv) 362int iwl_rx_queue_alloc(struct iwl_priv *priv)
363{ 363{
364 struct iwl_rx_queue *rxq = &priv->rxq; 364 struct iwl_rx_queue *rxq = &priv->rxq;
365 struct pci_dev *dev = priv->pci_dev; 365 struct device *dev = &priv->pci_dev->dev;
366 int i; 366 int i;
367 367
368 spin_lock_init(&rxq->lock); 368 spin_lock_init(&rxq->lock);
@@ -370,12 +370,13 @@ int iwl_rx_queue_alloc(struct iwl_priv *priv)
370 INIT_LIST_HEAD(&rxq->rx_used); 370 INIT_LIST_HEAD(&rxq->rx_used);
371 371
372 /* Alloc the circular buffer of Read Buffer Descriptors (RBDs) */ 372 /* Alloc the circular buffer of Read Buffer Descriptors (RBDs) */
373 rxq->bd = pci_alloc_consistent(dev, 4 * RX_QUEUE_SIZE, &rxq->dma_addr); 373 rxq->bd = dma_alloc_coherent(dev, 4 * RX_QUEUE_SIZE, &rxq->dma_addr,
374 GFP_KERNEL);
374 if (!rxq->bd) 375 if (!rxq->bd)
375 goto err_bd; 376 goto err_bd;
376 377
377 rxq->rb_stts = pci_alloc_consistent(dev, sizeof(struct iwl_rb_status), 378 rxq->rb_stts = dma_alloc_coherent(dev, sizeof(struct iwl_rb_status),
378 &rxq->rb_stts_dma); 379 &rxq->rb_stts_dma, GFP_KERNEL);
379 if (!rxq->rb_stts) 380 if (!rxq->rb_stts)
380 goto err_rb; 381 goto err_rb;
381 382
@@ -392,8 +393,8 @@ int iwl_rx_queue_alloc(struct iwl_priv *priv)
392 return 0; 393 return 0;
393 394
394err_rb: 395err_rb:
395 pci_free_consistent(priv->pci_dev, 4 * RX_QUEUE_SIZE, rxq->bd, 396 dma_free_coherent(&priv->pci_dev->dev, 4 * RX_QUEUE_SIZE, rxq->bd,
396 rxq->dma_addr); 397 rxq->dma_addr);
397err_bd: 398err_bd:
398 return -ENOMEM; 399 return -ENOMEM;
399} 400}
diff --git a/drivers/net/wireless/iwlwifi/iwl-tx.c b/drivers/net/wireless/iwlwifi/iwl-tx.c
index 8f4071562857..4af2f7a4510f 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
@@ -146,7 +147,7 @@ void iwl_tx_queue_free(struct iwl_priv *priv, int txq_id)
146{ 147{
147 struct iwl_tx_queue *txq = &priv->txq[txq_id]; 148 struct iwl_tx_queue *txq = &priv->txq[txq_id];
148 struct iwl_queue *q = &txq->q; 149 struct iwl_queue *q = &txq->q;
149 struct pci_dev *dev = priv->pci_dev; 150 struct device *dev = &priv->pci_dev->dev;
150 int i; 151 int i;
151 152
152 if (q->n_bd == 0) 153 if (q->n_bd == 0)
@@ -163,8 +164,8 @@ void iwl_tx_queue_free(struct iwl_priv *priv, int txq_id)
163 164
164 /* De-alloc circular buffer of TFDs */ 165 /* De-alloc circular buffer of TFDs */
165 if (txq->q.n_bd) 166 if (txq->q.n_bd)
166 pci_free_consistent(dev, priv->hw_params.tfd_size * 167 dma_free_coherent(dev, priv->hw_params.tfd_size *
167 txq->q.n_bd, txq->tfds, txq->q.dma_addr); 168 txq->q.n_bd, txq->tfds, txq->q.dma_addr);
168 169
169 /* De-alloc array of per-TFD driver data */ 170 /* De-alloc array of per-TFD driver data */
170 kfree(txq->txb); 171 kfree(txq->txb);
@@ -193,7 +194,7 @@ void iwl_cmd_queue_free(struct iwl_priv *priv)
193{ 194{
194 struct iwl_tx_queue *txq = &priv->txq[IWL_CMD_QUEUE_NUM]; 195 struct iwl_tx_queue *txq = &priv->txq[IWL_CMD_QUEUE_NUM];
195 struct iwl_queue *q = &txq->q; 196 struct iwl_queue *q = &txq->q;
196 struct pci_dev *dev = priv->pci_dev; 197 struct device *dev = &priv->pci_dev->dev;
197 int i; 198 int i;
198 199
199 if (q->n_bd == 0) 200 if (q->n_bd == 0)
@@ -205,8 +206,8 @@ void iwl_cmd_queue_free(struct iwl_priv *priv)
205 206
206 /* De-alloc circular buffer of TFDs */ 207 /* De-alloc circular buffer of TFDs */
207 if (txq->q.n_bd) 208 if (txq->q.n_bd)
208 pci_free_consistent(dev, priv->hw_params.tfd_size * 209 dma_free_coherent(dev, priv->hw_params.tfd_size * txq->q.n_bd,
209 txq->q.n_bd, txq->tfds, txq->q.dma_addr); 210 txq->tfds, txq->q.dma_addr);
210 211
211 /* deallocate arrays */ 212 /* deallocate arrays */
212 kfree(txq->cmd); 213 kfree(txq->cmd);
@@ -297,7 +298,7 @@ static int iwl_queue_init(struct iwl_priv *priv, struct iwl_queue *q,
297static int iwl_tx_queue_alloc(struct iwl_priv *priv, 298static int iwl_tx_queue_alloc(struct iwl_priv *priv,
298 struct iwl_tx_queue *txq, u32 id) 299 struct iwl_tx_queue *txq, u32 id)
299{ 300{
300 struct pci_dev *dev = priv->pci_dev; 301 struct device *dev = &priv->pci_dev->dev;
301 size_t tfd_sz = priv->hw_params.tfd_size * TFD_QUEUE_SIZE_MAX; 302 size_t tfd_sz = priv->hw_params.tfd_size * TFD_QUEUE_SIZE_MAX;
302 303
303 /* Driver private data, only for Tx (not command) queues, 304 /* Driver private data, only for Tx (not command) queues,
@@ -316,8 +317,8 @@ static int iwl_tx_queue_alloc(struct iwl_priv *priv,
316 317
317 /* Circular buffer of transmit frame descriptors (TFDs), 318 /* Circular buffer of transmit frame descriptors (TFDs),
318 * shared with device */ 319 * shared with device */
319 txq->tfds = pci_alloc_consistent(dev, tfd_sz, &txq->q.dma_addr); 320 txq->tfds = dma_alloc_coherent(dev, tfd_sz, &txq->q.dma_addr,
320 321 GFP_KERNEL);
321 if (!txq->tfds) { 322 if (!txq->tfds) {
322 IWL_ERR(priv, "pci_alloc_consistent(%zd) failed\n", tfd_sz); 323 IWL_ERR(priv, "pci_alloc_consistent(%zd) failed\n", tfd_sz);
323 goto error; 324 goto error;
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index f8e4e4b18d02..f29786521bc3 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,
@@ -1253,10 +1253,10 @@ static void iwl3945_rx_queue_free(struct iwl_priv *priv, struct iwl_rx_queue *rx
1253 } 1253 }
1254 } 1254 }
1255 1255
1256 pci_free_consistent(priv->pci_dev, 4 * RX_QUEUE_SIZE, rxq->bd, 1256 dma_free_coherent(&priv->pci_dev->dev, 4 * RX_QUEUE_SIZE, rxq->bd,
1257 rxq->dma_addr); 1257 rxq->dma_addr);
1258 pci_free_consistent(priv->pci_dev, sizeof(struct iwl_rb_status), 1258 dma_free_coherent(&priv->pci_dev->dev, sizeof(struct iwl_rb_status),
1259 rxq->rb_stts, rxq->rb_stts_dma); 1259 rxq->rb_stts, rxq->rb_stts_dma);
1260 rxq->bd = NULL; 1260 rxq->bd = NULL;
1261 rxq->rb_stts = NULL; 1261 rxq->rb_stts = NULL;
1262} 1262}