linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Nadim Almas <nadim.902@gmail.com>
Cc: bhumirks@gmail.com, devel@driverdev.osuosl.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Staging: used dma_map_single in place of pci_map_single
Date: Thu, 10 Nov 2016 13:55:35 +0100	[thread overview]
Message-ID: <20161110125535.GA23437@kroah.com> (raw)
In-Reply-To: <20161107212208.GA5673@gmail.com>

On Tue, Nov 08, 2016 at 02:52:08AM +0530, Nadim Almas wrote:
> pci_map_single is unneeded and can be replaced with dma_map_single
> to avoid inconcitent api usage.
> The Coccinelle semantic patch used to make this change is as follows:
> @@ expression E1,E2,E3; @@
> - pci_map_single(E1,
> + dma_map_single(&E1->dev,
>      E2, E3,
> (
> - PCI_DMA_BIDIRECTIONAL
> + DMA_BIDIRCTIONAL
> |
> - PCI_DMA_TODEVICE
> + DMA_TO_DEVICE
> |
> - PCI_DMA_FROMDEVICE
> + DMA_FROM_DEVICE
> |
> - PCI_DMA_NONE
> + DMA_NONE_DEVICE
> )
>   )
> Signed-off-by: Nadim Almas <nadim.902@gmail.com>
> ---
>  drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 10 ++++++----
>  drivers/staging/rtl8192e/rtl8192e/rtl_core.c   | 12 ++++++------
>  drivers/staging/slicoss/slicoss.c              | 12 ++++++------
>  3 files changed, 18 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c
> index 8d6bca6..a3c8c3a 100644
> --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c
> +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c
> @@ -1184,8 +1184,9 @@ void  rtl92e_fill_tx_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;
>  
>  	pTxFwInfo = (struct tx_fwinfo_8190pci *)skb->data;
> @@ -1292,8 +1293,9 @@ void  rtl92e_fill_tx_cmd_desc(struct net_device *dev, struct tx_desc_cmd *entry,
>  			      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);
>  
>  	if (pci_dma_mapping_error(priv->pdev, mapping))
>  		netdev_err(dev, "%s(): DMA Mapping error\n", __func__);
> diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
> index f985d88..ddd6523 100644
> --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
> +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
> @@ -1826,10 +1826,10 @@ static short _rtl92e_alloc_rx_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);
> +						  DMA_FROM_DEVICE);
>  			if (pci_dma_mapping_error(priv->pdev, *mapping)) {
>  				dev_kfree_skb_any(skb);
>  				return -1;
> @@ -2104,10 +2104,10 @@ static void _rtl92e_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);
> +		*((dma_addr_t *) skb->cb) = dma_map_single(&priv->pdev->dev,
> +						skb_tail_pointer_rsl(skb),
> +							   priv->rxbuffersize,
> +							   DMA_FROM_DEVICE);
>  		if (pci_dma_mapping_error(priv->pdev,
>  					  *((dma_addr_t *)skb->cb))) {
>  			dev_kfree_skb_any(skb);
> diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c
> index 062307a..2d76bfd 100644
> --- a/drivers/staging/slicoss/slicoss.c
> +++ b/drivers/staging/slicoss/slicoss.c
> @@ -1452,10 +1452,10 @@ static int slic_rcvqueue_fill(struct adapter *adapter)
>  		skb = alloc_skb(SLIC_RCVQ_RCVBUFSIZE, GFP_ATOMIC);
>  		if (skb) {
>  			paddr = (void *)(unsigned long)
> -				pci_map_single(adapter->pcidev,
> +				dma_map_single(&adapter->pcidev->dev,
> 								skb->data,
>  					       SLIC_RCVQ_RCVBUFSIZE,
> -					       PCI_DMA_FROMDEVICE);
> +					       DMA_FROM_DEVICE);
>  			paddrl = SLIC_GET_ADDR_LOW(paddr);
>  			paddrh = SLIC_GET_ADDR_HIGH(paddr);
>  
> @@ -1608,8 +1608,8 @@ static u32 slic_rcvqueue_reinsert(struct adapter *adapter, struct sk_buff *skb)
>  	struct device *dev;
>  
>  	paddr = (void *)(unsigned long)
> -		pci_map_single(adapter->pcidev, skb->head,
> -			       SLIC_RCVQ_RCVBUFSIZE, PCI_DMA_FROMDEVICE);
> +		dma_map_single(&adapter->pcidev->dev, skb->head,
> +			       SLIC_RCVQ_RCVBUFSIZE, DMA_FROM_DEVICE);
>  	rcvbuf->status = 0;
>  	skb->next = NULL;
>  
> @@ -1774,8 +1774,8 @@ static void slic_xmit_build_request(struct adapter *adapter,
>  	ihcmd->flags = adapter->port << IHFLG_IFSHFT;
>  	ihcmd->command = IHCMD_XMT_REQ;
>  	ihcmd->u.slic_buffers.totlen = skb->len;
> -	phys_addr = pci_map_single(adapter->pcidev, skb->data, skb->len,
> -			PCI_DMA_TODEVICE);
> +	phys_addr = dma_map_single(&adapter->pcidev->dev, skb->data, skb->len,
> +				   DMA_TO_DEVICE);
>  	if (pci_dma_mapping_error(adapter->pcidev, phys_addr)) {
>  		kfree_skb(skb);
>  		dev_err(&adapter->pcidev->dev, "DMA mapping error\n");

This patch does not apply to my staging-testing branch :(

Please fix up and resend, preferably one patch per driver.

thanks,

greg k-h

      reply	other threads:[~2016-11-10 12:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-07 21:22 [PATCH] Staging: used dma_map_single in place of pci_map_single Nadim Almas
2016-11-10 12:55 ` Greg KH [this message]

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=20161110125535.GA23437@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=bhumirks@gmail.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nadim.902@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).