Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arm64: Remove system_uses_lse_atomics()
@ 2023-10-17  0:50 Gavin Shan
  2023-10-17 10:35 ` Mark Rutland
  2023-10-18 10:15 ` Catalin Marinas
  0 siblings, 2 replies; 3+ messages in thread
From: Gavin Shan @ 2023-10-17  0:50 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: linux-kernel, catalin.marinas, will, mark.rutland, suzuki.poulose,
	anshuman.khandual, shan.gavin

There are two variants of system_uses_lse_atomics(), depending on
CONFIG_ARM64_LSE_ATOMICS. The function isn't called anywhere when
CONFIG_ARM64_LSE_ATOMICS is disabled. It can be directly replaced
by alternative_has_cap_likely(ARM64_HAS_LSE_ATOMICS) when the kernel
option is enabled.

No need to keep system_uses_lse_atomics() and just remove it.

Signed-off-by: Gavin Shan <gshan@redhat.com>
---
 arch/arm64/include/asm/lse.h | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/arch/arm64/include/asm/lse.h b/arch/arm64/include/asm/lse.h
index cbbcdc35c4cd..3129a5819d0e 100644
--- a/arch/arm64/include/asm/lse.h
+++ b/arch/arm64/include/asm/lse.h
@@ -16,14 +16,9 @@
 #include <asm/atomic_lse.h>
 #include <asm/cpucaps.h>
 
-static __always_inline bool system_uses_lse_atomics(void)
-{
-	return alternative_has_cap_likely(ARM64_HAS_LSE_ATOMICS);
-}
-
 #define __lse_ll_sc_body(op, ...)					\
 ({									\
-	system_uses_lse_atomics() ?					\
+	alternative_has_cap_likely(ARM64_HAS_LSE_ATOMICS) ?		\
 		__lse_##op(__VA_ARGS__) :				\
 		__ll_sc_##op(__VA_ARGS__);				\
 })
@@ -34,8 +29,6 @@ static __always_inline bool system_uses_lse_atomics(void)
 
 #else	/* CONFIG_ARM64_LSE_ATOMICS */
 
-static inline bool system_uses_lse_atomics(void) { return false; }
-
 #define __lse_ll_sc_body(op, ...)		__ll_sc_##op(__VA_ARGS__)
 
 #define ARM64_LSE_ATOMIC_INSN(llsc, lse)	llsc
-- 
2.41.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] arm64: Remove system_uses_lse_atomics()
  2023-10-17  0:50 [PATCH] arm64: Remove system_uses_lse_atomics() Gavin Shan
@ 2023-10-17 10:35 ` Mark Rutland
  2023-10-18 10:15 ` Catalin Marinas
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Rutland @ 2023-10-17 10:35 UTC (permalink / raw)
  To: Gavin Shan
  Cc: linux-arm-kernel, linux-kernel, catalin.marinas, will,
	suzuki.poulose, anshuman.khandual, shan.gavin

On Tue, Oct 17, 2023 at 10:50:36AM +1000, Gavin Shan wrote:
> There are two variants of system_uses_lse_atomics(), depending on
> CONFIG_ARM64_LSE_ATOMICS. The function isn't called anywhere when
> CONFIG_ARM64_LSE_ATOMICS is disabled. It can be directly replaced
> by alternative_has_cap_likely(ARM64_HAS_LSE_ATOMICS) when the kernel
> option is enabled.
> 
> No need to keep system_uses_lse_atomics() and just remove it.
> 
> Signed-off-by: Gavin Shan <gshan@redhat.com>

I had meant to remove this already, so:

Acked-by: Mark Rutland <mark.rutland@arm.com>

Mark.

> ---
>  arch/arm64/include/asm/lse.h | 9 +--------
>  1 file changed, 1 insertion(+), 8 deletions(-)
> 
> diff --git a/arch/arm64/include/asm/lse.h b/arch/arm64/include/asm/lse.h
> index cbbcdc35c4cd..3129a5819d0e 100644
> --- a/arch/arm64/include/asm/lse.h
> +++ b/arch/arm64/include/asm/lse.h
> @@ -16,14 +16,9 @@
>  #include <asm/atomic_lse.h>
>  #include <asm/cpucaps.h>
>  
> -static __always_inline bool system_uses_lse_atomics(void)
> -{
> -	return alternative_has_cap_likely(ARM64_HAS_LSE_ATOMICS);
> -}
> -
>  #define __lse_ll_sc_body(op, ...)					\
>  ({									\
> -	system_uses_lse_atomics() ?					\
> +	alternative_has_cap_likely(ARM64_HAS_LSE_ATOMICS) ?		\
>  		__lse_##op(__VA_ARGS__) :				\
>  		__ll_sc_##op(__VA_ARGS__);				\
>  })
> @@ -34,8 +29,6 @@ static __always_inline bool system_uses_lse_atomics(void)
>  
>  #else	/* CONFIG_ARM64_LSE_ATOMICS */
>  
> -static inline bool system_uses_lse_atomics(void) { return false; }
> -
>  #define __lse_ll_sc_body(op, ...)		__ll_sc_##op(__VA_ARGS__)
>  
>  #define ARM64_LSE_ATOMIC_INSN(llsc, lse)	llsc
> -- 
> 2.41.0
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] arm64: Remove system_uses_lse_atomics()
  2023-10-17  0:50 [PATCH] arm64: Remove system_uses_lse_atomics() Gavin Shan
  2023-10-17 10:35 ` Mark Rutland
@ 2023-10-18 10:15 ` Catalin Marinas
  1 sibling, 0 replies; 3+ messages in thread
From: Catalin Marinas @ 2023-10-18 10:15 UTC (permalink / raw)
  To: linux-arm-kernel, Gavin Shan
  Cc: Will Deacon, linux-kernel, mark.rutland, suzuki.poulose,
	anshuman.khandual, shan.gavin

On Tue, 17 Oct 2023 10:50:36 +1000, Gavin Shan wrote:
> There are two variants of system_uses_lse_atomics(), depending on
> CONFIG_ARM64_LSE_ATOMICS. The function isn't called anywhere when
> CONFIG_ARM64_LSE_ATOMICS is disabled. It can be directly replaced
> by alternative_has_cap_likely(ARM64_HAS_LSE_ATOMICS) when the kernel
> option is enabled.
> 
> No need to keep system_uses_lse_atomics() and just remove it.
> 
> [...]

Applied to arm64 (for-next/misc), thanks!

[1/1] arm64: Remove system_uses_lse_atomics()
      https://git.kernel.org/arm64/c/0899a6278a86

-- 
Catalin


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2023-10-18 10:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-17  0:50 [PATCH] arm64: Remove system_uses_lse_atomics() Gavin Shan
2023-10-17 10:35 ` Mark Rutland
2023-10-18 10:15 ` Catalin Marinas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox