Linux-Amlogic Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] drm: meson: fix address type confusion
@ 2020-01-07 21:46 Arnd Bergmann
  2020-01-08  8:32 ` Neil Armstrong
  0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2020-01-07 21:46 UTC (permalink / raw)
  To: Neil Armstrong, David Airlie, Daniel Vetter, Kevin Hilman
  Cc: Julien Masson, Maxime Jourdan, Arnd Bergmann, linux-kernel,
	dri-devel, linux-amlogic, Sam Ravnborg, linux-arm-kernel

Casting a pointer to dma_addr_t produces a warning:

drivers/gpu/drm/meson/meson_rdma.c: In function 'meson_rdma_free':
drivers/gpu/drm/meson/meson_rdma.c:59:25: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
  priv->rdma.addr_phys = (dma_addr_t)NULL;

In this case, it's worse because the variable name has the suffix
'_phys', which often indicates a phys_addr_t rather than dma_addr_t,
i.e. yet another incompatible type.

Change it to use consistent naming and avoid NULL.

Fixes: 63fba242c464 ("drm/meson: add RDMA module driver")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/gpu/drm/meson/meson_drv.h  |  2 +-
 drivers/gpu/drm/meson/meson_rdma.c | 12 ++++++------
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/meson/meson_drv.h b/drivers/gpu/drm/meson/meson_drv.h
index f9a0c8e9d4d0..04fdf3826643 100644
--- a/drivers/gpu/drm/meson/meson_drv.h
+++ b/drivers/gpu/drm/meson/meson_drv.h
@@ -135,7 +135,7 @@ struct meson_drm {
 	} venc;
 
 	struct {
-		dma_addr_t addr_phys;
+		dma_addr_t addr_dma;
 		uint32_t *addr;
 		unsigned int offset;
 	} rdma;
diff --git a/drivers/gpu/drm/meson/meson_rdma.c b/drivers/gpu/drm/meson/meson_rdma.c
index 25b34b1e72a7..130382178c63 100644
--- a/drivers/gpu/drm/meson/meson_rdma.c
+++ b/drivers/gpu/drm/meson/meson_rdma.c
@@ -27,7 +27,7 @@ int meson_rdma_init(struct meson_drm *priv)
 		/* Allocate a PAGE buffer */
 		priv->rdma.addr =
 			dma_alloc_coherent(priv->dev, SZ_4K,
-					   &priv->rdma.addr_phys,
+					   &priv->rdma.addr_dma,
 					   GFP_KERNEL);
 		if (!priv->rdma.addr)
 			return -ENOMEM;
@@ -47,16 +47,16 @@ int meson_rdma_init(struct meson_drm *priv)
 
 void meson_rdma_free(struct meson_drm *priv)
 {
-	if (!priv->rdma.addr && !priv->rdma.addr_phys)
+	if (!priv->rdma.addr && !priv->rdma.addr_dma)
 		return;
 
 	meson_rdma_stop(priv);
 
 	dma_free_coherent(priv->dev, SZ_4K,
-			  priv->rdma.addr, priv->rdma.addr_phys);
+			  priv->rdma.addr, priv->rdma.addr_dma);
 
 	priv->rdma.addr = NULL;
-	priv->rdma.addr_phys = (dma_addr_t)NULL;
+	priv->rdma.addr_dma = (dma_addr_t)0;
 }
 
 void meson_rdma_setup(struct meson_drm *priv)
@@ -118,11 +118,11 @@ void meson_rdma_flush(struct meson_drm *priv)
 	meson_rdma_stop(priv);
 
 	/* Start of Channel 1 register writes buffer */
-	writel(priv->rdma.addr_phys,
+	writel(priv->rdma.addr_dma,
 	       priv->io_base + _REG(RDMA_AHB_START_ADDR_1));
 
 	/* Last byte on Channel 1 register writes buffer */
-	writel(priv->rdma.addr_phys + (priv->rdma.offset * RDMA_DESC_SIZE) - 1,
+	writel(priv->rdma.addr_dma + (priv->rdma.offset * RDMA_DESC_SIZE) - 1,
 	       priv->io_base + _REG(RDMA_AHB_END_ADDR_1));
 
 	/* Trigger Channel 1 on VSYNC event */
-- 
2.20.0


_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* Re: [PATCH] drm: meson: fix address type confusion
  2020-01-07 21:46 [PATCH] drm: meson: fix address type confusion Arnd Bergmann
@ 2020-01-08  8:32 ` Neil Armstrong
  0 siblings, 0 replies; 2+ messages in thread
From: Neil Armstrong @ 2020-01-08  8:32 UTC (permalink / raw)
  To: Arnd Bergmann, David Airlie, Daniel Vetter, Kevin Hilman
  Cc: Julien Masson, Maxime Jourdan, linux-kernel, dri-devel,
	linux-amlogic, Sam Ravnborg, linux-arm-kernel

