[2/2] arm64: perf: Mark all accessor functions inline

Message ID d53a19043c0c3bd25f6c203e73a2fb08a9661824.1683561482.git.geert+renesas@glider.be
State New
Headers
Series ARM/arm64: Mark all accessor functions inline |

Commit Message

Geert Uytterhoeven May 8, 2023, 4:05 p.m. UTC
  When just including <asm/arm_pmuv3.h>:

    arch/arm64/include/asm/arm_pmuv3.h:31:13: error: ‘write_pmevtypern’ defined but not used [-Werror=unused-function]
       31 | static void write_pmevtypern(int n, unsigned long val)
	  |             ^~~~~~~~~~~~~~~~
    arch/arm64/include/asm/arm_pmuv3.h:24:13: error: ‘write_pmevcntrn’ defined but not used [-Werror=unused-function]
       24 | static void write_pmevcntrn(int n, unsigned long val)
	  |             ^~~~~~~~~~~~~~~
    arch/arm64/include/asm/arm_pmuv3.h:16:22: error: ‘read_pmevcntrn’ defined but not used [-Werror=unused-function]
       16 | static unsigned long read_pmevcntrn(int n)
	  |                      ^~~~~~~~~~~~~~

Fix this by adding the missing "inline" keywords to the three accessor
functions that lack them.

Fixes: df29ddf4f04b00cf ("arm64: perf: Abstract system register accesses away")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 arch/arm64/include/asm/arm_pmuv3.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
  

Comments

Marc Zyngier May 9, 2023, 7:55 a.m. UTC | #1
On Mon, 08 May 2023 17:05:19 +0100,
Geert Uytterhoeven <geert+renesas@glider.be> wrote:
> 
> When just including <asm/arm_pmuv3.h>:
> 
>     arch/arm64/include/asm/arm_pmuv3.h:31:13: error: ‘write_pmevtypern’ defined but not used [-Werror=unused-function]
>        31 | static void write_pmevtypern(int n, unsigned long val)
> 	  |             ^~~~~~~~~~~~~~~~
>     arch/arm64/include/asm/arm_pmuv3.h:24:13: error: ‘write_pmevcntrn’ defined but not used [-Werror=unused-function]
>        24 | static void write_pmevcntrn(int n, unsigned long val)
> 	  |             ^~~~~~~~~~~~~~~
>     arch/arm64/include/asm/arm_pmuv3.h:16:22: error: ‘read_pmevcntrn’ defined but not used [-Werror=unused-function]
>        16 | static unsigned long read_pmevcntrn(int n)
> 	  |                      ^~~~~~~~~~~~~~
> 
> Fix this by adding the missing "inline" keywords to the three accessor
> functions that lack them.

Looks reasonable to me. Each of these accessors is used exactly once
in the PMUv3 driver, so the inlining doesn't result in extra bloat.

Reviewed-by: Marc Zyngier <maz@kernel.org>

	M.
  
Mark Rutland May 9, 2023, 11:28 a.m. UTC | #2
On Mon, May 08, 2023 at 06:05:19PM +0200, Geert Uytterhoeven wrote:
> When just including <asm/arm_pmuv3.h>:
> 
>     arch/arm64/include/asm/arm_pmuv3.h:31:13: error: ‘write_pmevtypern’ defined but not used [-Werror=unused-function]
>        31 | static void write_pmevtypern(int n, unsigned long val)
> 	  |             ^~~~~~~~~~~~~~~~
>     arch/arm64/include/asm/arm_pmuv3.h:24:13: error: ‘write_pmevcntrn’ defined but not used [-Werror=unused-function]
>        24 | static void write_pmevcntrn(int n, unsigned long val)
> 	  |             ^~~~~~~~~~~~~~~
>     arch/arm64/include/asm/arm_pmuv3.h:16:22: error: ‘read_pmevcntrn’ defined but not used [-Werror=unused-function]
>        16 | static unsigned long read_pmevcntrn(int n)
> 	  |                      ^~~~~~~~~~~~~~
> 
> Fix this by adding the missing "inline" keywords to the three accessor
> functions that lack them.
> 
> Fixes: df29ddf4f04b00cf ("arm64: perf: Abstract system register accesses away")
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>

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

Mark.

> ---
>  arch/arm64/include/asm/arm_pmuv3.h | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/arm64/include/asm/arm_pmuv3.h b/arch/arm64/include/asm/arm_pmuv3.h
> index d6b51deb7bf0ff2f..18dc2fb3d7b7b2d0 100644
> --- a/arch/arm64/include/asm/arm_pmuv3.h
> +++ b/arch/arm64/include/asm/arm_pmuv3.h
> @@ -13,7 +13,7 @@
>  
>  #define RETURN_READ_PMEVCNTRN(n) \
>  	return read_sysreg(pmevcntr##n##_el0)
> -static unsigned long read_pmevcntrn(int n)
> +static inline unsigned long read_pmevcntrn(int n)
>  {
>  	PMEVN_SWITCH(n, RETURN_READ_PMEVCNTRN);
>  	return 0;
> @@ -21,14 +21,14 @@ static unsigned long read_pmevcntrn(int n)
>  
>  #define WRITE_PMEVCNTRN(n) \
>  	write_sysreg(val, pmevcntr##n##_el0)
> -static void write_pmevcntrn(int n, unsigned long val)
> +static inline void write_pmevcntrn(int n, unsigned long val)
>  {
>  	PMEVN_SWITCH(n, WRITE_PMEVCNTRN);
>  }
>  
>  #define WRITE_PMEVTYPERN(n) \
>  	write_sysreg(val, pmevtyper##n##_el0)
> -static void write_pmevtypern(int n, unsigned long val)
> +static inline void write_pmevtypern(int n, unsigned long val)
>  {
>  	PMEVN_SWITCH(n, WRITE_PMEVTYPERN);
>  }
> -- 
> 2.34.1
>
  

Patch

diff --git a/arch/arm64/include/asm/arm_pmuv3.h b/arch/arm64/include/asm/arm_pmuv3.h
index d6b51deb7bf0ff2f..18dc2fb3d7b7b2d0 100644
--- a/arch/arm64/include/asm/arm_pmuv3.h
+++ b/arch/arm64/include/asm/arm_pmuv3.h
@@ -13,7 +13,7 @@ 
 
 #define RETURN_READ_PMEVCNTRN(n) \
 	return read_sysreg(pmevcntr##n##_el0)
-static unsigned long read_pmevcntrn(int n)
+static inline unsigned long read_pmevcntrn(int n)
 {
 	PMEVN_SWITCH(n, RETURN_READ_PMEVCNTRN);
 	return 0;
@@ -21,14 +21,14 @@  static unsigned long read_pmevcntrn(int n)
 
 #define WRITE_PMEVCNTRN(n) \
 	write_sysreg(val, pmevcntr##n##_el0)
-static void write_pmevcntrn(int n, unsigned long val)
+static inline void write_pmevcntrn(int n, unsigned long val)
 {
 	PMEVN_SWITCH(n, WRITE_PMEVCNTRN);
 }
 
 #define WRITE_PMEVTYPERN(n) \
 	write_sysreg(val, pmevtyper##n##_el0)
-static void write_pmevtypern(int n, unsigned long val)
+static inline void write_pmevtypern(int n, unsigned long val)
 {
 	PMEVN_SWITCH(n, WRITE_PMEVTYPERN);
 }