fsldma: fsl_ioread64*() do not need lower_32_bits()
Guenter Roeck
Tested-byQuoted 10 lines · Luc Van Oostenryck
For ppc32, the functions
fsl_ioread64()&fsl_ioread64be()uselower_32_bits()as a fancy way to cast the pointer to u32 in order to do non-atomic 64-bit IO.But the pointer is already 32-bit, so simply cast the pointer to u32.
This fixes a compile error introduced by
ef91bb196b0d("kernel.h: Silence sparse warning inlower_32_bits")Fixes ef91bb196b0db1013ef8705367bc2d7944ef696b
checkpatch complains about this and prefers
Otherwise
Quoted 39 lines
Reported-by Guenter Roeck <[email protected]>Cc Li Yang <[email protected]>Cc Zhang Wei <[email protected]>Cc Dan Williams <[email protected]>Cc Vinod Koul <[email protected]>Cc Herbert Xu <[email protected]>Signed-off-by Luc Van Oostenryck <[email protected]>--- drivers/dma/fsldma.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/dma/fsldma.h +2
-2@@ -205,7 +205,7 @@ struct fsldma_chan {#else static u64 fsl_ioread64 (const u64 __iomem *addr) { -u32 fsl_addr =lower_32_bits (addr); +u32 fsl_addr = (u32 ) addr;u64 fsl_addr_hi = (u64 )in_le32 ((u32 *)(fsl_addr +1 )) <<32 ;return fsl_addr_hi |in_le32 ((u32 *)fsl_addr);@@ -219,7 +219,7 @@ static void fsl_iowrite64(u64 val, u64 __iomem *addr)static u64 fsl_ioread64be (const u64 __iomem *addr) { -u32 fsl_addr =lower_32_bits (addr); +u32 fsl_addr = (u32 ) addr;u64 fsl_addr_hi = (u64 )in_be32 ((u32 *)fsl_addr) <<32 ;return fsl_addr_hi |in_be32 ((u32 *)(fsl_addr +1 ));Signature · 1 line
2.28.0
Le 29/08/2020 à 17:05, Guenter Roeck a écrit :
Quoted 7 lines · Luc Van Oostenryck
Quoted 6 lines
For ppc32, the functions
fsl_ioread64()&fsl_ioread64be()uselower_32_bits()as a fancy way to cast the pointer to u32 in order to do non-atomic 64-bit IO.But the pointer is already 32-bit, so simply cast the pointer to u32.
Quoted 8 lines
Quoted 4 lines
This fixes a compile error introduced by
ef91bb196b0d("kernel.h: Silence sparse warning inlower_32_bits")Fixes ef91bb196b0db1013ef8705367bc2d7944ef696bcheckpatch complains about this and prefers
Fixes ef91bb196b0d ("kernel.h: Silence sparse warning in lower_32_bits")
Checkpatch also complains about spacing:
CHECK:SPACING: No space is necessary after a cast
#39: FILE: drivers/dma/fsldma.h:208:
+ u32 fsl_addr = (u32) addr;
CHECK:SPACING: No space is necessary after a cast
#48: FILE: drivers/dma/fsldma.h:222:
+ u32 fsl_addr = (u32) addr;
total: 0 errors, 0 warnings, 2 checks, 16 lines checked
Christophe
Quoted 44 lines
Otherwise
Tested-by Guenter Roeck <[email protected]>Quoted 39 lines
Reported-by Guenter Roeck <[email protected]>Cc Li Yang <[email protected]>Cc Zhang Wei <[email protected]>Cc Dan Williams <[email protected]>Cc Vinod Koul <[email protected]>Cc Herbert Xu <[email protected]>Signed-off-by Luc Van Oostenryck <[email protected]>--- drivers/dma/fsldma.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/dma/fsldma.h +2
-2@@ -205,7 +205,7 @@ struct fsldma_chan {#else static u64 fsl_ioread64 (const u64 __iomem *addr) { -u32 fsl_addr =lower_32_bits (addr); +u32 fsl_addr = (u32 ) addr;u64 fsl_addr_hi = (u64 )in_le32 ((u32 *)(fsl_addr +1 )) <<32 ;return fsl_addr_hi |in_le32 ((u32 *)fsl_addr);@@ -219,7 +219,7 @@ static void fsl_iowrite64(u64 val, u64 __iomem *addr)static u64 fsl_ioread64be (const u64 __iomem *addr) { -u32 fsl_addr =lower_32_bits (addr); +u32 fsl_addr = (u32 ) addr;u64 fsl_addr_hi = (u64 )in_be32 ((u32 *)fsl_addr) <<32 ;return fsl_addr_hi |in_be32 ((u32 *)(fsl_addr +1 ));Signature · 1 line
2.28.0