Netdev List
 help / color / mirror / Atom feed
From: Francois Romieu <romieu@fr.zoreil.com>
To: Alexey Khoroshilov <khoroshilov@ispras.ru>
Cc: "David S. Miller" <davem@davemloft.net>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	ldv-project@linuxtesting.org
Subject: Re: [PATCH v3 net-next 2/2] wan: dscc4: convert to plain DMA API
Date: Fri, 11 Aug 2017 23:45:49 +0200	[thread overview]
Message-ID: <20170811214549.GA8187@electric-eye.fr.zoreil.com> (raw)
In-Reply-To: <1502405721-27738-2-git-send-email-khoroshilov@ispras.ru>

Alexey Khoroshilov <khoroshilov@ispras.ru> :
[...]
> diff --git a/drivers/net/wan/dscc4.c b/drivers/net/wan/dscc4.c
> index 8480dbf..a043fb1 100644
> --- a/drivers/net/wan/dscc4.c
> +++ b/drivers/net/wan/dscc4.c
[...]
> @@ -506,8 +506,9 @@ static void dscc4_release_ring(struct dscc4_dev_priv *dpriv)
>  	skbuff = dpriv->rx_skbuff;
>  	for (i = 0; i < RX_RING_SIZE; i++) {
>  		if (*skbuff) {
> -			pci_unmap_single(pdev, le32_to_cpu(rx_fd->data),
> -				RX_MAX(HDLC_MAX_MRU), PCI_DMA_FROMDEVICE);
> +			dma_unmap_single(d, le32_to_cpu(rx_fd->data),
> +					 RX_MAX(HDLC_MAX_MRU),
> +					 DMA_FROM_DEVICE);

					 RX_MAX(HDLC_MAX_MRU), DMA_FROM_DEVICE);

[...]
> @@ -664,8 +665,8 @@ static inline void dscc4_rx_skb(struct dscc4_dev_priv *dpriv,
>  		goto refill;
>  	}
>  	pkt_len = TO_SIZE(le32_to_cpu(rx_fd->state2));
> -	pci_unmap_single(pdev, le32_to_cpu(rx_fd->data),
> -			 RX_MAX(HDLC_MAX_MRU), PCI_DMA_FROMDEVICE);
> +	dma_unmap_single(d, le32_to_cpu(rx_fd->data),
> +			 RX_MAX(HDLC_MAX_MRU), DMA_FROM_DEVICE);

	dma_unmap_single(d, le32_to_cpu(rx_fd->data), RX_MAX(HDLC_MAX_MRU),
			 DMA_FROM_DEVICE);

[...]
> @@ -782,8 +783,8 @@ static int dscc4_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
>  
>  	rc = -ENOMEM;
>  
> -	priv->iqcfg = (__le32 *) pci_alloc_consistent(pdev,
> -		IRQ_RING_SIZE*sizeof(__le32), &priv->iqcfg_dma);
> +	priv->iqcfg = (__le32 *)dma_alloc_coherent(&pdev->dev,
> +		IRQ_RING_SIZE*sizeof(__le32), &priv->iqcfg_dma, GFP_KERNEL);

- the cast can go away
- please replace &pdev->dev with a local variable

	priv->iqcfg = dma_alloc_coherent(d, IRQ_RING_SIZE*sizeof(__le32),
					 &priv->iqcfg_dma, GFP_KERNEL);

Same thing for iqtx and iqrx (beware of copy&paste + tx/rx mismatch).

Thanks.

-- 
Ueimor

  parent reply	other threads:[~2017-08-11 21:45 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-04 20:23 [PATCH] wan: dscc4: add checks for dma mapping errors Alexey Khoroshilov
2017-08-07 21:06 ` David Miller
2017-08-07 21:59 ` Francois Romieu
2017-08-08 19:28   ` [PATCH net-next v2] " Alexey Khoroshilov
2017-08-08 23:21     ` Francois Romieu
2017-08-10 22:55       ` [PATCH v3 net-next 1/2] " Alexey Khoroshilov
2017-08-10 22:55         ` [PATCH v3 net-next 2/2] wan: dscc4: convert to plain DMA API Alexey Khoroshilov
2017-08-11 21:42           ` David Miller
2017-08-11 21:45           ` Francois Romieu [this message]
2017-08-11 21:49             ` David Miller
2017-08-11 23:32               ` Francois Romieu
2017-08-11 21:42         ` [PATCH v3 net-next 1/2] wan: dscc4: add checks for dma mapping errors David Miller
2017-08-09 10:45     ` [PATCH net-next v2] " Andy Shevchenko

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=20170811214549.GA8187@electric-eye.fr.zoreil.com \
    --to=romieu@fr.zoreil.com \
    --cc=davem@davemloft.net \
    --cc=khoroshilov@ispras.ru \
    --cc=ldv-project@linuxtesting.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox