Skip to contentSkip to conversation

arm: dma-mapping: add cast to DMA_ERROR_CODE

PATCH New Dirk Behme 2 participants 3 messages Aug 15, 2015 – Sep 23, 2015 Arm (32-bit)

lore
Share & tools
lore

Dirk Behme

author
#0 lore raw

PATCH 1/1 arm: dma-mapping: add cast to DMA_ERROR_CODE

Fix the compiler warning

./arch/arm/include/asm/dma-mapping.h: In function ?dma_mapping_error?:
./arch/arm/include/asm/dma-mapping.h:176:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]

  return dma_addr == DMA_ERROR_CODE;
                  ^

we get building the kernel with W=1.

This is done the same way we have already in the arm64 version.

---
 arch/arm/include/asm/dma-mapping.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/include/asm/dma-mapping.h +1 -1
index b52101d..68e41e8 100644
@@ -14,7 +14,7 @@
 #include <xen/xen.h>
 #include <asm/xen/hypervisor.h>
 
-#define DMA_ERROR_CODE	(~0)
+#define DMA_ERROR_CODE	(~(dma_addr_t)0)
 extern struct dma_map_ops arm_dma_ops;
 extern struct dma_map_ops arm_coherent_dma_ops;
 
Signature · 1 line
2.5.0
author
#1 lore raw

PATCH 1/1 arm: dma-mapping: add cast to DMA_ERROR_CODE

Quoted 21 lines · Dirk Behme

Fix the compiler warning

./arch/arm/include/asm/dma-mapping.h: In function ?dma_mapping_error?:
./arch/arm/include/asm/dma-mapping.h:176:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]

   return dma_addr == DMA_ERROR_CODE;
                   ^

we get building the kernel with W=1.

This is done the same way we have already in the arm64 version.

---
  arch/arm/include/asm/dma-mapping.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/include/asm/dma-mapping.h +0 -0
index b52101d..68e41e8 100644

arch/arm/include/asm/dma-mapping.h line 19

Quoted 7 lines
arch/arm/include/asm/dma-mapping.h +1 -1
@@ -14,7 +14,7 @@
  #include <xen/xen.h>
  #include <asm/xen/hypervisor.h>
 
-#define DMA_ERROR_CODE	(~0)
+#define DMA_ERROR_CODE	(~(dma_addr_t)0)
  extern struct dma_map_ops arm_dma_ops;
  extern struct dma_map_ops arm_coherent_dma_ops;

I've put this as 8420/1 into the patch system:

http://www.arm.linux.org.uk/developer/patches/viewpatch.php?id=8420/1

Any comments on this?

Best regards

Dirk

#2 lore raw

PATCH 1/1 arm: dma-mapping: add cast to DMA_ERROR_CODE

Quoted 33 lines · Dirk Behme
Quoted 21 lines · Dirk Behme

Fix the compiler warning

./arch/arm/include/asm/dma-mapping.h: In function ?dma_mapping_error?:
./arch/arm/include/asm/dma-mapping.h:176:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]

  return dma_addr == DMA_ERROR_CODE;
                  ^

we get building the kernel with W=1.

This is done the same way we have already in the arm64 version.

---
 arch/arm/include/asm/dma-mapping.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/include/asm/dma-mapping.h +0 -0
index b52101d..68e41e8 100644

arch/arm/include/asm/dma-mapping.h line 19

Quoted 7 lines
arch/arm/include/asm/dma-mapping.h +1 -1
@@ -14,7 +14,7 @@
 #include <xen/xen.h>
 #include <asm/xen/hypervisor.h>
 
-#define DMA_ERROR_CODE	(~0)
+#define DMA_ERROR_CODE	(~(dma_addr_t)0)
 extern struct dma_map_ops arm_dma_ops;
 extern struct dma_map_ops arm_coherent_dma_ops;

I've put this as 8420/1 into the patch system:

Quoted 3 lines

http://www.arm.linux.org.uk/developer/patches/viewpatch.php?id=8420/1

Any comments on this?

The reason your patch didn't get applied is because of:

commit 96231b2686b53f71838a335bdc404cb5285d1a01

Author: Marek Szyprowski <[email protected]>
Date:   Tue Aug 18 09:14:15 2015 +0100

ARM: 8419/1: dma-mapping: harmonize definition of DMA_ERROR_CODE

All architectures except arm that define DMA_ERROR_CODE are casting it to (dma_addr_t) - as it is always compared to dma_addr_t in arm as well this could be harmonized.

which does exactly the same thing as your patch, and first appeared in June.

Signature · 2 lines
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.