Skip to contentSkip to conversation

dmaengine: apple-admac: Fix build on 32-bit/non-LPAE platforms

PATCH In review Geert Uytterhoeven 3 participants 3 messages Jun 15, 2022 – Jun 16, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dmaengine: apple-admac: Fix build on 32-bit/non-LPAE platforms

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 [email protected]
Fixes b127315d9a78c011 ("dmaengine: apple-admac: Add Apple ADMAC driver")
---
 drivers/dma/apple-admac.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/dma/apple-admac.c +4 -4
index c502f8c3aca79be1..d1f74a3aa999d773 100644
@@ -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;
Signature · 1 line
2.25.1
Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines · 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));
         |                      ^~
Quoted 6 lines

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

Reported-by [email protected]
Fixes b127315d9a78c011 ("dmaengine: apple-admac: Add Apple ADMAC driver")

Thanks! (TIL about the lower/upper_32_bits helpers)

maintainer
#2 lore raw
In reply to Geert Uytterhoeven

Hello Geert,

Quoted 9 lines · 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.

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

Quoted 29 lines
Reported-by [email protected]
Fixes b127315d9a78c011 ("dmaengine: apple-admac: Add Apple ADMAC driver")
---
 drivers/dma/apple-admac.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/dma/apple-admac.c +4 -4
index c502f8c3aca79be1..d1f74a3aa999d773 100644
@@ -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;
Signature · 1 line
2.25.1
Signature · 1 line
~Vinod