hexagon: fix return type of ffs()
PATCH 1/2 hexagon: fix return type of ffs()
The return type of ffs() is 'int' on all architectures except cris and hexagon. This unifies the return type to 'int'.
The problem I'm seeing is that the following line generates a warning on cris and hexagon because of the mismatch between format '%u' and return type of ffs().
printk("bits in OOB size: %u\n", ffs(ns->geom.oobsz) - 1);But removing this warning by casting to 'int' looks odd, so I suggest unifying the return type of ffs() on all architectures.
---
This patch is not compile tested yet, because I couldn't find cross compiler for hexagon.
arch/hexagon/include/asm/bitops.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/hexagon/include/asm/bitops.h +1 -1
@@ -234,7 +234,7 @@ static inline long fls(int x)* the libc and compiler builtin ffs routines, therefore * differs in spirit from the above ffz (man ffs). */ -static inline long ffs (int x) +static inline int ffs (int x) {int r;
Signature · 1 line
1.8.3.1
PATCH 2/2 cris: fix return type of ffs()
The return type of ffs() is 'int' on all architectures except cris and hexagon. This unifies the return type to 'int'.
The problem I'm seeing is that the following line generates a warning on cris and hexagon because of the mismatch between format '%u' and return type of ffs().
printk("bits in OOB size: %u\n", ffs(ns->geom.oobsz) - 1);But removing this warning by casting to 'int' looks odd, so I suggest unifying the return type of ffs() on all architectures.
--- arch/cris/include/arch-v10/arch/bitops.h | 2 +- arch/cris/include/arch-v32/arch/bitops.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/cris/include/arch-v10/arch/bitops.h +1 -1
@@ -65,7 +65,7 @@ static inline unsigned long __ffs(unsigned long word)* differs in spirit from the above ffz (man ffs). */ -static inline unsigned long kernel_ffs (unsigned long w) +static inline int kernel_ffs (unsigned long w) {return w ?cris_swapwbrlz (w) +1 :0 ; }
arch/cris/include/arch-v32/arch/bitops.h +1 -1
@@ -55,7 +55,7 @@ __ffs(unsigned long w)/* * Find First Bit that is set. */ -static inline unsigned long +static inline int kernel_ffs (unsigned long w) {return w ?cris_swapwbrlz (w) +1 :0 ;
Signature · 1 line
1.8.3.1
Quoted 32 lines · Akinobu Mita
The return type of
ffs()is 'int' on all architectures except cris and hexagon. This unifies the return type to 'int'.The problem I'm seeing is that the following line generates a warning on cris and hexagon because of the mismatch between format '%u' and return type of
ffs().printk("bits in OOB size: %u\n", ffs(ns->geom.oobsz) - 1);But removing this warning by casting to 'int' looks odd, so I suggest unifying the return type of
ffs()on all architectures.Signed-off-by Akinobu Mita <[email protected]>Reported-by Fengguang Wu <[email protected]>Cc Mikael Starvik <[email protected]>Cc Jesper Nilsson <[email protected]>Cc Richard Kuo <[email protected]>---
This patch is not compile tested yet, because I couldn't find cross compiler for hexagon.arch/hexagon/include/asm/bitops.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/hexagon/include/asm/bitops.h +0
-0
arch/hexagon/include/asm/bitops.h static inline long fls(int x) · line 240
Quoted 8 lines
arch/hexagon/include/asm/bitops.h +1
-1@@ -234,7 +234,7 @@ static inline long fls(int x)* the libc and compiler builtin ffs routines, therefore * differs in spirit from the above ffz (man ffs). */ -static inline long ffs (int x) +static inline int ffs (int x) {int r;
For Hexagon:
Signature · 3 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation