Skip to contentSkip to conversation

staging: rtl8192e: from bus specific dma api to dma api

PATCH In review Sudip Mukherjee 2 participants 3 messages Oct 22, 2014 – Oct 30, 2014 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: rtl8192e: from bus specific dma api to dma api

we should be using DMA API rather than using bus specific DMA API. converted the occurrence of pci_map_*() to dma_map_*(), and at the same time used the dma_mapping_error().

---
 drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 12 ++++++------
 drivers/staging/rtl8192e/rtl8192e/rtl_core.c   | 19 ++++++++++---------
 2 files changed, 16 insertions(+), 15 deletions(-)
drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +6 -6
index 552d943..d3a3ce2 100644
@@ -1180,8 +1180,8 @@ void  rtl8192_tx_fill_desc(struct net_device *dev, struct tx_desc *pdesc,
 			   struct cb_desc *cb_desc, struct sk_buff *skb)
 {
 	struct r8192_priv *priv = rtllib_priv(dev);
-	dma_addr_t mapping = pci_map_single(priv->pdev, skb->data, skb->len,
-			 PCI_DMA_TODEVICE);
+	dma_addr_t mapping = dma_map_single(&priv->pdev->dev, skb->data,
+					    skb->len, DMA_TO_DEVICE);
 	struct tx_fwinfo_8190pci *pTxFwInfo = NULL;
 
 	pTxFwInfo = (struct tx_fwinfo_8190pci *)skb->data;
@@ -1193,7 +1193,7 @@ void  rtl8192_tx_fill_desc(struct net_device *dev, struct tx_desc *pdesc,
 						pTxFwInfo->TxRate,
 						cb_desc);
 
-	if (pci_dma_mapping_error(priv->pdev, mapping))
+	if (dma_mapping_error(&priv->pdev->dev, mapping))
 		RT_TRACE(COMP_ERR, "DMA Mapping error\n");
 	if (cb_desc->bAMPDUEnable) {
 		pTxFwInfo->AllowAggregation = 1;
@@ -1290,10 +1290,10 @@ void  rtl8192_tx_fill_cmd_desc(struct net_device *dev,
 			       struct cb_desc *cb_desc, struct sk_buff *skb)
 {
 	struct r8192_priv *priv = rtllib_priv(dev);
-	dma_addr_t mapping = pci_map_single(priv->pdev, skb->data, skb->len,
-			 PCI_DMA_TODEVICE);
+	dma_addr_t mapping = dma_map_single(&priv->pdev->dev, skb->data,
+					    skb->len, PCI_DMA_TODEVICE);
 
-	if (pci_dma_mapping_error(priv->pdev, mapping))
+	if (dma_mapping_error(&priv->pdev->dev, mapping))
 		RT_TRACE(COMP_ERR, "DMA Mapping error\n");
 	memset(entry, 0, 12);
 	entry->LINIP = cb_desc->bLastIniPkt;
drivers/staging/rtl8192e/rtl8192e/rtl_core.c +10 -9
index 5615c80..da8fa29 100644
@@ -2097,11 +2097,11 @@ static short rtl8192_alloc_rx_desc_ring(struct net_device *dev)
 			skb->dev = dev;
 			priv->rx_buf[rx_queue_idx][i] = skb;
 			mapping = (dma_addr_t *)skb->cb;
-			*mapping = pci_map_single(priv->pdev,
+			*mapping = dma_map_single(&priv->pdev->dev,
 						  skb_tail_pointer_rsl(skb),
 						  priv->rxbuffersize,
-						  PCI_DMA_FROMDEVICE);
-			if (pci_dma_mapping_error(priv->pdev, *mapping)) {
+						  DMA_FROM_DEVICE);
+			if (dma_mapping_error(&priv->pdev->dev, *mapping)) {
 				dev_kfree_skb_any(skb);
 				return -1;
 			}
@@ -2393,12 +2393,13 @@ static void rtl8192_rx_normal(struct net_device *dev)
 
 			priv->rx_buf[rx_queue_idx][priv->rx_idx[rx_queue_idx]] =
 									 skb;
-			*((dma_addr_t *) skb->cb) = pci_map_single(priv->pdev,
-						    skb_tail_pointer_rsl(skb),
-						    priv->rxbuffersize,
-						    PCI_DMA_FROMDEVICE);
-			if (pci_dma_mapping_error(priv->pdev,
-						  *((dma_addr_t *)skb->cb))) {
+			*((dma_addr_t *)skb->cb) =
+				dma_map_single(&priv->pdev->dev,
+					       skb_tail_pointer_rsl(skb),
+					       priv->rxbuffersize,
+					       DMA_FROM_DEVICE);
+			if (dma_mapping_error(&priv->pdev->dev,
+					      *((dma_addr_t *)skb->cb))) {
 				dev_kfree_skb_any(skb);
 				return;
 			}
Signature · 1 line
1.8.1.2
#1 lore raw
Quoted 1 line · Sudip Mukherjee

we should be using DMA API rather than using bus specific DMA API.

Why?

Quoted 2 lines

converted the occurrence of pci_map_*() to dma_map_*(), and at the same time used the dma_mapping_error().

Trailing whitespace :(

What have you used to test this change?

thanks,

greg k-h

#2 lore raw
Quoted 5 lines · Greg Kroah-Hartman
Quoted 1 line · Sudip Mukherjee

we should be using DMA API rather than using bus specific DMA API.

Why?

as given in the DMA-API-HOWTO.txt :
the DMA API works with any bus independent of the underlying microprocessor architecture.

Quoted 5 lines
Quoted 2 lines

converted the occurrence of pci_map_*() to dma_map_*(), and at the same time used the dma_mapping_error().

Trailing whitespace :(

oops .. really sorry . when i checked with checkpatch it didnot show any error. and I did not know that trailing whitespaces should not be there in the commit message also.

Quoted 1 line

What have you used to test this change?

it has just been build tested , not tested on hardware.

thanks
sudip

Quoted 4 lines

thanks,

greg k-h