linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] [net-next] net: netsec: use dma_addr_t for storing dma address
@ 2018-01-13 21:13 Arnd Bergmann
  2018-01-13 21:32 ` Ard Biesheuvel
  2018-01-14 17:00 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Arnd Bergmann @ 2018-01-13 21:13 UTC (permalink / raw)
  To: Jassi Brar
  Cc: Arnd Bergmann, David S. Miller, Ard Biesheuvel, Wei Yongjun,
	netdev, linux-kernel

On targets that have different sizes for phys_addr_t and dma_addr_t,
we get a type mismatch error:

drivers/net/ethernet/socionext/netsec.c: In function 'netsec_alloc_dring':
drivers/net/ethernet/socionext/netsec.c:970:9: error: passing argument 3 of 'dma_zalloc_coherent' from incompatible pointer type [-Werror=incompatible-pointer-types]

The code is otherwise correct, as the address is never actually used as a
physical address but only passed into a DMA register.  For consistently,
I'm changing the variable name as well, to clarify that this is a DMA
address.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/net/ethernet/socionext/netsec.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/socionext/netsec.c b/drivers/net/ethernet/socionext/netsec.c
index 6c263af86b8a..f4c0b02ddad8 100644
--- a/drivers/net/ethernet/socionext/netsec.c
+++ b/drivers/net/ethernet/socionext/netsec.c
@@ -252,7 +252,7 @@ struct netsec_desc {
 };
 
 struct netsec_desc_ring {
-	phys_addr_t desc_phys;
+	dma_addr_t desc_dma;
 	struct netsec_desc *desc;
 	void *vaddr;
 	u16 pkt_cnt;
@@ -953,7 +953,7 @@ static void netsec_free_dring(struct netsec_priv *priv, int id)
 
 	if (dring->vaddr) {
 		dma_free_coherent(priv->dev, DESC_SZ * DESC_NUM,
-				  dring->vaddr, dring->desc_phys);
+				  dring->vaddr, dring->desc_dma);
 		dring->vaddr = NULL;
 	}
 
@@ -967,7 +967,7 @@ static int netsec_alloc_dring(struct netsec_priv *priv, enum ring_id id)
 	int ret = 0;
 
 	dring->vaddr = dma_zalloc_coherent(priv->dev, DESC_SZ * DESC_NUM,
-					   &dring->desc_phys, GFP_KERNEL);
+					   &dring->desc_dma, GFP_KERNEL);
 	if (!dring->vaddr) {
 		ret = -ENOMEM;
 		goto err;
@@ -1087,14 +1087,14 @@ static int netsec_reset_hardware(struct netsec_priv *priv)
 
 	/* set desc_start addr */
 	netsec_write(priv, NETSEC_REG_NRM_RX_DESC_START_UP,
-		     upper_32_bits(priv->desc_ring[NETSEC_RING_RX].desc_phys));
+		     upper_32_bits(priv->desc_ring[NETSEC_RING_RX].desc_dma));
 	netsec_write(priv, NETSEC_REG_NRM_RX_DESC_START_LW,
-		     lower_32_bits(priv->desc_ring[NETSEC_RING_RX].desc_phys));
+		     lower_32_bits(priv->desc_ring[NETSEC_RING_RX].desc_dma));
 
 	netsec_write(priv, NETSEC_REG_NRM_TX_DESC_START_UP,
-		     upper_32_bits(priv->desc_ring[NETSEC_RING_TX].desc_phys));
+		     upper_32_bits(priv->desc_ring[NETSEC_RING_TX].desc_dma));
 	netsec_write(priv, NETSEC_REG_NRM_TX_DESC_START_LW,
-		     lower_32_bits(priv->desc_ring[NETSEC_RING_TX].desc_phys));
+		     lower_32_bits(priv->desc_ring[NETSEC_RING_TX].desc_dma));
 
 	/* set normal tx dring ring config */
 	netsec_write(priv, NETSEC_REG_NRM_TX_CONFIG,
-- 
2.9.0

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

* Re: [PATCH] [net-next] net: netsec: use dma_addr_t for storing dma address
  2018-01-13 21:13 [PATCH] [net-next] net: netsec: use dma_addr_t for storing dma address Arnd Bergmann
@ 2018-01-13 21:32 ` Ard Biesheuvel
  2018-01-14 17:00 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Ard Biesheuvel @ 2018-01-13 21:32 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Jassi Brar, David S. Miller, Wei Yongjun,
	<netdev@vger.kernel.org>,
	Linux Kernel Mailing List

On 13 January 2018 at 21:13, Arnd Bergmann <arnd@arndb.de> wrote:
> On targets that have different sizes for phys_addr_t and dma_addr_t,
> we get a type mismatch error:
>
> drivers/net/ethernet/socionext/netsec.c: In function 'netsec_alloc_dring':
> drivers/net/ethernet/socionext/netsec.c:970:9: error: passing argument 3 of 'dma_zalloc_coherent' from incompatible pointer type [-Werror=incompatible-pointer-types]
>
> The code is otherwise correct, as the address is never actually used as a
> physical address but only passed into a DMA register.  For consistently,

consistency

> I'm changing the variable name as well, to clarify that this is a DMA
> address.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

> ---
>  drivers/net/ethernet/socionext/netsec.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/net/ethernet/socionext/netsec.c b/drivers/net/ethernet/socionext/netsec.c
> index 6c263af86b8a..f4c0b02ddad8 100644
> --- a/drivers/net/ethernet/socionext/netsec.c
> +++ b/drivers/net/ethernet/socionext/netsec.c
> @@ -252,7 +252,7 @@ struct netsec_desc {
>  };
>
>  struct netsec_desc_ring {
> -       phys_addr_t desc_phys;
> +       dma_addr_t desc_dma;
>         struct netsec_desc *desc;
>         void *vaddr;
>         u16 pkt_cnt;
> @@ -953,7 +953,7 @@ static void netsec_free_dring(struct netsec_priv *priv, int id)
>
>         if (dring->vaddr) {
>                 dma_free_coherent(priv->dev, DESC_SZ * DESC_NUM,
> -                                 dring->vaddr, dring->desc_phys);
> +                                 dring->vaddr, dring->desc_dma);
>                 dring->vaddr = NULL;
>         }
>
> @@ -967,7 +967,7 @@ static int netsec_alloc_dring(struct netsec_priv *priv, enum ring_id id)
>         int ret = 0;
>
>         dring->vaddr = dma_zalloc_coherent(priv->dev, DESC_SZ * DESC_NUM,
> -                                          &dring->desc_phys, GFP_KERNEL);
> +                                          &dring->desc_dma, GFP_KERNEL);
>         if (!dring->vaddr) {
>                 ret = -ENOMEM;
>                 goto err;
> @@ -1087,14 +1087,14 @@ static int netsec_reset_hardware(struct netsec_priv *priv)
>
>         /* set desc_start addr */
>         netsec_write(priv, NETSEC_REG_NRM_RX_DESC_START_UP,
> -                    upper_32_bits(priv->desc_ring[NETSEC_RING_RX].desc_phys));
> +                    upper_32_bits(priv->desc_ring[NETSEC_RING_RX].desc_dma));
>         netsec_write(priv, NETSEC_REG_NRM_RX_DESC_START_LW,
> -                    lower_32_bits(priv->desc_ring[NETSEC_RING_RX].desc_phys));
> +                    lower_32_bits(priv->desc_ring[NETSEC_RING_RX].desc_dma));
>
>         netsec_write(priv, NETSEC_REG_NRM_TX_DESC_START_UP,
> -                    upper_32_bits(priv->desc_ring[NETSEC_RING_TX].desc_phys));
> +                    upper_32_bits(priv->desc_ring[NETSEC_RING_TX].desc_dma));
>         netsec_write(priv, NETSEC_REG_NRM_TX_DESC_START_LW,
> -                    lower_32_bits(priv->desc_ring[NETSEC_RING_TX].desc_phys));
> +                    lower_32_bits(priv->desc_ring[NETSEC_RING_TX].desc_dma));
>
>         /* set normal tx dring ring config */
>         netsec_write(priv, NETSEC_REG_NRM_TX_CONFIG,
> --
> 2.9.0
>

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

* Re: [PATCH] [net-next] net: netsec: use dma_addr_t for storing dma address
  2018-01-13 21:13 [PATCH] [net-next] net: netsec: use dma_addr_t for storing dma address Arnd Bergmann
  2018-01-13 21:32 ` Ard Biesheuvel
@ 2018-01-14 17:00 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2018-01-14 17:00 UTC (permalink / raw)
  To: arnd; +Cc: jaswinder.singh, ard.biesheuvel, weiyongjun1, netdev, linux-kernel

From: Arnd Bergmann <arnd@arndb.de>
Date: Sat, 13 Jan 2018 22:13:44 +0100

> On targets that have different sizes for phys_addr_t and dma_addr_t,
> we get a type mismatch error:
> 
> drivers/net/ethernet/socionext/netsec.c: In function 'netsec_alloc_dring':
> drivers/net/ethernet/socionext/netsec.c:970:9: error: passing argument 3 of 'dma_zalloc_coherent' from incompatible pointer type [-Werror=incompatible-pointer-types]
> 
> The code is otherwise correct, as the address is never actually used as a
> physical address but only passed into a DMA register.  For consistently,
> I'm changing the variable name as well, to clarify that this is a DMA
> address.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Applied, thanks Arnd.

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

end of thread, other threads:[~2018-01-14 17:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-13 21:13 [PATCH] [net-next] net: netsec: use dma_addr_t for storing dma address Arnd Bergmann
2018-01-13 21:32 ` Ard Biesheuvel
2018-01-14 17:00 ` David Miller

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