public inbox for dmaengine@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dmaengine: ti: k3-udma: fix -Wenum-conversion warning
@ 2020-10-26 16:01 Arnd Bergmann
  2020-10-27  7:02 ` Peter Ujfalusi
  2020-10-28  5:52 ` Vinod Koul
  0 siblings, 2 replies; 3+ messages in thread
From: Arnd Bergmann @ 2020-10-26 16:01 UTC (permalink / raw)
  To: Vinod Koul, Peter Ujfalusi, Grygorii Strashko
  Cc: Arnd Bergmann, Dan Williams, Yu Kuai, dmaengine, linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

gcc warns about a mismatch argument type when passing
'false' into a function that expects an enum:

drivers/dma/ti/k3-udma-private.c: In function 'xudma_tchan_get':
drivers/dma/ti/k3-udma-private.c:86:34: warning: implicit conversion from 'enum <anonymous>' to 'enum udma_tp_level' [-Wenum-conversion]
  86 |  return __udma_reserve_##res(ud, false, id);   \
     |                                  ^~~~~
drivers/dma/ti/k3-udma-private.c:95:1: note: in expansion of macro 'XUDMA_GET_PUT_RESOURCE'
   95 | XUDMA_GET_PUT_RESOURCE(tchan);
      | ^~~~~~~~~~~~~~~~~~~~~~

In this case, false has the same numerical value as
UDMA_TP_NORMAL, so passing that is most likely the correct
way to avoid the warning without changing the behavior.

Fixes: d70241913413 ("dmaengine: ti: k3-udma: Add glue layer for non DMAengine users")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/dma/ti/k3-udma-private.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/dma/ti/k3-udma-private.c b/drivers/dma/ti/k3-udma-private.c
index aa24e554f7b4..8563a392f30b 100644
--- a/drivers/dma/ti/k3-udma-private.c
+++ b/drivers/dma/ti/k3-udma-private.c
@@ -83,7 +83,7 @@ EXPORT_SYMBOL(xudma_rflow_is_gp);
 #define XUDMA_GET_PUT_RESOURCE(res)					\
 struct udma_##res *xudma_##res##_get(struct udma_dev *ud, int id)	\
 {									\
-	return __udma_reserve_##res(ud, false, id);			\
+	return __udma_reserve_##res(ud, UDMA_TP_NORMAL, id);		\
 }									\
 EXPORT_SYMBOL(xudma_##res##_get);					\
 									\
-- 
2.27.0


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

* Re: [PATCH] dmaengine: ti: k3-udma: fix -Wenum-conversion warning
  2020-10-26 16:01 [PATCH] dmaengine: ti: k3-udma: fix -Wenum-conversion warning Arnd Bergmann
@ 2020-10-27  7:02 ` Peter Ujfalusi
  2020-10-28  5:52 ` Vinod Koul
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Ujfalusi @ 2020-10-27  7:02 UTC (permalink / raw)
  To: Arnd Bergmann, Vinod Koul, Grygorii Strashko
  Cc: Arnd Bergmann, Dan Williams, Yu Kuai, dmaengine, linux-kernel



On 26/10/2020 18.01, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> gcc warns about a mismatch argument type when passing
> 'false' into a function that expects an enum:

Strange enough, but my gcc does not warn me (Gentoo 10.2.0-r2 p3).

> drivers/dma/ti/k3-udma-private.c: In function 'xudma_tchan_get':
> drivers/dma/ti/k3-udma-private.c:86:34: warning: implicit conversion from 'enum <anonymous>' to 'enum udma_tp_level' [-Wenum-conversion]
>   86 |  return __udma_reserve_##res(ud, false, id);   \
>      |                                  ^~~~~
> drivers/dma/ti/k3-udma-private.c:95:1: note: in expansion of macro 'XUDMA_GET_PUT_RESOURCE'
>    95 | XUDMA_GET_PUT_RESOURCE(tchan);
>       | ^~~~~~~~~~~~~~~~~~~~~~

But this is valid. The Throughput Levels got expanded with j721e from 2
to three and I failed to update this.

> In this case, false has the same numerical value as
> UDMA_TP_NORMAL, so passing that is most likely the correct
> way to avoid the warning without changing the behavior.

Yes, that's correct, thanks for fixing it!

Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com>

> Fixes: d70241913413 ("dmaengine: ti: k3-udma: Add glue layer for non DMAengine users")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  drivers/dma/ti/k3-udma-private.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/dma/ti/k3-udma-private.c b/drivers/dma/ti/k3-udma-private.c
> index aa24e554f7b4..8563a392f30b 100644
> --- a/drivers/dma/ti/k3-udma-private.c
> +++ b/drivers/dma/ti/k3-udma-private.c
> @@ -83,7 +83,7 @@ EXPORT_SYMBOL(xudma_rflow_is_gp);
>  #define XUDMA_GET_PUT_RESOURCE(res)					\
>  struct udma_##res *xudma_##res##_get(struct udma_dev *ud, int id)	\
>  {									\
> -	return __udma_reserve_##res(ud, false, id);			\
> +	return __udma_reserve_##res(ud, UDMA_TP_NORMAL, id);		\
>  }									\
>  EXPORT_SYMBOL(xudma_##res##_get);					\
>  									\
> 

- Péter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

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

* Re: [PATCH] dmaengine: ti: k3-udma: fix -Wenum-conversion warning
  2020-10-26 16:01 [PATCH] dmaengine: ti: k3-udma: fix -Wenum-conversion warning Arnd Bergmann
  2020-10-27  7:02 ` Peter Ujfalusi
@ 2020-10-28  5:52 ` Vinod Koul
  1 sibling, 0 replies; 3+ messages in thread
From: Vinod Koul @ 2020-10-28  5:52 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Peter Ujfalusi, Grygorii Strashko, Arnd Bergmann, Dan Williams,
	Yu Kuai, dmaengine, linux-kernel

On 26-10-20, 17:01, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> gcc warns about a mismatch argument type when passing
> 'false' into a function that expects an enum:
> 
> drivers/dma/ti/k3-udma-private.c: In function 'xudma_tchan_get':
> drivers/dma/ti/k3-udma-private.c:86:34: warning: implicit conversion from 'enum <anonymous>' to 'enum udma_tp_level' [-Wenum-conversion]
>   86 |  return __udma_reserve_##res(ud, false, id);   \
>      |                                  ^~~~~
> drivers/dma/ti/k3-udma-private.c:95:1: note: in expansion of macro 'XUDMA_GET_PUT_RESOURCE'
>    95 | XUDMA_GET_PUT_RESOURCE(tchan);
>       | ^~~~~~~~~~~~~~~~~~~~~~
> 
> In this case, false has the same numerical value as
> UDMA_TP_NORMAL, so passing that is most likely the correct
> way to avoid the warning without changing the behavior.

Applied, thanks

-- 
~Vinod

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

end of thread, other threads:[~2020-10-28 22:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-26 16:01 [PATCH] dmaengine: ti: k3-udma: fix -Wenum-conversion warning Arnd Bergmann
2020-10-27  7:02 ` Peter Ujfalusi
2020-10-28  5:52 ` Vinod Koul

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox