All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Einon <mark.einon@gmail.com>
To: gregkh@suse.de
Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
	Mark Einon <mark.einon@gmail.com>
Subject: [RESEND][PATCH 18/26] staging: et131x: Convert rest of pci memory management to dma api
Date: Tue, 18 Oct 2011 17:07:51 +0100	[thread overview]
Message-ID: <1318954079-16666-19-git-send-email-mark.einon@gmail.com> (raw)
In-Reply-To: <1318954079-16666-1-git-send-email-mark.einon@gmail.com>

Replaced pci map/unmap and set_mask calls with their dma equivalents.
Also updated comments to reflect this.

Signed-off-by: Mark Einon <mark.einon@gmail.com>
---
 drivers/staging/et131x/et131x.c |   56 +++++++++++++++++++-------------------
 1 files changed, 28 insertions(+), 28 deletions(-)

diff --git a/drivers/staging/et131x/et131x.c b/drivers/staging/et131x/et131x.c
index 993f93a..1c11dfd 100644
--- a/drivers/staging/et131x/et131x.c
+++ b/drivers/staging/et131x/et131x.c
@@ -1976,7 +1976,7 @@ int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter)
 
 	/* Save physical address
 	 *
-	 * NOTE: pci_alloc_consistent(), used above to alloc DMA regions,
+	 * NOTE: dma_alloc_coherent(), used above to alloc DMA regions,
 	 * ALWAYS returns SAC (32-bit) addresses. If DAC (64-bit) addresses
 	 * are ever returned, make sure the high part is retrieved here
 	 * before storing the adjusted address.
@@ -2007,7 +2007,7 @@ int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter)
 
 	/* Save physical address
 	 *
-	 * NOTE: pci_alloc_consistent(), used above to alloc DMA regions,
+	 * NOTE: dma_alloc_coherent(), used above to alloc DMA regions,
 	 * ALWAYS returns SAC (32-bit) addresses. If DAC (64-bit) addresses
 	 * are ever returned, make sure the high part is retrieved here before
 	 * storing the adjusted address.
@@ -2152,7 +2152,7 @@ int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter)
 	    (unsigned long) rx_ring->ps_ring_physaddr);
 
 	/*
-	 * NOTE : pci_alloc_consistent(), used above to alloc DMA regions,
+	 * NOTE : dma_alloc_coherent(), used above to alloc DMA regions,
 	 * ALWAYS returns SAC (32-bit) addresses. If DAC (64-bit) addresses
 	 * are ever returned, make sure the high part is retrieved here before
 	 * storing the adjusted address.
@@ -2172,7 +2172,7 @@ int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter)
 	printk(KERN_INFO "PRS %lx\n", (unsigned long)rx_ring->rx_status_bus);
 
 	/* Recv
-	 * pci_pool_create initializes a lookaside list. After successful
+	 * kmem_cache_create initializes a lookaside list. After successful
 	 * creation, nonpaged fixed-size blocks can be allocated from and
 	 * freed to the lookaside list.
 	 * RFDs will be allocated from this pool.
@@ -2408,7 +2408,7 @@ void et131x_config_rx_dma_regs(struct et131x_adapter *adapter)
 
 	/* Load the completion writeback physical address
 	 *
-	 * NOTE : pci_alloc_consistent(), used above to alloc DMA regions,
+	 * NOTE : dma_alloc_coherent(), used above to alloc DMA regions,
 	 * ALWAYS returns SAC (32-bit) addresses. If DAC (64-bit) addresses
 	 * are ever returned, make sure the high part is retrieved here
 	 * before storing the adjusted address.
@@ -3005,7 +3005,7 @@ int et131x_tx_dma_memory_alloc(struct et131x_adapter *adapter)
 
 	/* Save physical address
 	 *
-	 * NOTE: pci_alloc_consistent(), used above to alloc DMA regions,
+	 * NOTE: dma_alloc_coherent(), used above to alloc DMA regions,
 	 * ALWAYS returns SAC (32-bit) addresses. If DAC (64-bit) addresses
 	 * are ever returned, make sure the high part is retrieved here before
 	 * storing the adjusted address.
@@ -3202,59 +3202,59 @@ static int nic_send_packet(struct et131x_adapter *adapter, struct tcb *tcb)
 					skb->len - skb->data_len;
 
 				/* NOTE: Here, the dma_addr_t returned from
-				 * pci_map_single() is implicitly cast as a
+				 * dma_map_single() is implicitly cast as a
 				 * u32. Although dma_addr_t can be
 				 * 64-bit, the address returned by
-				 * pci_map_single() is always 32-bit
+				 * dma_map_single() is always 32-bit
 				 * addressable (as defined by the pci/dma
 				 * subsystem)
 				 */
 				desc[frag++].addr_lo =
-				    pci_map_single(adapter->pdev,
+				    dma_map_single(&adapter->pdev->dev,
 						   skb->data,
 						   skb->len -
 						   skb->data_len,
-						   PCI_DMA_TODEVICE);
+						   DMA_TO_DEVICE);
 			} else {
 				desc[frag].addr_hi = 0;
 				desc[frag].len_vlan =
 				    (skb->len - skb->data_len) / 2;
 
 				/* NOTE: Here, the dma_addr_t returned from
-				 * pci_map_single() is implicitly cast as a
+				 * dma_map_single() is implicitly cast as a
 				 * u32. Although dma_addr_t can be
 				 * 64-bit, the address returned by
-				 * pci_map_single() is always 32-bit
+				 * dma_map_single() is always 32-bit
 				 * addressable (as defined by the pci/dma
 				 * subsystem)
 				 */
 				desc[frag++].addr_lo =
-				    pci_map_single(adapter->pdev,
+				    dma_map_single(&adapter->pdev->dev,
 						   skb->data,
 						   ((skb->len -
 						     skb->data_len) / 2),
-						   PCI_DMA_TODEVICE);
+						   DMA_TO_DEVICE);
 				desc[frag].addr_hi = 0;
 
 				desc[frag].len_vlan =
 				    (skb->len - skb->data_len) / 2;
 
 				/* NOTE: Here, the dma_addr_t returned from
-				 * pci_map_single() is implicitly cast as a
+				 * dma_map_single() is implicitly cast as a
 				 * u32. Although dma_addr_t can be
 				 * 64-bit, the address returned by
-				 * pci_map_single() is always 32-bit
+				 * dma_map_single() is always 32-bit
 				 * addressable (as defined by the pci/dma
 				 * subsystem)
 				 */
 				desc[frag++].addr_lo =
-				    pci_map_single(adapter->pdev,
+				    dma_map_single(&adapter->pdev->dev,
 						   skb->data +
 						   ((skb->len -
 						     skb->data_len) / 2),
 						   ((skb->len -
 						     skb->data_len) / 2),
-						   PCI_DMA_TODEVICE);
+						   DMA_TO_DEVICE);
 			}
 		} else {
 			desc[frag].addr_hi = 0;
@@ -3262,17 +3262,17 @@ static int nic_send_packet(struct et131x_adapter *adapter, struct tcb *tcb)
 					frags[i - 1].size;
 
 			/* NOTE: Here, the dma_addr_t returned from
-			 * pci_map_page() is implicitly cast as a u32.
+			 * dma_map_page() is implicitly cast as a u32.
 			 * Although dma_addr_t can be 64-bit, the address
-			 * returned by pci_map_page() is always 32-bit
+			 * returned by dma_map_page() is always 32-bit
 			 * addressable (as defined by the pci/dma subsystem)
 			 */
 			desc[frag++].addr_lo =
-			    pci_map_page(adapter->pdev,
+			    dma_map_page(&adapter->pdev->dev,
 					 frags[i - 1].page,
 					 frags[i - 1].page_offset,
 					 frags[i - 1].size,
-					 PCI_DMA_TODEVICE);
+					 DMA_TO_DEVICE);
 		}
 	}
 
@@ -3522,9 +3522,9 @@ static inline void free_send_packet(struct et131x_adapter *adapter,
 				    (adapter->tx_ring.tx_desc_ring +
 						INDEX10(tcb->index_start));
 
-			pci_unmap_single(adapter->pdev,
+			dma_unmap_single(&adapter->pdev->dev,
 					 desc->addr_lo,
-					 desc->len_vlan, PCI_DMA_TODEVICE);
+					 desc->len_vlan, DMA_TO_DEVICE);
 
 			add_10bit(&tcb->index_start, 1);
 			if (INDEX10(tcb->index_start) >=
@@ -4428,15 +4428,15 @@ static int __devinit et131x_pci_setup(struct pci_dev *pdev,
 	}
 
 	/* Check the DMA addressing support of this device */
-	if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) {
-		result = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64));
+	if (!dma_set_mask(&pdev->dev, DMA_BIT_MASK(64))) {
+		result = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(64));
 		if (result) {
 			dev_err(&pdev->dev,
 			  "Unable to obtain 64 bit DMA for consistent allocations\n");
 			goto err_release_res;
 		}
