[1/2] ARM: orion: don't use using 64-bit DMA masks

Message ID 20190325155101.3544731-1-arnd@arndb.de
State Accepted
Commit cd92d74d67c811dc22544430b9ac3029f5bd64c5
Headers show
Series
  • [1/2] ARM: orion: don't use using 64-bit DMA masks
Related show

Commit Message

Arnd Bergmann March 25, 2019, 3:50 p.m.
clang warns about statically defined DMA masks from the DMA_BIT_MASK
macro with length 64:

arch/arm/plat-orion/common.c:625:29: error: shift count >= width of type [-Werror,-Wshift-count-overflow]
                .coherent_dma_mask      = DMA_BIT_MASK(64),
                                          ^~~~~~~~~~~~~~~~
include/linux/dma-mapping.h:141:54: note: expanded from macro 'DMA_BIT_MASK'
 #define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))

The ones in orion shouldn't really be 64 bit masks, so changing them
to what the driver can support avoids the warning.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>

---
 arch/arm/plat-orion/common.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

-- 
2.20.0

Comments

Olof Johansson April 7, 2019, 10:20 p.m. | #1
On Mon, Mar 25, 2019 at 04:50:42PM +0100, Arnd Bergmann wrote:
> clang warns about statically defined DMA masks from the DMA_BIT_MASK

> macro with length 64:

> 

> arch/arm/plat-orion/common.c:625:29: error: shift count >= width of type [-Werror,-Wshift-count-overflow]

>                 .coherent_dma_mask      = DMA_BIT_MASK(64),

>                                           ^~~~~~~~~~~~~~~~

> include/linux/dma-mapping.h:141:54: note: expanded from macro 'DMA_BIT_MASK'

>  #define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))

> 

> The ones in orion shouldn't really be 64 bit masks, so changing them

> to what the driver can support avoids the warning.

> 

> Signed-off-by: Arnd Bergmann <arnd@arndb.de>


Applied to fixes.


-Olof

Patch

diff --git a/arch/arm/plat-orion/common.c b/arch/arm/plat-orion/common.c
index a6c81ce00f52..8647cb80a93b 100644
--- a/arch/arm/plat-orion/common.c
+++ b/arch/arm/plat-orion/common.c
@@ -622,7 +622,7 @@  static struct platform_device orion_xor0_shared = {
 	.resource	= orion_xor0_shared_resources,
 	.dev            = {
 		.dma_mask               = &orion_xor_dmamask,
-		.coherent_dma_mask      = DMA_BIT_MASK(64),
+		.coherent_dma_mask      = DMA_BIT_MASK(32),
 		.platform_data          = &orion_xor0_pdata,
 	},
 };
@@ -683,7 +683,7 @@  static struct platform_device orion_xor1_shared = {
 	.resource	= orion_xor1_shared_resources,
 	.dev            = {
 		.dma_mask               = &orion_xor_dmamask,
-		.coherent_dma_mask      = DMA_BIT_MASK(64),
+		.coherent_dma_mask      = DMA_BIT_MASK(32),
 		.platform_data          = &orion_xor1_pdata,
 	},
 };