[2/5] ARM: actions: Localize some variables
diff mbox series

Message ID 20181211080759.3150-2-linus.walleij@linaro.org
State New
Headers show
Series
  • [1/5] ARM: actions: Put OF nodes after use
Related show

Commit Message

Linus Walleij Dec. 11, 2018, 8:07 a.m. UTC
The ncores and scu_base_addr variables are only used
inside s500_smp_prepare_cpus() so no need to have them
static local.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 arch/arm/mach-actions/platsmp.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Russell King - ARM Linux admin Dec. 12, 2018, 11:18 a.m. UTC | #1
On Tue, Dec 11, 2018 at 09:07:56AM +0100, Linus Walleij wrote:
> The ncores and scu_base_addr variables are only used
> inside s500_smp_prepare_cpus() so no need to have them
> static local.
> 
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
>  arch/arm/mach-actions/platsmp.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/arm/mach-actions/platsmp.c b/arch/arm/mach-actions/platsmp.c
> index 02d17ed0ca31..98fbcaa764a5 100644
> --- a/arch/arm/mach-actions/platsmp.c
> +++ b/arch/arm/mach-actions/platsmp.c
> @@ -34,11 +34,8 @@
>  #define OWL_SPS_PG_CTL_ACK_CPU2	BIT(21)
>  #define OWL_SPS_PG_CTL_ACK_CPU3	BIT(22)
>  
> -static void __iomem *scu_base_addr;
>  static void __iomem *sps_base_addr;
>  static void __iomem *timer_base_addr;
> -static int ncores;
> -
>  static DEFINE_SPINLOCK(boot_lock);
>  
>  void owl_secondary_startup(void);
> @@ -113,7 +110,9 @@ static int s500_smp_boot_secondary(unsigned int cpu, struct task_struct *idle)
>  
>  static void __init s500_smp_prepare_cpus(unsigned int max_cpus)
>  {
> +	static void __iomem *scu_base_addr;
>  	struct device_node *node;
> +	static int ncores;

Do these need to be static?  We only prepare once.
Andreas Färber Dec. 18, 2018, 7:35 p.m. UTC | #2
+ linux-actions

Am 11.12.18 um 09:07 schrieb Linus Walleij:
> The ncores and scu_base_addr variables are only used
> inside s500_smp_prepare_cpus() so no need to have them
> static local.
> 
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
>  arch/arm/mach-actions/platsmp.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/arm/mach-actions/platsmp.c b/arch/arm/mach-actions/platsmp.c
> index 02d17ed0ca31..98fbcaa764a5 100644
> --- a/arch/arm/mach-actions/platsmp.c
> +++ b/arch/arm/mach-actions/platsmp.c
> @@ -34,11 +34,8 @@
>  #define OWL_SPS_PG_CTL_ACK_CPU2	BIT(21)
>  #define OWL_SPS_PG_CTL_ACK_CPU3	BIT(22)
>  
> -static void __iomem *scu_base_addr;
>  static void __iomem *sps_base_addr;
>  static void __iomem *timer_base_addr;
> -static int ncores;
> -
>  static DEFINE_SPINLOCK(boot_lock);
>  
>  void owl_secondary_startup(void);
> @@ -113,7 +110,9 @@ static int s500_smp_boot_secondary(unsigned int cpu, struct task_struct *idle)
>  
>  static void __init s500_smp_prepare_cpus(unsigned int max_cpus)
>  {
> +	static void __iomem *scu_base_addr;
>  	struct device_node *node;
> +	static int ncores;
>  
>  	node = of_find_compatible_node(NULL, NULL, "actions,s500-timer");
>  	if (!node) {

I fail to see what's wrong about the code, so I would rather not
needlessly refactor it.

Regards,
Andreas

Patch
diff mbox series

diff --git a/arch/arm/mach-actions/platsmp.c b/arch/arm/mach-actions/platsmp.c
index 02d17ed0ca31..98fbcaa764a5 100644
--- a/arch/arm/mach-actions/platsmp.c
+++ b/arch/arm/mach-actions/platsmp.c
@@ -34,11 +34,8 @@ 
 #define OWL_SPS_PG_CTL_ACK_CPU2	BIT(21)
 #define OWL_SPS_PG_CTL_ACK_CPU3	BIT(22)
 
-static void __iomem *scu_base_addr;
 static void __iomem *sps_base_addr;
 static void __iomem *timer_base_addr;
-static int ncores;
-
 static DEFINE_SPINLOCK(boot_lock);
 
 void owl_secondary_startup(void);
@@ -113,7 +110,9 @@  static int s500_smp_boot_secondary(unsigned int cpu, struct task_struct *idle)
 
 static void __init s500_smp_prepare_cpus(unsigned int max_cpus)
 {
+	static void __iomem *scu_base_addr;
 	struct device_node *node;
+	static int ncores;
 
 	node = of_find_compatible_node(NULL, NULL, "actions,s500-timer");
 	if (!node) {