arm64: cpuidle: add __init section marker to arm_cpuidle_init
PATCH v2 1/1 arm64: cpuidle: add __init section marker to arm_cpuidle_init
It is not needed after booting, this patch moves the arm_cpuidle_init() function to the __init section.
--- arch/arm64/include/asm/cpuidle.h | 2 +- arch/arm64/kernel/cpuidle.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm64/include/asm/cpuidle.h +1 -1
@@ -4,7 +4,7 @@#include <asm/proc-fns.h> #ifdef CONFIG_CPU_IDLE -extern int arm_cpuidle_init (unsigned int cpu); +extern int __init arm_cpuidle_init (unsigned int cpu);extern int arm_cpuidle_suspend (int index);#else static inline int arm_cpuidle_init (unsigned int cpu)
arch/arm64/kernel/cpuidle.c +1 -1
@@ -15,7 +15,7 @@#include <asm/cpuidle.h> #include <asm/cpu_ops.h> -int arm_cpuidle_init (unsigned int cpu) +int __init arm_cpuidle_init (unsigned int cpu) {int ret = -EOPNOTSUPP ;
Signature · 1 line
2.1.4
2015-07-02 11:14 GMT+09:00 Jisheng Zhang <[email protected]>:
Quoted 14 lines
It is not needed after booting, this patch moves the
arm_cpuidle_init()function to the__initsection.Signed-off-by Jisheng Zhang <[email protected]>--- arch/arm64/include/asm/cpuidle.h | 2 +- arch/arm64/kernel/cpuidle.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)arch/arm64/include/asm/cpuidle.h +0
-0
arch/arm64/include/asm/cpuidle.h line 7
Quoted 5 lines
arch/arm64/include/asm/cpuidle.h +1
-1@@ -4,7 +4,7 @@#include <asm/proc-fns.h> #ifdef CONFIG_CPU_IDLE -extern int arm_cpuidle_init (unsigned int cpu); +extern int __init arm_cpuidle_init (unsigned int cpu);
No, not here but...
arch/arm64/include/asm/cpuidle.h line 10
Quoted 3 lines
arch/arm64/include/asm/cpuidle.h +0
-0extern int arm_cpuidle_suspend (int index);#else static inline int arm_cpuidle_init (unsigned int cpu)
... here so the stub for !CONFIG_CPU_IDLE would be marked as well.
Best regards,
Krzysztof
Dear Krzysztof,
Quoted 23 lines · On Thu, 2 Jul 2015 12:59:44 +0900 Krzysztof Kozlowski…
2015-07-02 11:14 GMT+09:00 Jisheng Zhang <[email protected]>:
Quoted 14 lines
It is not needed after booting, this patch moves the
arm_cpuidle_init()function to the__initsection.Signed-off-by Jisheng Zhang <[email protected]>--- arch/arm64/include/asm/cpuidle.h | 2 +- arch/arm64/kernel/cpuidle.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)arch/arm64/include/asm/cpuidle.h +0
-0arch/arm64/include/asm/cpuidle.h line 7
Quoted 5 lines
arch/arm64/include/asm/cpuidle.h +1
-1@@ -4,7 +4,7 @@#include <asm/proc-fns.h> #ifdef CONFIG_CPU_IDLE -extern int arm_cpuidle_init (unsigned int cpu); +extern int __init arm_cpuidle_init (unsigned int cpu);No, not here but...
Quoted 5 lines
arch/arm64/include/asm/cpuidle.h line 10
Quoted 3 lines
arch/arm64/include/asm/cpuidle.h +0
-0extern int arm_cpuidle_suspend (int index);#else static inline int arm_cpuidle_init (unsigned int cpu)... here so the stub for !CONFIG_CPU_IDLE would be marked as well.
when !CONFIG_CPU_IDLE, arm_cpuidle_init() is inlined, and just return -EOPNOTSUPP; Per my understanding, it will be optimized out by compiler. I'm not sure whether there is any benefit to mark inlined function as __init. But Per my check, all other inlined functions in linux kernel have no __init. What do you think?
Thanks,
Jisheng
Krzysztof Kozlowski
Reviewed-byQuoted 32 lines · Jisheng Zhang
Dear Krzysztof,
Quoted 27 lines · On Thu, 2 Jul 2015 12:59:44 +0900 Krzysztof Kozlowski…
2015-07-02 11:14 GMT+09:00 Jisheng Zhang <[email protected]>:
Quoted 14 lines
It is not needed after booting, this patch moves the
arm_cpuidle_init()function to the__initsection.Signed-off-by Jisheng Zhang <[email protected]>--- arch/arm64/include/asm/cpuidle.h | 2 +- arch/arm64/kernel/cpuidle.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)arch/arm64/include/asm/cpuidle.h +0
-0arch/arm64/include/asm/cpuidle.h line 7
Quoted 5 lines
arch/arm64/include/asm/cpuidle.h +1
-1@@ -4,7 +4,7 @@#include <asm/proc-fns.h> #ifdef CONFIG_CPU_IDLE -extern int arm_cpuidle_init (unsigned int cpu); +extern int __init arm_cpuidle_init (unsigned int cpu);No, not here but...
Quoted 3 lines
arch/arm64/include/asm/cpuidle.h +0
-0extern int arm_cpuidle_suspend (int index);#else static inline int arm_cpuidle_init (unsigned int cpu)
Quoted 6 lines
Quoted 1 line
... here so the stub for !CONFIG_CPU_IDLE would be marked as well.
when !CONFIG_CPU_IDLE,
arm_cpuidle_init()is inlined, and just return-EOPNOTSUPP; Per my understanding, it will be optimized out by compiler. I'm not sure whether there is any benefit to mark inlined function as__init. But Per my check, all other inlined functions in linux kernel have no__init. What do you think?
Yes, you're right, the inline is sufficient so this means that actually the first patch was correct. The __init is not needed in extern declaration. For both versions then:
Best regards,
Krzysztof