Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1709987

Re: [PATCH v3 net-next 2/2] wan: dscc4: convert to plain DMA API

From Francois Romieu <romieu@fr.zoreil.com>
Newsgroups linux.kernel
Subject Re: [PATCH v3 net-next 2/2] wan: dscc4: convert to plain DMA API
Date 2017-08-11 23:50 +0200
Message-ID <udpYB-i2-7@gated-at.bofh.it> (permalink)
References <ud4AO-3Hh-11@gated-at.bofh.it> <ud4AP-3Hh-27@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] wan: dscc4: add checks for dma mapping errors Alexey Khoroshilov <khoroshilov@ispras.ru> - 2017-08-04 22:30 +0200
  Re: [PATCH] wan: dscc4: add checks for dma mapping errors David Miller <davem@davemloft.net> - 2017-08-07 23:10 +0200
  Re: [PATCH] wan: dscc4: add checks for dma mapping errors Francois Romieu <romieu@fr.zoreil.com> - 2017-08-08 00:10 +0200
    [PATCH net-next v2] wan: dscc4: add checks for dma mapping errors Alexey Khoroshilov <khoroshilov@ispras.ru> - 2017-08-08 21:30 +0200
      Re: [PATCH net-next v2] wan: dscc4: add checks for dma mapping errors Francois Romieu <romieu@fr.zoreil.com> - 2017-08-09 01:30 +0200
        [PATCH v3 net-next 1/2] wan: dscc4: add checks for dma mapping errors Alexey Khoroshilov <khoroshilov@ispras.ru> - 2017-08-11 01:00 +0200
          [PATCH v3 net-next 2/2] wan: dscc4: convert to plain DMA API Alexey Khoroshilov <khoroshilov@ispras.ru> - 2017-08-11 01:00 +0200
            Re: [PATCH v3 net-next 2/2] wan: dscc4: convert to plain DMA API David Miller <davem@davemloft.net> - 2017-08-11 23:50 +0200
            Re: [PATCH v3 net-next 2/2] wan: dscc4: convert to plain DMA API Francois Romieu <romieu@fr.zoreil.com> - 2017-08-11 23:50 +0200
              Re: [PATCH v3 net-next 2/2] wan: dscc4: convert to plain DMA API David Miller <davem@davemloft.net> - 2017-08-11 23:50 +0200
                Re: [PATCH v3 net-next 2/2] wan: dscc4: convert to plain DMA API Francois Romieu <romieu@fr.zoreil.com> - 2017-08-12 01:40 +0200
          Re: [PATCH v3 net-next 1/2] wan: dscc4: add checks for dma mapping  errors David Miller <davem@davemloft.net> - 2017-08-11 23:50 +0200
      Re: [PATCH net-next v2] wan: dscc4: add checks for dma mapping errors Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-08-09 12:50 +0200

csiph-web