diff options
author | Emmanuel Grumbach <emmanuel.grumbach@intel.com> | 2011-06-18 11:12:57 -0400 |
---|---|---|
committer | Wey-Yi Guy <wey-yi.w.guy@intel.com> | 2011-06-18 11:16:16 -0400 |
commit | 795414db8607a195541fe1a8f072021011b73386 (patch) | |
tree | 95f18811cd9ff87e926966b29bb9b8865b4e325d /drivers/net/wireless | |
parent | 084dd79172cb3aad11d2b7ee5628d57badca7c6e (diff) |
iwlagn: don't use the PCI wrappers for DMA operation
Get a pointer to the struct device during probe and get the rid of all the PCI
specific DMA wrappers.
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-agn-lib.c | 12 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-agn-tx.c | 27 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-agn.c | 8 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-tx.c | 27 |
4 files changed, 36 insertions, 38 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c index 4c11edcb4e61..52da53997d4c 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c | |||
@@ -639,9 +639,9 @@ void iwlagn_rx_queue_reset(struct iwl_priv *priv, struct iwl_rx_queue *rxq) | |||
639 | /* In the reset function, these buffers may have been allocated | 639 | /* In the reset function, these buffers may have been allocated |
640 | * to an SKB, so we need to unmap and free potential storage */ | 640 | * to an SKB, so we need to unmap and free potential storage */ |
641 | if (rxq->pool[i].page != NULL) { | 641 | if (rxq->pool[i].page != NULL) { |
642 | pci_unmap_page(priv->pci_dev, rxq->pool[i].page_dma, | 642 | dma_unmap_page(priv->bus.dev, rxq->pool[i].page_dma, |
643 | PAGE_SIZE << priv->hw_params.rx_page_order, | 643 | PAGE_SIZE << priv->hw_params.rx_page_order, |
644 | PCI_DMA_FROMDEVICE); | 644 | DMA_FROM_DEVICE); |
645 | __iwl_free_pages(priv, rxq->pool[i].page); | 645 | __iwl_free_pages(priv, rxq->pool[i].page); |
646 | rxq->pool[i].page = NULL; | 646 | rxq->pool[i].page = NULL; |
647 | } | 647 | } |
@@ -913,9 +913,9 @@ void iwlagn_rx_allocate(struct iwl_priv *priv, gfp_t priority) | |||
913 | BUG_ON(rxb->page); | 913 | BUG_ON(rxb->page); |
914 | rxb->page = page; | 914 | rxb->page = page; |
915 | /* Get physical address of the RB */ | 915 | /* Get physical address of the RB */ |
916 | rxb->page_dma = pci_map_page(priv->pci_dev, page, 0, | 916 | rxb->page_dma = dma_map_page(priv->bus.dev, page, 0, |
917 | PAGE_SIZE << priv->hw_params.rx_page_order, | 917 | PAGE_SIZE << priv->hw_params.rx_page_order, |
918 | PCI_DMA_FROMDEVICE); | 918 | DMA_FROM_DEVICE); |
919 | /* dma address must be no more than 36 bits */ | 919 | /* dma address must be no more than 36 bits */ |
920 | BUG_ON(rxb->page_dma & ~DMA_BIT_MASK(36)); | 920 | BUG_ON(rxb->page_dma & ~DMA_BIT_MASK(36)); |
921 | /* and also 256 byte aligned! */ | 921 | /* and also 256 byte aligned! */ |
@@ -958,9 +958,9 @@ void iwlagn_rx_queue_free(struct iwl_priv *priv, struct iwl_rx_queue *rxq) | |||
958 | int i; | 958 | int i; |
959 | for (i = 0; i < RX_QUEUE_SIZE + RX_FREE_BUFFERS; i++) { | 959 | for (i = 0; i < RX_QUEUE_SIZE + RX_FREE_BUFFERS; i++) { |
960 | if (rxq->pool[i].page != NULL) { | 960 | if (rxq->pool[i].page != NULL) { |
961 | pci_unmap_page(priv->pci_dev, rxq->pool[i].page_dma, | 961 | dma_unmap_page(priv->bus.dev, rxq->pool[i].page_dma, |
962 | PAGE_SIZE << priv->hw_params.rx_page_order, | 962 | PAGE_SIZE << priv->hw_params.rx_page_order, |
963 | PCI_DMA_FROMDEVICE); | 963 | DMA_FROM_DEVICE); |
964 | __iwl_free_pages(priv, rxq->pool[i].page); | 964 | __iwl_free_pages(priv, rxq->pool[i].page); |
965 | rxq->pool[i].page = NULL; | 965 | rxq->pool[i].page = NULL; |
966 | } | 966 | } |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-tx.c b/drivers/net/wireless/iwlwifi/iwl-agn-tx.c index f4e5edefd066..d0ac090399e9 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-tx.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-tx.c | |||
@@ -716,10 +716,10 @@ int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) | |||
716 | 716 | ||
717 | /* Physical address of this Tx command's header (not MAC header!), | 717 | /* Physical address of this Tx command's header (not MAC header!), |
718 | * within command buffer array. */ | 718 | * within command buffer array. */ |
719 | txcmd_phys = pci_map_single(priv->pci_dev, | 719 | txcmd_phys = dma_map_single(priv->bus.dev, |
720 | &out_cmd->hdr, firstlen, | 720 | &out_cmd->hdr, firstlen, |
721 | PCI_DMA_BIDIRECTIONAL); | 721 | DMA_BIDIRECTIONAL); |
722 | if (unlikely(pci_dma_mapping_error(priv->pci_dev, txcmd_phys))) | 722 | if (unlikely(dma_mapping_error(priv->bus.dev, txcmd_phys))) |
723 | goto drop_unlock_sta; | 723 | goto drop_unlock_sta; |
724 | dma_unmap_addr_set(out_meta, mapping, txcmd_phys); | 724 | dma_unmap_addr_set(out_meta, mapping, txcmd_phys); |
725 | dma_unmap_len_set(out_meta, len, firstlen); | 725 | dma_unmap_len_set(out_meta, len, firstlen); |
@@ -735,13 +735,13 @@ int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) | |||
735 | * if any (802.11 null frames have no payload). */ | 735 | * if any (802.11 null frames have no payload). */ |
736 | secondlen = skb->len - hdr_len; | 736 | secondlen = skb->len - hdr_len; |
737 | if (secondlen > 0) { | 737 | if (secondlen > 0) { |
738 | phys_addr = pci_map_single(priv->pci_dev, skb->data + hdr_len, | 738 | phys_addr = dma_map_single(priv->bus.dev, skb->data + hdr_len, |
739 | secondlen, PCI_DMA_TODEVICE); | 739 | secondlen, DMA_TO_DEVICE); |
740 | if (unlikely(pci_dma_mapping_error(priv->pci_dev, phys_addr))) { | 740 | if (unlikely(dma_mapping_error(priv->bus.dev, phys_addr))) { |
741 | pci_unmap_single(priv->pci_dev, | 741 | dma_unmap_single(priv->bus.dev, |
742 | dma_unmap_addr(out_meta, mapping), | 742 | dma_unmap_addr(out_meta, mapping), |
743 | dma_unmap_len(out_meta, len), | 743 | dma_unmap_len(out_meta, len), |
744 | PCI_DMA_BIDIRECTIONAL); | 744 | DMA_BIDIRECTIONAL); |
745 | goto drop_unlock_sta; | 745 | goto drop_unlock_sta; |
746 | } | 746 | } |
747 | } | 747 | } |
@@ -764,8 +764,8 @@ int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) | |||
764 | offsetof(struct iwl_tx_cmd, scratch); | 764 | offsetof(struct iwl_tx_cmd, scratch); |
765 | 765 | ||
766 | /* take back ownership of DMA buffer to enable update */ | 766 | /* take back ownership of DMA buffer to enable update */ |
767 | pci_dma_sync_single_for_cpu(priv->pci_dev, txcmd_phys, | 767 | dma_sync_single_for_cpu(priv->bus.dev, txcmd_phys, firstlen, |
768 | firstlen, PCI_DMA_BIDIRECTIONAL); | 768 | DMA_BIDIRECTIONAL); |
769 | tx_cmd->dram_lsb_ptr = cpu_to_le32(scratch_phys); | 769 | tx_cmd->dram_lsb_ptr = cpu_to_le32(scratch_phys); |
770 | tx_cmd->dram_msb_ptr = iwl_get_dma_hi_addr(scratch_phys); | 770 | tx_cmd->dram_msb_ptr = iwl_get_dma_hi_addr(scratch_phys); |
771 | 771 | ||
@@ -780,8 +780,8 @@ int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) | |||
780 | iwlagn_txq_update_byte_cnt_tbl(priv, txq, | 780 | iwlagn_txq_update_byte_cnt_tbl(priv, txq, |
781 | le16_to_cpu(tx_cmd->len)); | 781 | le16_to_cpu(tx_cmd->len)); |
782 | 782 | ||
783 | pci_dma_sync_single_for_device(priv->pci_dev, txcmd_phys, | 783 | dma_sync_single_for_device(priv->bus.dev, txcmd_phys, firstlen, |
784 | firstlen, PCI_DMA_BIDIRECTIONAL); | 784 | DMA_BIDIRECTIONAL); |
785 | 785 | ||
786 | trace_iwlwifi_dev_tx(priv, | 786 | trace_iwlwifi_dev_tx(priv, |
787 | &((struct iwl_tfd *)txq->tfds)[txq->q.write_ptr], | 787 | &((struct iwl_tfd *)txq->tfds)[txq->q.write_ptr], |
@@ -848,8 +848,7 @@ static inline void iwlagn_free_dma_ptr(struct iwl_priv *priv, | |||
848 | if (unlikely(!ptr->addr)) | 848 | if (unlikely(!ptr->addr)) |
849 | return; | 849 | return; |
850 | 850 | ||
851 | dma_free_coherent(priv->bus.dev, | 851 | dma_free_coherent(priv->bus.dev, ptr->size, ptr->addr, ptr->dma); |
852 | ptr->size, ptr->addr, ptr->dma); | ||
853 | memset(ptr, 0, sizeof(*ptr)); | 852 | memset(ptr, 0, sizeof(*ptr)); |
854 | } | 853 | } |
855 | 854 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c index 72db1a9fab84..eeb31bcfc741 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c | |||
@@ -495,9 +495,9 @@ static void iwl_rx_handle(struct iwl_priv *priv) | |||
495 | 495 | ||
496 | rxq->queue[i] = NULL; | 496 | rxq->queue[i] = NULL; |
497 | 497 | ||
498 | pci_unmap_page(priv->pci_dev, rxb->page_dma, | 498 | dma_unmap_page(priv->bus.dev, rxb->page_dma, |
499 | PAGE_SIZE << priv->hw_params.rx_page_order, | 499 | PAGE_SIZE << priv->hw_params.rx_page_order, |
500 | PCI_DMA_FROMDEVICE); | 500 | DMA_FROM_DEVICE); |
501 | pkt = rxb_addr(rxb); | 501 | pkt = rxb_addr(rxb); |
502 | 502 | ||
503 | len = le32_to_cpu(pkt->len_n_flags) & FH_RSCSR_FRAME_SIZE_MSK; | 503 | len = le32_to_cpu(pkt->len_n_flags) & FH_RSCSR_FRAME_SIZE_MSK; |
@@ -579,9 +579,9 @@ static void iwl_rx_handle(struct iwl_priv *priv) | |||
579 | * rx_free list for reuse later. */ | 579 | * rx_free list for reuse later. */ |
580 | spin_lock_irqsave(&rxq->lock, flags); | 580 | spin_lock_irqsave(&rxq->lock, flags); |
581 | if (rxb->page != NULL) { | 581 | if (rxb->page != NULL) { |
582 | rxb->page_dma = pci_map_page(priv->pci_dev, rxb->page, | 582 | rxb->page_dma = dma_map_page(priv->bus.dev, rxb->page, |
583 | 0, PAGE_SIZE << priv->hw_params.rx_page_order, | 583 | 0, PAGE_SIZE << priv->hw_params.rx_page_order, |
584 | PCI_DMA_FROMDEVICE); | 584 | DMA_FROM_DEVICE); |
585 | list_add_tail(&rxb->list, &rxq->rx_free); | 585 | list_add_tail(&rxb->list, &rxq->rx_free); |
586 | rxq->free_count++; | 586 | rxq->free_count++; |
587 | } else | 587 | } else |
diff --git a/drivers/net/wireless/iwlwifi/iwl-tx.c b/drivers/net/wireless/iwlwifi/iwl-tx.c index f982ac9b8ba2..fd8aee9972c1 100644 --- a/drivers/net/wireless/iwlwifi/iwl-tx.c +++ b/drivers/net/wireless/iwlwifi/iwl-tx.c | |||
@@ -128,7 +128,6 @@ static inline u8 iwl_tfd_get_num_tbs(struct iwl_tfd *tfd) | |||
128 | static void iwlagn_unmap_tfd(struct iwl_priv *priv, struct iwl_cmd_meta *meta, | 128 | static void iwlagn_unmap_tfd(struct iwl_priv *priv, struct iwl_cmd_meta *meta, |
129 | struct iwl_tfd *tfd) | 129 | struct iwl_tfd *tfd) |
130 | { | 130 | { |
131 | struct pci_dev *dev = priv->pci_dev; | ||
132 | int i; | 131 | int i; |
133 | int num_tbs; | 132 | int num_tbs; |
134 | 133 | ||
@@ -143,15 +142,15 @@ static void iwlagn_unmap_tfd(struct iwl_priv *priv, struct iwl_cmd_meta *meta, | |||
143 | 142 | ||
144 | /* Unmap tx_cmd */ | 143 | /* Unmap tx_cmd */ |
145 | if (num_tbs) | 144 | if (num_tbs) |
146 | pci_unmap_single(dev, | 145 | dma_unmap_single(priv->bus.dev, |
147 | dma_unmap_addr(meta, mapping), | 146 | dma_unmap_addr(meta, mapping), |
148 | dma_unmap_len(meta, len), | 147 | dma_unmap_len(meta, len), |
149 | PCI_DMA_BIDIRECTIONAL); | 148 | DMA_BIDIRECTIONAL); |
150 | 149 | ||
151 | /* Unmap chunks, if any. */ | 150 | /* Unmap chunks, if any. */ |
152 | for (i = 1; i < num_tbs; i++) | 151 | for (i = 1; i < num_tbs; i++) |
153 | pci_unmap_single(dev, iwl_tfd_tb_get_addr(tfd, i), | 152 | dma_unmap_single(priv->bus.dev, iwl_tfd_tb_get_addr(tfd, i), |
154 | iwl_tfd_tb_get_len(tfd, i), PCI_DMA_TODEVICE); | 153 | iwl_tfd_tb_get_len(tfd, i), DMA_TO_DEVICE); |
155 | } | 154 | } |
156 | 155 | ||
157 | /** | 156 | /** |
@@ -310,10 +309,10 @@ void iwl_cmd_queue_unmap(struct iwl_priv *priv) | |||
310 | i = get_cmd_index(q, q->read_ptr); | 309 | i = get_cmd_index(q, q->read_ptr); |
311 | 310 | ||
312 | if (txq->meta[i].flags & CMD_MAPPED) { | 311 | if (txq->meta[i].flags & CMD_MAPPED) { |
313 | pci_unmap_single(priv->pci_dev, | 312 | dma_unmap_single(priv->bus.dev, |
314 | dma_unmap_addr(&txq->meta[i], mapping), | 313 | dma_unmap_addr(&txq->meta[i], mapping), |
315 | dma_unmap_len(&txq->meta[i], len), | 314 | dma_unmap_len(&txq->meta[i], len), |
316 | PCI_DMA_BIDIRECTIONAL); | 315 | DMA_BIDIRECTIONAL); |
317 | txq->meta[i].flags = 0; | 316 | txq->meta[i].flags = 0; |
318 | } | 317 | } |
319 | 318 | ||
@@ -456,7 +455,7 @@ static int iwl_tx_queue_alloc(struct iwl_priv *priv, | |||
456 | txq->tfds = dma_alloc_coherent(dev, tfd_sz, &txq->q.dma_addr, | 455 | txq->tfds = dma_alloc_coherent(dev, tfd_sz, &txq->q.dma_addr, |
457 | GFP_KERNEL); | 456 | GFP_KERNEL); |
458 | if (!txq->tfds) { | 457 | if (!txq->tfds) { |
459 | IWL_ERR(priv, "pci_alloc_consistent(%zd) failed\n", tfd_sz); | 458 | IWL_ERR(priv, "dma_alloc_coherent(%zd) failed\n", tfd_sz); |
460 | goto error; | 459 | goto error; |
461 | } | 460 | } |
462 | txq->q.id = id; | 461 | txq->q.id = id; |
@@ -677,9 +676,9 @@ int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd) | |||
677 | le16_to_cpu(out_cmd->hdr.sequence), cmd_size, | 676 | le16_to_cpu(out_cmd->hdr.sequence), cmd_size, |
678 | q->write_ptr, idx, priv->cmd_queue); | 677 | q->write_ptr, idx, priv->cmd_queue); |
679 | 678 | ||
680 | phys_addr = pci_map_single(priv->pci_dev, &out_cmd->hdr, | 679 | phys_addr = dma_map_single(priv->bus.dev, &out_cmd->hdr, copy_size, |
681 | copy_size, PCI_DMA_BIDIRECTIONAL); | 680 | DMA_BIDIRECTIONAL); |
682 | if (unlikely(pci_dma_mapping_error(priv->pci_dev, phys_addr))) { | 681 | if (unlikely(dma_mapping_error(priv->bus.dev, phys_addr))) { |
683 | idx = -ENOMEM; | 682 | idx = -ENOMEM; |
684 | goto out; | 683 | goto out; |
685 | } | 684 | } |
@@ -699,9 +698,9 @@ int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd) | |||
699 | continue; | 698 | continue; |
700 | if (!(cmd->dataflags[i] & IWL_HCMD_DFL_NOCOPY)) | 699 | if (!(cmd->dataflags[i] & IWL_HCMD_DFL_NOCOPY)) |
701 | continue; | 700 | continue; |
702 | phys_addr = pci_map_single(priv->pci_dev, (void *)cmd->data[i], | 701 | phys_addr = dma_map_single(priv->bus.dev, (void *)cmd->data[i], |
703 | cmd->len[i], PCI_DMA_TODEVICE); | 702 | cmd->len[i], DMA_TO_DEVICE); |
704 | if (pci_dma_mapping_error(priv->pci_dev, phys_addr)) { | 703 | if (dma_mapping_error(priv->bus.dev, phys_addr)) { |
705 | iwlagn_unmap_tfd(priv, out_meta, | 704 | iwlagn_unmap_tfd(priv, out_meta, |
706 | &txq->tfds[q->write_ptr]); | 705 | &txq->tfds[q->write_ptr]); |
707 | idx = -ENOMEM; | 706 | idx = -ENOMEM; |