linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] dmaengine: apple-admac: Fix build on 32-bit/non-LPAE platforms
@ 2022-06-14  7:49 Geert Uytterhoeven
  2022-06-15 12:07 ` Martin Povišer
  2022-06-16 13:44 ` Vinod Koul
  0 siblings, 2 replies; 3+ messages in thread
From: Geert Uytterhoeven @ 2022-06-14  7:49 UTC (permalink / raw)
  To: Hector Martin, Sven Peter, Alyssa Rosenzweig, Vinod Koul,
	Martin Povišer
  Cc: linux-arm-kernel, dmaengine, linux-kernel, Geert Uytterhoeven

If CONFIG_PHYS_ADDR_T_64BIT is not set:

    drivers/dma/apple-admac.c: In function ‘admac_cyclic_write_one_desc’:
    drivers/dma/apple-admac.c:213:22: error: right shift count >= width of type [-Werror=shift-count-overflow]
      213 |  writel_relaxed(addr >> 32,       ad->base + REG_DESC_WRITE(channo));
          |                      ^~

Fix this by using the {low,upp}er_32_bits() helper macros to obtain the
address parts.

Reported-by: noreply@ellerman.id.au
Fixes: b127315d9a78c011 ("dmaengine: apple-admac: Add Apple ADMAC driver")
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
 drivers/dma/apple-admac.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/dma/apple-admac.c b/drivers/dma/apple-admac.c
