Building ARM with NO_BOOTMEM generates below warning.
mm/nobootmem.c: In function _____free_pages_memory___:
mm/nobootmem.c:88:11: warning: comparison of distinct pointer types lacks a cast
order = min(MAX_ORDER - 1UL, __ffs(start));
ARM's __ffs() differs from other architectures in that it ends up being
an int, whereas almost everyone else is unsigned long.
So fix ARMs __ffs() to conform to other architectures. Suggested by
Russell King.
Some more details in below thread -
https://lkml.org/lkml/2013/12/9/807
Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Acked-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
return ret;
}
-#define __fls(x) (fls(x) - 1)
-#define ffs(x) ({ unsigned long __t = (x); fls(__t & -__t); })
-#define __ffs(x) (ffs(x) - 1)
-#define ffz(x) __ffs( ~(x) )
+static inline unsigned long __fls(unsigned long x)
+{
+ return fls(x) - 1;
+}
+
+static inline int ffs(int x)
+{
+ return fls(x & -x);
+}
+
+static inline unsigned long __ffs(unsigned long x)
+{
+ return ffs(x) - 1;
+}
+
+static inline unsigned long ffz(unsigned long x)
+{
+ return __ffs(~x);
+}
#endif