Apparently on few architectures __fls is defined incorrectly. Fix this
by adjusting declarations to asm-generic ones.
As far as I can tell there should be no functional changes, but I don't
have devices to test it, so it was only compile tested.
Changes in v2:
- change both declarations in ARC header (pointed by Guenter Roeck)
- also change sparc64 declaration (pointed by Guenter Roeck)
Amadeusz Sławiński (3):
ARC: bitops: Change __fls to return unsigned long
m68k: bitops: Change __fls to return and accept unsigned long
sparc64: bitops: Change __fls to return unsigned long
arch/arc/include/asm/bitops.h | 4 ++--
arch/m68k/include/asm/bitops.h | 2 +-
arch/sparc/include/asm/bitops_64.h | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
--
2.25.1
As per asm-generic definition and other architectures __fls should
return unsigned long.
No functional change is expected as return value should fit in unsigned
long.
Reviewed-by: Cezary Rojewski <[email protected]>
Signed-off-by: Amadeusz Sławiński <[email protected]>
---
arch/arc/include/asm/bitops.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arc/include/asm/bitops.h b/arch/arc/include/asm/bitops.h
index bdb7e190a294..f5a936496f06 100644
--- a/arch/arc/include/asm/bitops.h
+++ b/arch/arc/include/asm/bitops.h
@@ -82,7 +82,7 @@ static inline __attribute__ ((const)) int fls(unsigned int x)
/*
* __fls: Similar to fls, but zero based (0-31)
*/
-static inline __attribute__ ((const)) int __fls(unsigned long x)
+static inline __attribute__ ((const)) unsigned long __fls(unsigned long x)
{
if (!x)
return 0;
@@ -131,7 +131,7 @@ static inline __attribute__ ((const)) int fls(unsigned int x)
/*
* __fls: Similar to fls, but zero based (0-31). Also 0 if no bit set
*/
-static inline __attribute__ ((const)) int __fls(unsigned long x)
+static inline __attribute__ ((const)) unsigned long __fls(unsigned long x)
{
/* FLS insn has exactly same semantics as the API */
return __builtin_arc_fls(x);
--
2.25.1
As per asm-generic definition and other architectures __fls should
return unsigned long.
No functional change is expected as return value should fit in unsigned
long.
Reviewed-by: Cezary Rojewski <[email protected]>
Signed-off-by: Amadeusz Sławiński <[email protected]>
---
arch/sparc/include/asm/bitops_64.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/sparc/include/asm/bitops_64.h b/arch/sparc/include/asm/bitops_64.h
index 005a8ae858f1..cdac39bd7b32 100644
--- a/arch/sparc/include/asm/bitops_64.h
+++ b/arch/sparc/include/asm/bitops_64.h
@@ -24,7 +24,7 @@ void clear_bit(unsigned long nr, volatile unsigned long *addr);
void change_bit(unsigned long nr, volatile unsigned long *addr);
int fls(unsigned int word);
-int __fls(unsigned long word);
+unsigned long __fls(unsigned long word);
#include <asm-generic/bitops/non-atomic.h>
--
2.25.1
As per asm-generic definition and other architectures __fls should
return and accept unsigned long as its parameter.
No functional change is expected as return value should fit in unsigned
long.
Reviewed-by: Cezary Rojewski <[email protected]>
Signed-off-by: Amadeusz Sławiński <[email protected]>
---
arch/m68k/include/asm/bitops.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/m68k/include/asm/bitops.h b/arch/m68k/include/asm/bitops.h
index 51283db53667..87c2cd66a9ce 100644
--- a/arch/m68k/include/asm/bitops.h
+++ b/arch/m68k/include/asm/bitops.h
@@ -510,7 +510,7 @@ static inline int fls(unsigned int x)
return 32 - cnt;
}
-static inline int __fls(int x)
+static inline unsigned long __fls(unsigned long x)
{
return fls(x) - 1;
}
--
2.25.1
On Fri, May 27, 2022 at 1:53 PM Amadeusz Sławiński
<[email protected]> wrote:
> As per asm-generic definition and other architectures __fls should
> return and accept unsigned long as its parameter.
>
> No functional change is expected as return value should fit in unsigned
> long.
>
> Reviewed-by: Cezary Rojewski <[email protected]>
> Signed-off-by: Amadeusz Sławiński <[email protected]>
Reviewed-by: Geert Uytterhoeven <[email protected]>
i.e. will queue in the m68k for-v5.20 branch.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
On 5/27/2022 1:53 PM, Amadeusz Sławiński wrote:
> As per asm-generic definition and other architectures __fls should
> return unsigned long.
>
> No functional change is expected as return value should fit in unsigned
> long.
>
> Reviewed-by: Cezary Rojewski <[email protected]>
> Signed-off-by: Amadeusz Sławiński <[email protected]>
> ---
> arch/sparc/include/asm/bitops_64.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/sparc/include/asm/bitops_64.h b/arch/sparc/include/asm/bitops_64.h
> index 005a8ae858f1..cdac39bd7b32 100644
> --- a/arch/sparc/include/asm/bitops_64.h
> +++ b/arch/sparc/include/asm/bitops_64.h
> @@ -24,7 +24,7 @@ void clear_bit(unsigned long nr, volatile unsigned long *addr);
> void change_bit(unsigned long nr, volatile unsigned long *addr);
>
> int fls(unsigned int word);
> -int __fls(unsigned long word);
> +unsigned long __fls(unsigned long word);
>
> #include <asm-generic/bitops/non-atomic.h>
>
Hi,
any chance this one could also get merged? Other two patches are already
in linux-next and I would like to remove it from list of things I have
to remember ;)
Amadeusz