index c502f8c3aca79be1..d1f74a3aa999d773 100644
--- a/drivers/dma/apple-admac.c
+++ b/drivers/dma/apple-admac.c
@@ -209,10 +209,10 @@ static void admac_cyclic_write_one_desc(struct admac_data *ad, int channo,
 	dev_dbg(ad->dev, "ch%d descriptor: addr=0x%pad len=0x%zx flags=0x%lx\n",
 		channo, &addr, tx->period_len, FLAG_DESC_NOTIFY);
 
-	writel_relaxed(addr,             ad->base + REG_DESC_WRITE(channo));
-	writel_relaxed(addr >> 32,       ad->base + REG_DESC_WRITE(channo));
-	writel_relaxed(tx->period_len,   ad->base + REG_DESC_WRITE(channo));
-	writel_relaxed(FLAG_DESC_NOTIFY, ad->base + REG_DESC_WRITE(channo));
+	writel_relaxed(lower_32_bits(addr), ad->base + REG_DESC_WRITE(channo));
+	writel_relaxed(upper_32_bits(addr), ad->base + REG_DESC_WRITE(channo));
+	writel_relaxed(tx->period_len,      ad->base + REG_DESC_WRITE(channo));
+	writel_relaxed(FLAG_DESC_NOTIFY,    ad->base + REG_DESC_WRITE(channo));
 
 	tx->submitted_pos += tx->period_len;
 	tx->submitted_pos %= 2 * tx->buf_len;
-- 
2.25.1


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

* Re: [PATCH -next] dmaengine: apple-admac: Fix build on 32-bit/non-LPAE platforms
  2022-06-14  7:49 [PATCH -next] dmaengine: apple-admac: Fix build on 32-bit/non-LPAE platforms Geert Uytterhoeven
@ 2022-06-15 12:07 ` Martin Povišer
  2022-06-16 13:44 ` Vinod Koul
  1 sibling, 0 replies; 3+ messages in thread
From: Martin Povišer @ 2022-06-15 12:07 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Hector Martin, Sven Peter, Alyssa Rosenzweig, Vinod Koul,
	linux-arm-kernel, dmaengine, linux-kernel


> On 14. 6. 2022, at 9:49, Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> 
> If CONFIG_PHYS_ADDR_T_64BIT is not set:
> 
>    drivers/dma/apple-admac.c: In function ‘admac_cyclic_write_one_desc’:
>    drivers/dma/apple-admac.c:213:22: error: right shift count >= width of type [-Werror=shift-count-overflow]
>      213 |  writel_relaxed(addr >> 32,       ad->base + REG_DESC_WRITE(channo));
>          |                      ^~
> 
> Fix this by using the {low,upp}er_32_bits() helper macros to obtain the
> address parts.
> 
> Reported-by: noreply@ellerman.id.au
> Fixes: b127315d9a78c011 ("dmaengine: apple-admac: Add Apple ADMAC driver")
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>

Thanks! (TIL about the lower/upper_32_bits helpers)

Acked-by: Martin Povišer <povik+lin@cutebit.org>


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

* Re: [PATCH -next] dmaengine: apple-admac: Fix build on 32-bit/non-LPAE platforms
  2022-06-14  7:49 [PATCH -next] dmaengine: apple-admac: Fix build on 32-bit/non-LPAE platforms Geert Uytterhoeven
  2022-06-15 12:07 ` Martin Povišer
@ 2022-06-16 13:44 ` Vinod Koul
  1 sibling, 0 replies; 3+ messages in thread
From: Vinod Koul @ 2022-06-16 13:44 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Hector Martin, Sven Peter, Alyssa Rosenzweig,
	Martin Povišer, linux-arm-kernel, dmaengine, linux-kernel

Hello Geert,

On 14-06-22, 09:49, Geert Uytterhoeven wrote:
> If CONFIG_PHYS_ADDR_T_64BIT is not set:
> 
>     drivers/dma/apple-admac.c: In function ‘admac_cyclic_write_one_desc’:
>     drivers/dma/apple-admac.c:213:22: error: right shift count >= width of type [-Werror=shift-count-overflow]
>       213 |  writel_relaxed(addr >> 32,       ad->base + REG_DESC_WRITE(channo));
>           |                      ^~
> 
> Fix this by using the {low,upp}er_32_bits() helper macros to obtain the
> address parts.

This changelog is good, but patch title needs update. We should never
reflect the effect of change, but describe the change in patch...

Maybe "dmaengine: apple-admac: use {lower|upper}_32_bits() for
extracting address" would be a better patch title...

Thanks

> 
> Reported-by: noreply@ellerman.id.au
> Fixes: b127315d9a78c011 ("dmaengine: apple-admac: Add Apple ADMAC driver")
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
> ---
>  drivers/dma/apple-admac.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/dma/apple-admac.c b/drivers/dma/apple-admac.c
> index c502f8c3aca79be1..d1f74a3aa999d773 100644
> --- a/drivers/dma/apple-admac.c
> +++ b/drivers/dma/apple-admac.c
> @@ -209,10 +209,10 @@ static void admac_cyclic_write_one_desc(struct admac_data *ad, int channo,
>  	dev_dbg(ad->dev, "ch%d descriptor: addr=0x%pad len=0x%zx flags=0x%lx\n",
>  		channo, &addr, tx->period_len, FLAG_DESC_NOTIFY);
>  
> -	writel_relaxed(addr,             ad->base + REG_DESC_WRITE(channo));
> -	writel_relaxed(addr >> 32,       ad->base + REG_DESC_WRITE(channo));
> -	writel_relaxed(tx->period_len,   ad->base + REG_DESC_WRITE(channo));
> -	writel_relaxed(FLAG_DESC_NOTIFY, ad->base + REG_DESC_WRITE(channo));
> +	writel_relaxed(lower_32_bits(addr), ad->base + REG_DESC_WRITE(channo));
> +	writel_relaxed(upper_32_bits(addr), ad->base + REG_DESC_WRITE(channo));
> +	writel_relaxed(tx->period_len,      ad->base + REG_DESC_WRITE(channo));
> +	writel_relaxed(FLAG_DESC_NOTIFY,    ad->base + REG_DESC_WRITE(channo));
>  
>  	tx->submitted_pos += tx->period_len;
>  	tx->submitted_pos %= 2 * tx->buf_len;
> -- 
> 2.25.1

-- 
~Vinod

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

end of thread, other threads:[~2022-06-16 13:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-14  7:49 [PATCH -next] dmaengine: apple-admac: Fix build on 32-bit/non-LPAE platforms Geert Uytterhoeven
2022-06-15 12:07 ` Martin Povišer
2022-06-16 13:44 ` Vinod Koul

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