* [PATCH] kernel/cpu.c: Add right qualifiers for intel_thermal_interrupt() and cpu_hotplug_pm_sync_init()
@ 2011-11-10 20:22 Fenghua Yu
2011-11-11 7:26 ` Srivatsa S. Bhat
0 siblings, 1 reply; 5+ messages in thread
From: Fenghua Yu @ 2011-11-10 20:22 UTC (permalink / raw)
To: Linus Torvalds, Ingo Molnar, Rusty Russell, Rafael J. Wysocki,
"Srivatsa S. Bhat" <sriva>
Cc: linux-kernel, linux-pm, linux-next, Fenghua Yu
From: Fenghua Yu <fenghua.yu@intel.com>
Add __init for functions alloc_frozen_cpus() and cpu_hotplug_pm_sync_init()
because they are only called during boot time.
Add static for function cpu_hotplug_pm_sync_init() because its scope is limited
in this file only.
Signed-off-by: Fenghua Yu <fenghua.yu@intel.com>
---
kernel/cpu.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/cpu.c b/kernel/cpu.c
index 563f136..cf915b8 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -470,7 +470,7 @@ out:
cpu_maps_update_done();
}
-static int alloc_frozen_cpus(void)
+static int __init alloc_frozen_cpus(void)
{
if (!alloc_cpumask_var(&frozen_cpus, GFP_KERNEL|__GFP_ZERO))
return -ENOMEM;
@@ -543,7 +543,7 @@ cpu_hotplug_pm_callback(struct notifier_block *nb,
}
-int cpu_hotplug_pm_sync_init(void)
+static int __init cpu_hotplug_pm_sync_init(void)
{
pm_notifier(cpu_hotplug_pm_callback, 0);
return 0;
--
1.6.0.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] kernel/cpu.c: Add right qualifiers for intel_thermal_interrupt() and cpu_hotplug_pm_sync_init()
2011-11-10 20:22 [PATCH] kernel/cpu.c: Add right qualifiers for intel_thermal_interrupt() and cpu_hotplug_pm_sync_init() Fenghua Yu
@ 2011-11-11 7:26 ` Srivatsa S. Bhat
2011-11-15 0:02 ` Yu, Fenghua
0 siblings, 1 reply; 5+ messages in thread
From: Srivatsa S. Bhat @ 2011-11-11 7:26 UTC (permalink / raw)
Cc: Linus Torvalds, Ingo Molnar, Rusty Russell, Rafael J. Wysocki,
linux-kernel, linux-pm, linux-next, Fenghua Yu
On 11/11/2011 01:52 AM, Fenghua Yu wrote:
> From: Fenghua Yu <fenghua.yu@intel.com>
>
> Add __init for functions alloc_frozen_cpus() and cpu_hotplug_pm_sync_init()
> because they are only called during boot time.
>
> Add static for function cpu_hotplug_pm_sync_init() because its scope is limited
> in this file only.
>
> Signed-off-by: Fenghua Yu <fenghua.yu@intel.com>
> ---
> kernel/cpu.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/cpu.c b/kernel/cpu.c
> index 563f136..cf915b8 100644
> --- a/kernel/cpu.c
> +++ b/kernel/cpu.c
> @@ -470,7 +470,7 @@ out:
> cpu_maps_update_done();
> }
>
> -static int alloc_frozen_cpus(void)
> +static int __init alloc_frozen_cpus(void)
> {
> if (!alloc_cpumask_var(&frozen_cpus, GFP_KERNEL|__GFP_ZERO))
> return -ENOMEM;
> @@ -543,7 +543,7 @@ cpu_hotplug_pm_callback(struct notifier_block *nb,
> }
>
>
> -int cpu_hotplug_pm_sync_init(void)
> +static int __init cpu_hotplug_pm_sync_init(void)
> {
> pm_notifier(cpu_hotplug_pm_callback, 0);
pm_notifier() macro will declare a static variable. I agree this won't
be any problem functionality-wise. But it doesn't seem elegant to say
"throw away the function but keep the static variable".
So, if you want to add __init qualifier to this function, I suggest that
you declare the static variable outside the function, and call
register_pm_notifier() in the function, just to ensure it doesn't obscure
things.
And please change the title, it talks about intel_thermal_interrupt()!
Thanks,
Srivatsa S. Bhat
> return 0;
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] kernel/cpu.c: Add right qualifiers for intel_thermal_interrupt() and cpu_hotplug_pm_sync_init()
@ 2011-11-14 23:56 Fenghua Yu
0 siblings, 0 replies; 5+ messages in thread
From: Fenghua Yu @ 2011-11-14 23:56 UTC (permalink / raw)
To: Linus Torvalds, Ingo Molnar, Andrew Morton, Rusty Russell,
Rafael
Cc: linux-kernel, linux-pm, linux-next, Fenghua Yu
From: Fenghua Yu <fenghua.yu@intel.com>
Add __init for functions alloc_frozen_cpus() and cpu_hotplug_pm_sync_init()
because they are only called during boot time.
Add static for function cpu_hotplug_pm_sync_init() because its scope is limited
in this file only.
Signed-off-by: Fenghua Yu <fenghua.yu@intel.com>
---
kernel/cpu.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/cpu.c b/kernel/cpu.c
index 563f136..cf915b8 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -470,7 +470,7 @@ out:
cpu_maps_update_done();
}
-static int alloc_frozen_cpus(void)
+static int __init alloc_frozen_cpus(void)
{
if (!alloc_cpumask_var(&frozen_cpus, GFP_KERNEL|__GFP_ZERO))
return -ENOMEM;
@@ -543,7 +543,7 @@ cpu_hotplug_pm_callback(struct notifier_block *nb,
}
-int cpu_hotplug_pm_sync_init(void)
+static int __init cpu_hotplug_pm_sync_init(void)
{
pm_notifier(cpu_hotplug_pm_callback, 0);
return 0;
--
1.6.0.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* RE: [PATCH] kernel/cpu.c: Add right qualifiers for intel_thermal_interrupt() and cpu_hotplug_pm_sync_init()
2011-11-11 7:26 ` Srivatsa S. Bhat
@ 2011-11-15 0:02 ` Yu, Fenghua
2011-11-15 5:58 ` Srivatsa S. Bhat
0 siblings, 1 reply; 5+ messages in thread
From: Yu, Fenghua @ 2011-11-15 0:02 UTC (permalink / raw)
To: Srivatsa S. Bhat
Cc: Linus Torvalds, Ingo Molnar, Rusty Russell, Rafael J. Wysocki,
linux-kernel, linux-pm, linux-next
> > -int cpu_hotplug_pm_sync_init(void)
> > +static int __init cpu_hotplug_pm_sync_init(void)
> > {
> > pm_notifier(cpu_hotplug_pm_callback, 0);
>
> pm_notifier() macro will declare a static variable. I agree this won't
> be any problem functionality-wise. But it doesn't seem elegant to say
> "throw away the function but keep the static variable".
> So, if you want to add __init qualifier to this function, I suggest
> that
> you declare the static variable outside the function, and call
> register_pm_notifier() in the function, just to ensure it doesn't
> obscure
> things.
>
Rmoving __init cpu_hotplug_pm_sync_init() function after boot time and keep the static data defined in pm_notifier() is a normal behavior and normal usage in kernel. Same notifier registration usage function examples are ia64_mca_init() and msic_init() in mrst.c. There are quite a few other similar static data in __init functions usage examples in kernel source code.
So I would keep the same code in the patch.
I'll send an updated patch just to change the title typo.
Thanks.
-Fenghua
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] kernel/cpu.c: Add right qualifiers for intel_thermal_interrupt() and cpu_hotplug_pm_sync_init()
2011-11-15 0:02 ` Yu, Fenghua
@ 2011-11-15 5:58 ` Srivatsa S. Bhat
0 siblings, 0 replies; 5+ messages in thread
From: Srivatsa S. Bhat @ 2011-11-15 5:58 UTC (permalink / raw)
To: Yu, Fenghua
Cc: Linus Torvalds, Ingo Molnar, Rusty Russell, Rafael J. Wysocki,
linux-kernel, linux-pm, linux-next
On 11/15/2011 05:32 AM, Yu, Fenghua wrote:
>>> -int cpu_hotplug_pm_sync_init(void)
>>> +static int __init cpu_hotplug_pm_sync_init(void)
>>> {
>>> pm_notifier(cpu_hotplug_pm_callback, 0);
>>
>> pm_notifier() macro will declare a static variable. I agree this won't
>> be any problem functionality-wise. But it doesn't seem elegant to say
>> "throw away the function but keep the static variable".
>> So, if you want to add __init qualifier to this function, I suggest
>> that
>> you declare the static variable outside the function, and call
>> register_pm_notifier() in the function, just to ensure it doesn't
>> obscure
>> things.
>>
> Rmoving __init cpu_hotplug_pm_sync_init() function after boot time and keep the static data defined in pm_notifier() is a normal behavior and normal usage in kernel. Same notifier registration usage function examples are ia64_mca_init() and msic_init() in mrst.c. There are quite a few other similar static data in __init functions usage examples in kernel source code.
>
> So I would keep the same code in the patch.
>
If that's a well-known practice and is not going to obscure anything,
then I am fine with your patch.
Thanks,
Srivatsa S. Bhat
> I'll send an updated patch just to change the title typo.
>
> Thanks.
>
> -Fenghua
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-11-15 6:23 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-10 20:22 [PATCH] kernel/cpu.c: Add right qualifiers for intel_thermal_interrupt() and cpu_hotplug_pm_sync_init() Fenghua Yu
2011-11-11 7:26 ` Srivatsa S. Bhat
2011-11-15 0:02 ` Yu, Fenghua
2011-11-15 5:58 ` Srivatsa S. Bhat
-- strict thread matches above, loose matches on Subject: below --
2011-11-14 23:56 Fenghua Yu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).