On 07/01/2020 22:46, Arnd Bergmann wrote:
> Casting a pointer to dma_addr_t produces a warning:
> 
> drivers/gpu/drm/meson/meson_rdma.c: In function 'meson_rdma_free':
> drivers/gpu/drm/meson/meson_rdma.c:59:25: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
>   priv->rdma.addr_phys = (dma_addr_t)NULL;
> 
> In this case, it's worse because the variable name has the suffix
> '_phys', which often indicates a phys_addr_t rather than dma_addr_t,
> i.e. yet another incompatible type.
> 
> Change it to use consistent naming and avoid NULL.
> 
> Fixes: 63fba242c464 ("drm/meson: add RDMA module driver")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  drivers/gpu/drm/meson/meson_drv.h  |  2 +-
>  drivers/gpu/drm/meson/meson_rdma.c | 12 ++++++------
>  2 files changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/meson/meson_drv.h b/drivers/gpu/drm/meson/meson_drv.h
> index f9a0c8e9d4d0..04fdf3826643 100644
> --- a/drivers/gpu/drm/meson/meson_drv.h
> +++ b/drivers/gpu/drm/meson/meson_drv.h
> @@ -135,7 +135,7 @@ struct meson_drm {
>  	} venc;
>  
>  	struct {
> -		dma_addr_t addr_phys;
> +		dma_addr_t addr_dma;
>  		uint32_t *addr;
>  		unsigned int offset;
>  	} rdma;
> diff --git a/drivers/gpu/drm/meson/meson_rdma.c b/drivers/gpu/drm/meson/meson_rdma.c
> index 25b34b1e72a7..130382178c63 100644
> --- a/drivers/gpu/drm/meson/meson_rdma.c
> +++ b/drivers/gpu/drm/meson/meson_rdma.c
> @@ -27,7 +27,7 @@ int meson_rdma_init(struct meson_drm *priv)
>  		/* Allocate a PAGE buffer */
>  		priv->rdma.addr =
>  			dma_alloc_coherent(priv->dev, SZ_4K,
> -					   &priv->rdma.addr_phys,
> +					   &priv->rdma.addr_dma,
>  					   GFP_KERNEL);
>  		if (!priv->rdma.addr)
>  			return -ENOMEM;
> @@ -47,16 +47,16 @@ int meson_rdma_init(struct meson_drm *priv)
>  
>  void meson_rdma_free(struct meson_drm *priv)
>  {
> -	if (!priv->rdma.addr && !priv->rdma.addr_phys)
> +	if (!priv->rdma.addr && !priv->rdma.addr_dma)
>  		return;
>  
>  	meson_rdma_stop(priv);
>  
>  	dma_free_coherent(priv->dev, SZ_4K,
> -			  priv->rdma.addr, priv->rdma.addr_phys);
> +			  priv->rdma.addr, priv->rdma.addr_dma);
>  
>  	priv->rdma.addr = NULL;
> -	priv->rdma.addr_phys = (dma_addr_t)NULL;
> +	priv->rdma.addr_dma = (dma_addr_t)0;
>  }
>  
>  void meson_rdma_setup(struct meson_drm *priv)
> @@ -118,11 +118,11 @@ void meson_rdma_flush(struct meson_drm *priv)
>  	meson_rdma_stop(priv);
>  
>  	/* Start of Channel 1 register writes buffer */
> -	writel(priv->rdma.addr_phys,
> +	writel(priv->rdma.addr_dma,
>  	       priv->io_base + _REG(RDMA_AHB_START_ADDR_1));
>  
>  	/* Last byte on Channel 1 register writes buffer */
> -	writel(priv->rdma.addr_phys + (priv->rdma.offset * RDMA_DESC_SIZE) - 1,
> +	writel(priv->rdma.addr_dma + (priv->rdma.offset * RDMA_DESC_SIZE) - 1,
>  	       priv->io_base + _REG(RDMA_AHB_END_ADDR_1));
>  
>  	/* Trigger Channel 1 on VSYNC event */
> 

Acked-by: Neil Armstrong <narmstrong@baylibre.com>

Applying to drm-misc-fixes

Thanks,
Neil

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-07 21:46 [PATCH] drm: meson: fix address type confusion Arnd Bergmann
2020-01-08  8:32 ` Neil Armstrong

Linux-Amlogic Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-amlogic/0 linux-amlogic/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-amlogic linux-amlogic/ https://lore.kernel.org/linux-amlogic \
		linux-amlogic@lists.infradead.org
	public-inbox-index linux-amlogic

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.infradead.lists.linux-amlogic


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git