-	} else if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) {
-		result = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));
+	} else if (!dma_set_mask(&pdev->dev, DMA_BIT_MASK(32))) {
+		result = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
 		if (result) {
 			dev_err(&pdev->dev,
 			  "Unable to obtain 32 bit DMA for consistent allocations\n");
-- 
1.7.6.4


  parent reply	other threads:[~2011-10-18 16:10 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-18 16:07 [PATCH 00/26] Mostly resending patches Mark Einon
2011-10-18 16:07 ` [RESEND][PATCH 01/26] staging: et131x: Put all .c files into one big file Mark Einon
2011-10-19 20:41   ` [PATCH " Greg KH
2011-10-19 21:28     ` Mark Einon
2011-10-19 22:28       ` Greg KH
2011-10-18 16:07 ` [RESEND][PATCH 02/26] staging: et131x: Move function declarations from et131x.h to et131x.c Mark Einon
2011-10-18 16:07 ` [RESEND][PATCH 03/26] staging: et131x: Move non-register defines " Mark Einon
2011-10-18 16:07 ` [RESEND][PATCH 04/26] staging: et131x: move et1310_address_map.h contents into et131x.h Mark Einon
2011-10-18 16:07 ` [RESEND][PATCH 05/26] staging: et131x: move et1310_phy.h " Mark Einon
2011-10-18 16:07 ` [RESEND][PATCH 06/26] staging: et131x: move et131x_adapter.h contents into et131x.c Mark Einon
2011-10-18 16:07 ` [RESEND][PATCH 07/26] staging: et131x: move et131x_defs.h " Mark Einon
2011-10-18 16:07 ` [RESEND][PATCH 08/26] staging: et131x: move et1310_rx.h " Mark Einon
2011-10-18 16:07 ` [RESEND][PATCH 09/26] staging: et131x: move et1310_tx.h " Mark Einon
2011-10-18 16:07 ` [RESEND][PATCH 10/26] staging: et131x: Update TODO list - remove 'put driver into single file' Mark Einon
2011-10-18 16:07 ` [RESEND][PATCH 11/26] staging: et131x: Moving two extern inline functions to .c file Mark Einon
2011-10-18 16:07 ` [RESEND][PATCH 12/26] staging: et131x: Make rx_ring.fbr{0,1} share a common structure Mark Einon
2011-10-18 16:07 ` [RESEND][PATCH 13/26] staging: et131x: Fix issues when USE_FBR0 is not defined Mark Einon
2011-10-18 16:07 ` [RESEND][PATCH 14/26] staging: et131x: use dma_alloc... instead of pci_alloc Mark Einon
2011-10-18 16:07 ` [RESEND][PATCH 15/26] staging: et131x: Match dma_alloc_ calls with dma_free_ calls Mark Einon
2011-10-18 16:07 ` [RESEND][PATCH 16/26] staging: et131x: Tidy up PCI device table definition Mark Einon
2011-10-18 16:07 ` [RESEND][PATCH 17/26] staging: et131x: on transmit, stop the queue if the next packet will fail Mark Einon
2011-10-18 16:07 ` Mark Einon [this message]
2011-10-18 16:07 ` [RESEND][PATCH 19/26] staging: et131x: Remove unused defines Mark Einon
2011-10-18 16:07 ` [PATCH 20/26] staging: et131x: Remove unused rx_ring.recv_buffer_pool Mark Einon
2011-10-18 16:07 ` [PATCH 21/26] staging: et131x: Remove redundant et131x_reset_recv() call Mark Einon
2011-10-18 16:07 ` [PATCH 22/26] staging: et131x: Remove call to find pci pm capability Mark Einon
2011-10-18 16:07 ` [PATCH 23/26] staging: et131x: Remove unused rx_ring.recv_packet_pool Mark Einon
2011-10-18 16:07 ` [PATCH 24/26] staging: et131x: Remove some forward declarations Mark Einon
2011-10-18 16:07 ` [PATCH 25/26] staging: et131x: Remove forward declaration of et131x_adapter_setup Mark Einon
2011-10-18 16:07 ` [PATCH 26/26] staging: et131x: Remove more forward declarations Mark Einon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1318954079-16666-19-git-send-email-mark.einon@gmail.com \
    --to=mark.einon@gmail.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.