public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH v2] arm64: cpuidle: add __init section marker to arm_cpuidle_init
@ 2015-07-02  2:14 Jisheng Zhang
  2015-07-02  3:59 ` Krzysztof Kozlowski
  0 siblings, 1 reply; 4+ messages in thread
From: Jisheng Zhang @ 2015-07-02  2:14 UTC (permalink / raw)
  To: linux-arm-kernel

It is not needed after booting, this patch moves the arm_cpuidle_init()
function to the __init section.

Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
---
 arch/arm64/include/asm/cpuidle.h | 2 +-
 arch/arm64/kernel/cpuidle.c      | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm64/include/asm/cpuidle.h b/arch/arm64/include/asm/cpuidle.h
index 0f74f05..5748d3b 100644
--- a/arch/arm64/include/asm/cpuidle.h
+++ b/arch/arm64/include/asm/cpuidle.h
@@ -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)
diff --git a/arch/arm64/kernel/cpuidle.c b/arch/arm64/kernel/cpuidle.c
index 7ce589c..9047cab6 100644
--- a/arch/arm64/kernel/cpuidle.c
+++ b/arch/arm64/kernel/cpuidle.c
@@ -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;
 
-- 
2.1.4

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

* [PATCH v2] arm64: cpuidle: add __init section marker to arm_cpuidle_init
  2015-07-02  2:14 [PATCH v2] arm64: cpuidle: add __init section marker to arm_cpuidle_init Jisheng Zhang
@ 2015-07-02  3:59 ` Krzysztof Kozlowski
  2015-07-02  4:58   ` Jisheng Zhang
  0 siblings, 1 reply; 4+ messages in thread
From: Krzysztof Kozlowski @ 2015-07-02  3:59 UTC (permalink / raw)
  To: linux-arm-kernel

2015-07-02 11:14 GMT+09:00 Jisheng Zhang <jszhang@marvell.com>:
> It is not needed after booting, this patch moves the arm_cpuidle_init()
> function to the __init section.
>
> Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
> ---
>  arch/arm64/include/asm/cpuidle.h | 2 +-
>  arch/arm64/kernel/cpuidle.c      | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm64/include/asm/cpuidle.h b/arch/arm64/include/asm/cpuidle.h
> index 0f74f05..5748d3b 100644
> --- a/arch/arm64/include/asm/cpuidle.h
> +++ b/arch/arm64/include/asm/cpuidle.h
> @@ -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...

>  extern 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

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

* [PATCH v2] arm64: cpuidle: add __init section marker to arm_cpuidle_init
  2015-07-02  3:59 ` Krzysztof Kozlowski
@ 2015-07-02  4:58   ` Jisheng Zhang
  2015-07-02  5:23     ` Krzysztof Kozlowski
  0 siblings, 1 reply; 4+ messages in thread
From: Jisheng Zhang @ 2015-07-02  4:58 UTC (permalink / raw)
  To: linux-arm-kernel

Dear Krzysztof,

On Thu, 2 Jul 2015 12:59:44 +0900
Krzysztof Kozlowski <k.kozlowski@samsung.com> wrote:

> 2015-07-02 11:14 GMT+09:00 Jisheng Zhang <jszhang@marvell.com>:
> > It is not needed after booting, this patch moves the arm_cpuidle_init()
> > function to the __init section.
> >
> > Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
> > ---
> >  arch/arm64/include/asm/cpuidle.h | 2 +-
> >  arch/arm64/kernel/cpuidle.c      | 2 +-
> >  2 files changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/arch/arm64/include/asm/cpuidle.h b/arch/arm64/include/asm/cpuidle.h
> > index 0f74f05..5748d3b 100644
> > --- a/arch/arm64/include/asm/cpuidle.h
> > +++ b/arch/arm64/include/asm/cpuidle.h
> > @@ -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...
> 
> >  extern 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

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

* [PATCH v2] arm64: cpuidle: add __init section marker to arm_cpuidle_init
  2015-07-02  4:58   ` Jisheng Zhang
@ 2015-07-02  5:23     ` Krzysztof Kozlowski
  0 siblings, 0 replies; 4+ messages in thread
From: Krzysztof Kozlowski @ 2015-07-02  5:23 UTC (permalink / raw)
  To: linux-arm-kernel

On 02.07.2015 13:58, Jisheng Zhang wrote:
> Dear Krzysztof,
> 
> On Thu, 2 Jul 2015 12:59:44 +0900
> Krzysztof Kozlowski <k.kozlowski@samsung.com> wrote:
> 
>> 2015-07-02 11:14 GMT+09:00 Jisheng Zhang <jszhang@marvell.com>:
>>> It is not needed after booting, this patch moves the arm_cpuidle_init()
>>> function to the __init section.
>>>
>>> Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
>>> ---
>>>  arch/arm64/include/asm/cpuidle.h | 2 +-
>>>  arch/arm64/kernel/cpuidle.c      | 2 +-
>>>  2 files changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/arch/arm64/include/asm/cpuidle.h b/arch/arm64/include/asm/cpuidle.h
>>> index 0f74f05..5748d3b 100644
>>> --- a/arch/arm64/include/asm/cpuidle.h
>>> +++ b/arch/arm64/include/asm/cpuidle.h
>>> @@ -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...
>>
>>>  extern 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?

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:

Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>

Best regards,
Krzysztof

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

end of thread, other threads:[~2015-07-02  5:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-02  2:14 [PATCH v2] arm64: cpuidle: add __init section marker to arm_cpuidle_init Jisheng Zhang
2015-07-02  3:59 ` Krzysztof Kozlowski
2015-07-02  4:58   ` Jisheng Zhang
2015-07-02  5:23     ` Krzysztof Kozlowski

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