Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1387025 > unrolled thread

[PATCH] drivers: firmware: psci: make two helper functions inline

Started byArnd Bergmann <arnd@arndb.de>
First post2016-04-26 02:20 +0200
Last post2016-04-26 08:10 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] drivers: firmware: psci: make two helper functions inline Arnd Bergmann <arnd@arndb.de> - 2016-04-26 02:20 +0200
    Re: [PATCH] drivers: firmware: psci: make two helper functions  inline Jisheng Zhang <jszhang@marvell.com> - 2016-04-26 08:10 +0200

#1387025 — [PATCH] drivers: firmware: psci: make two helper functions inline

FromArnd Bergmann <arnd@arndb.de>
Date2016-04-26 02:20 +0200
Subject[PATCH] drivers: firmware: psci: make two helper functions inline
Message-ID<rrYTn-6xR-3@gated-at.bofh.it>
The previous patch marked these two as 'static' which showed that they
are sometimes unused:

drivers/firmware/psci.c:103:13: error: 'psci_power_state_is_valid' defined but not used [-Werror=unused-function]
 static bool psci_power_state_is_valid(u32 state)
drivers/firmware/psci.c:94:13: error: 'psci_power_state_loses_context' defined but not used [-Werror=unused-function]
 static bool psci_power_state_loses_context(u32 state)

This also marks the functions 'inline', which has the main effect of
silently ignoring them when they are unused. The compiler will typically
inline small static functions anyway, so this seems more appropriate
than using __maybe_unused, which would have the same result otherwise.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: 21e8868 ("drivers: firmware: psci: make two helper functions static")
---
 drivers/firmware/psci.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/firmware/psci.c b/drivers/firmware/psci.c
index 04f2ac5..89fcbdd 100644
--- a/drivers/firmware/psci.c
+++ b/drivers/firmware/psci.c
@@ -91,7 +91,7 @@ static inline bool psci_has_ext_power_state(void)
 				PSCI_1_0_FEATURES_CPU_SUSPEND_PF_MASK;
 }
 
-static bool psci_power_state_loses_context(u32 state)
+static inline bool psci_power_state_loses_context(u32 state)
 {
 	const u32 mask = psci_has_ext_power_state() ?
 					PSCI_1_0_EXT_POWER_STATE_TYPE_MASK :
@@ -100,7 +100,7 @@ static bool psci_power_state_loses_context(u32 state)
 	return state & mask;
 }
 
-static bool psci_power_state_is_valid(u32 state)
+static inline bool psci_power_state_is_valid(u32 state)
 {
 	const u32 valid_mask = psci_has_ext_power_state() ?
 			       PSCI_1_0_EXT_POWER_STATE_MASK :
-- 
2.7.0

[toc] | [next] | [standalone]


#1387149 — Re: [PATCH] drivers: firmware: psci: make two helper functions inline

FromJisheng Zhang <jszhang@marvell.com>
Date2016-04-26 08:10 +0200
SubjectRe: [PATCH] drivers: firmware: psci: make two helper functions inline
Message-ID<rs4m6-2DE-5@gated-at.bofh.it>
In reply to#1387025
Dear Arnd,

On Tue, 26 Apr 2016 02:16:17 +0200 Arnd Bergmann wrote:

> The previous patch marked these two as 'static' which showed that they
> are sometimes unused:
> 
> drivers/firmware/psci.c:103:13: error: 'psci_power_state_is_valid' defined but not used [-Werror=unused-function]
>  static bool psci_power_state_is_valid(u32 state)
> drivers/firmware/psci.c:94:13: error: 'psci_power_state_loses_context' defined but not used [-Werror=unused-function]
>  static bool psci_power_state_loses_context(u32 state)
> 
> This also marks the functions 'inline', which has the main effect of
> silently ignoring them when they are unused. The compiler will typically
> inline small static functions anyway, so this seems more appropriate
> than using __maybe_unused, which would have the same result otherwise.

oops, yes. When preparing the patch, I also thought about making them inline.
But forget to do so.

Thanks for the fix,
Jisheng

> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Fixes: 21e8868 ("drivers: firmware: psci: make two helper functions static")
> ---
>  drivers/firmware/psci.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/firmware/psci.c b/drivers/firmware/psci.c
> index 04f2ac5..89fcbdd 100644
> --- a/drivers/firmware/psci.c
> +++ b/drivers/firmware/psci.c
> @@ -91,7 +91,7 @@ static inline bool psci_has_ext_power_state(void)
>  				PSCI_1_0_FEATURES_CPU_SUSPEND_PF_MASK;
>  }
>  
> -static bool psci_power_state_loses_context(u32 state)
> +static inline bool psci_power_state_loses_context(u32 state)
>  {
>  	const u32 mask = psci_has_ext_power_state() ?
>  					PSCI_1_0_EXT_POWER_STATE_TYPE_MASK :
> @@ -100,7 +100,7 @@ static bool psci_power_state_loses_context(u32 state)
>  	return state & mask;
>  }
>  
> -static bool psci_power_state_is_valid(u32 state)
> +static inline bool psci_power_state_is_valid(u32 state)
>  {
>  	const u32 valid_mask = psci_has_ext_power_state() ?
>  			       PSCI_1_0_EXT_POWER_STATE_MASK :

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web