public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: rtl8192e: from bus specific dma api to dma api
@ 2014-10-22  8:54 Sudip Mukherjee
  2014-10-29  8:47 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 3+ messages in thread
From: Sudip Mukherjee @ 2014-10-22  8:54 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Sudip Mukherjee, devel, linux-kernel

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().	  

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
---
 drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 12 ++++++------
 drivers/staging/rtl8192e/rtl8192e/rtl_core.c   | 19 ++++++++++---------
 2 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c
index 552d943..d3a3ce2 100644
--- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c
+++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c
@@ -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;
diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
index 5615c80..da8fa29 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
@@ -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;
 			}
-- 
1.8.1.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] staging: rtl8192e: from bus specific dma api to dma api
  2014-10-22  8:54 [PATCH] staging: rtl8192e: from bus specific dma api to dma api Sudip Mukherjee
@ 2014-10-29  8:47 ` Greg Kroah-Hartman
  2014-10-30  5:37   ` Sudip Mukherjee
  0 siblings, 1 reply; 3+ messages in thread
From: Greg Kroah-Hartman @ 2014-10-29  8:47 UTC (permalink / raw)
  To: Sudip Mukherjee; +Cc: devel, linux-kernel

On Wed, Oct 22, 2014 at 02:24:46PM +0530, Sudip Mukherjee wrote:
> we should be using DMA API rather than using bus specific DMA API.

Why?

> 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] staging: rtl8192e: from bus specific dma api to dma api
  2014-10-29  8:47 ` Greg Kroah-Hartman
@ 2014-10-30  5:37   ` Sudip Mukherjee
  0 siblings, 0 replies; 3+ messages in thread
From: Sudip Mukherjee @ 2014-10-30  5:37 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: devel, linux-kernel

On Wed, Oct 29, 2014 at 04:47:25PM +0800, Greg Kroah-Hartman wrote:
> On Wed, Oct 22, 2014 at 02:24:46PM +0530, Sudip Mukherjee wrote:
> > 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.

> > 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.

> What have you used to test this change?

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

thanks
sudip
> 
> thanks,
> 
> greg k-h

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-10-30  5:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-22  8:54 [PATCH] staging: rtl8192e: from bus specific dma api to dma api Sudip Mukherjee
2014-10-29  8:47 ` Greg Kroah-Hartman
2014-10-30  5:37   ` Sudip Mukherjee

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox