linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] gpu: host1x: Fix compiler errors by converting to dma_addr_t
@ 2018-05-16 10:22 Emil Goode
  2018-05-18  9:22 ` Thierry Reding
  0 siblings, 1 reply; 2+ messages in thread
From: Emil Goode @ 2018-05-16 10:22 UTC (permalink / raw)
  To: Thierry Reding
  Cc: Thierry Reding, dri-devel, linux-tegra, linux-kernel, kernel-janitors

The compiler is complaining with the following errors:

drivers/gpu/host1x/cdma.c:94:48: error:
	passing argument 3 of ‘dma_alloc_wc’ from incompatible pointer type
	[-Werror=incompatible-pointer-types]

drivers/gpu/host1x/cdma.c:113:48: error:
	passing argument 3 of ‘dma_alloc_wc’ from incompatible pointer type
	[-Werror=incompatible-pointer-types]

The expected pointer type of the third argument to dma_alloc_wc() is
dma_addr_t but phys_addr_t is passed.

Change the phys member of struct push_buffer to be dma_addr_t so that we
pass the correct type to dma_alloc_wc().
Also check pb->mapped for non-NULL in the destroy function as that is the
right way of checking if dma_alloc_wc() was successful.

Signed-off-by: Emil Goode <emil.fsw@goode.io>
---
v2: - Change the phys member type instead of adding casts.
    - Check pb->mapped in the destroy function as 0 is a valid value
      for dma_addr_t.

 drivers/gpu/host1x/cdma.c | 2 +-
 drivers/gpu/host1x/cdma.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/host1x/cdma.c b/drivers/gpu/host1x/cdma.c
index 28541b280739..02a0b61be18f 100644
--- a/drivers/gpu/host1x/cdma.c
+++ b/drivers/gpu/host1x/cdma.c
@@ -51,7 +51,7 @@ static void host1x_pushbuffer_destroy(struct push_buffer *pb)
 	struct host1x_cdma *cdma = pb_to_cdma(pb);
 	struct host1x *host1x = cdma_to_host1x(cdma);
 
-	if (!pb->phys)
+	if (!pb->mapped)
 		return;
 
 	if (host1x->domain) {
diff --git a/drivers/gpu/host1x/cdma.h b/drivers/gpu/host1x/cdma.h
index 286d49386be9..446ee1a84969 100644
--- a/drivers/gpu/host1x/cdma.h
+++ b/drivers/gpu/host1x/cdma.h
@@ -44,7 +44,7 @@ struct host1x_job;
 struct push_buffer {
 	void *mapped;			/* mapped pushbuffer memory */
 	dma_addr_t dma;			/* device address of pushbuffer */
-	phys_addr_t phys;		/* physical address of pushbuffer */
+	dma_addr_t phys;		/* physical address of pushbuffer */
 	u32 fence;			/* index we've written */
 	u32 pos;			/* index to write to */
 	u32 size;
-- 
2.11.0

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

* Re: [PATCH v2] gpu: host1x: Fix compiler errors by converting to dma_addr_t
  2018-05-16 10:22 [PATCH v2] gpu: host1x: Fix compiler errors by converting to dma_addr_t Emil Goode
@ 2018-05-18  9:22 ` Thierry Reding
  0 siblings, 0 replies; 2+ messages in thread
From: Thierry Reding @ 2018-05-18  9:22 UTC (permalink / raw)
  To: Emil Goode
  Cc: Thierry Reding, dri-devel, linux-tegra, linux-kernel, kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 1206 bytes --]

On Wed, May 16, 2018 at 12:22:04PM +0200, Emil Goode wrote:
> The compiler is complaining with the following errors:
> 
> drivers/gpu/host1x/cdma.c:94:48: error:
> 	passing argument 3 of ‘dma_alloc_wc’ from incompatible pointer type
> 	[-Werror=incompatible-pointer-types]
> 
> drivers/gpu/host1x/cdma.c:113:48: error:
> 	passing argument 3 of ‘dma_alloc_wc’ from incompatible pointer type
> 	[-Werror=incompatible-pointer-types]
> 
> The expected pointer type of the third argument to dma_alloc_wc() is
> dma_addr_t but phys_addr_t is passed.
> 
> Change the phys member of struct push_buffer to be dma_addr_t so that we
> pass the correct type to dma_alloc_wc().
> Also check pb->mapped for non-NULL in the destroy function as that is the
> right way of checking if dma_alloc_wc() was successful.
> 
> Signed-off-by: Emil Goode <emil.fsw@goode.io>
> ---
> v2: - Change the phys member type instead of adding casts.
>     - Check pb->mapped in the destroy function as 0 is a valid value
>       for dma_addr_t.
> 
>  drivers/gpu/host1x/cdma.c | 2 +-
>  drivers/gpu/host1x/cdma.h | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)

Applied, thanks.

Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2018-05-18  9:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-16 10:22 [PATCH v2] gpu: host1x: Fix compiler errors by converting to dma_addr_t Emil Goode
2018-05-18  9:22 ` Thierry Reding

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