linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/3] bitops: __fls adjustments
@ 2022-05-27 11:53 Amadeusz Sławiński
  2022-05-27 11:53 ` [PATCH v2 1/3] ARC: bitops: Change __fls to return unsigned long Amadeusz Sławiński
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Amadeusz Sławiński @ 2022-05-27 11:53 UTC (permalink / raw)
  To: Vineet Gupta, Geert Uytterhoeven, David S . Miller
  Cc: Guenter Roeck, linux-snps-arc, linux-m68k, sparclinux,
	linux-kernel, Amadeusz Sławiński

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v2 1/3] ARC: bitops: Change __fls to return unsigned long
  2022-05-27 11:53 [PATCH v2 0/3] bitops: __fls adjustments Amadeusz Sławiński
@ 2022-05-27 11:53 ` Amadeusz Sławiński
  2022-05-27 11:53 ` [PATCH v2 2/3] m68k: bitops: Change __fls to return and accept " Amadeusz Sławiński
  2022-05-27 11:53 ` [PATCH v2 3/3] sparc64: bitops: Change __fls to return " Amadeusz Sławiński
  2 siblings, 0 replies; 6+ messages in thread
From: Amadeusz Sławiński @ 2022-05-27 11:53 UTC (permalink / raw)
  To: Vineet Gupta, Geert Uytterhoeven, David S . Miller
  Cc: Guenter Roeck, linux-snps-arc, linux-m68k, sparclinux,
	linux-kernel, Amadeusz Sławiński, Cezary Rojewski

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 <cezary.rojewski@intel.com>
Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
---
 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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v2 2/3] m68k: bitops: Change __fls to return and accept unsigned long
  2022-05-27 11:53 [PATCH v2 0/3] bitops: __fls adjustments Amadeusz Sławiński
  2022-05-27 11:53 ` [PATCH v2 1/3] ARC: bitops: Change __fls to return unsigned long Amadeusz Sławiński
@ 2022-05-27 11:53 ` Amadeusz Sławiński
  2022-07-06  9:30   ` Geert Uytterhoeven
  2022-05-27 11:53 ` [PATCH v2 3/3] sparc64: bitops: Change __fls to return " Amadeusz Sławiński
  2 siblings, 1 reply; 6+ messages in thread
From: Amadeusz Sławiński @ 2022-05-27 11:53 UTC (permalink / raw)
  To: Vineet Gupta, Geert Uytterhoeven, David S . Miller
  Cc: Guenter Roeck, linux-snps-arc, linux-m68k, sparclinux,
	linux-kernel, Amadeusz Sławiński, Cezary Rojewski

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 <cezary.rojewski@intel.com>
Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
---
 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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v2 3/3] sparc64: bitops: Change __fls to return unsigned long
  2022-05-27 11:53 [PATCH v2 0/3] bitops: __fls adjustments Amadeusz Sławiński
  2022-05-27 11:53 ` [PATCH v2 1/3] ARC: bitops: Change __fls to return unsigned long Amadeusz Sławiński
  2022-05-27 11:53 ` [PATCH v2 2/3] m68k: bitops: Change __fls to return and accept " Amadeusz Sławiński
@ 2022-05-27 11:53 ` Amadeusz Sławiński
  2022-08-03  8:48   ` Amadeusz Sławiński
  2 siblings, 1 reply; 6+ messages in thread
From: Amadeusz Sławiński @ 2022-05-27 11:53 UTC (permalink / raw)
  To: Vineet Gupta, Geert Uytterhoeven, David S . Miller
  Cc: Guenter Roeck, linux-snps-arc, linux-m68k, sparclinux,
	linux-kernel, Amadeusz Sławiński, Cezary Rojewski

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 <cezary.rojewski@intel.com>
Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
---
 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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 2/3] m68k: bitops: Change __fls to return and accept unsigned long
  2022-05-27 11:53 ` [PATCH v2 2/3] m68k: bitops: Change __fls to return and accept " Amadeusz Sławiński
@ 2022-07-06  9:30   ` Geert Uytterhoeven
  0 siblings, 0 replies; 6+ messages in thread
From: Geert Uytterhoeven @ 2022-07-06  9:30 UTC (permalink / raw)
  To: Amadeusz Sławiński
  Cc: Vineet Gupta, David S . Miller, Guenter Roeck, arcml, linux-m68k,
	sparclinux, Linux Kernel Mailing List, Cezary Rojewski

On Fri, May 27, 2022 at 1:53 PM Amadeusz Sławiński
<amadeuszx.slawinski@linux.intel.com> 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 <cezary.rojewski@intel.com>
> Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>

Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
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 -- geert@linux-m68k.org

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 3/3] sparc64: bitops: Change __fls to return unsigned long
  2022-05-27 11:53 ` [PATCH v2 3/3] sparc64: bitops: Change __fls to return " Amadeusz Sławiński
@ 2022-08-03  8:48   ` Amadeusz Sławiński
  0 siblings, 0 replies; 6+ messages in thread
From: Amadeusz Sławiński @ 2022-08-03  8:48 UTC (permalink / raw)
  To: Vineet Gupta, Geert Uytterhoeven, David S . Miller
  Cc: Guenter Roeck, linux-snps-arc, linux-m68k, sparclinux,
	linux-kernel, Cezary Rojewski

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 <cezary.rojewski@intel.com>
> Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
> ---
>   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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-08-03  8:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-27 11:53 [PATCH v2 0/3] bitops: __fls adjustments Amadeusz Sławiński
2022-05-27 11:53 ` [PATCH v2 1/3] ARC: bitops: Change __fls to return unsigned long Amadeusz Sławiński
2022-05-27 11:53 ` [PATCH v2 2/3] m68k: bitops: Change __fls to return and accept " Amadeusz Sławiński
2022-07-06  9:30   ` Geert Uytterhoeven
2022-05-27 11:53 ` [PATCH v2 3/3] sparc64: bitops: Change __fls to return " Amadeusz Sławiński
2022-08-03  8:48   ` Amadeusz Sławiński

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).