On Sat, Aug 29, 2020 at 03:51:16AM -0700, Guenter Roeck wrote: > > This patch results in the following compile error when compiling > ppc:mpc85xx_defconfig. > > Error log: > In file included from ./include/linux/list.h:9, > from ./include/linux/module.h:12, > from drivers/dma/fsldma.c:23: > drivers/dma/fsldma.h: In function 'fsl_ioread64': > ./include/linux/kernel.h:189:37: error: invalid operands to binary & (have > 'const u64 *' {aka 'const long long unsigned int *'} and 'unsigned int') > 189 | #define lower_32_bits(n) ((u32)((n) & 0xffffffff)) > | ^ > drivers/dma/fsldma.h:208:17: note: in expansion of macro 'lower_32_bits' > 208 | u32 fsl_addr = lower_32_bits(addr); > | ^~~~~~~~~~~~~ > drivers/dma/fsldma.h: In function 'fsl_ioread64be': > ./include/linux/kernel.h:189:37: error: invalid operands to binary & (have > 'const u64 *' {aka 'const long long unsigned int *'} and 'unsigned int') > 189 | #define lower_32_bits(n) ((u32)((n) & 0xffffffff)) > | ^ > drivers/dma/fsldma.h:222:17: note: in expansion of macro 'lower_32_bits' > 222 | u32 fsl_addr = lower_32_bits(addr); > | ^~~~~~~~~~~~~ > make[2]: *** [drivers/dma/fsldma.o] Error 1
Thanks for the report. Passing a pointer to lower_32_bits is just bad. ---8<--- The functions fsl_ioread64* were passing a pointer to lower_32_bits which just happened to work because it was a macro that simply did a cast on the argument. However, now that lower_32_bits does a mask on the argument it no longer works. Passing a pointer to lower_32_bits doesn't look right anyway. This patch adds explicit casts so that an integer is passed along as the argument to lower_32_bits. Reported-by: Guenter Roeck <li...@roeck-us.net> Signed-off-by: Herbert Xu <herb...@gondor.apana.org.au> diff --git a/drivers/dma/fsldma.h b/drivers/dma/fsldma.h index 56f18ae99233..da5816b1706e 100644 --- a/drivers/dma/fsldma.h +++ b/drivers/dma/fsldma.h @@ -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 = lower_32_bits((unsigned long)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 = lower_32_bits((unsigned long)addr); u64 fsl_addr_hi = (u64)in_be32((u32 *)fsl_addr) << 32; return fsl_addr_hi | in_be32((u32 *)(fsl_addr + 1)); -- Email: Herbert Xu <herb...@gondor.apana.org.au> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt