From: "Srivatsa S. Bhat" <srivatsa.bhat@linux.vnet.ibm.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
Ingo Molnar <mingo@elte.hu>,
Rusty Russell <rusty@rustcorp.com.au>,
"Rafael J. Wysocki" <rjw@sisk.pl>,
linux-kernel <linux-kernel@vger.kernel.org>,
linux-pm <linux-pm@vger.kernel.org>,
linux-next <linux-next@vger.kernel.org>,
Fenghua Yu <fenghua.yu@intel.com>
Subject: Re: [PATCH] kernel/cpu.c: Add right qualifiers for intel_thermal_interrupt() and cpu_hotplug_pm_sync_init()
Date: Fri, 11 Nov 2011 12:56:43 +0530 [thread overview]
Message-ID: <4EBCCE33.2090708@linux.vnet.ibm.com> (raw)
In-Reply-To: <1320956564-21334-1-git-send-email-fenghua.yu@intel.com>
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;
WARNING: multiple messages have this Message-ID (diff)
From: "Srivatsa S. Bhat" <srivatsa.bhat@linux.vnet.ibm.com>
To: Fenghua Yu <fenghua.yu@intel.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
Ingo Molnar <mingo@elte.hu>,
Rusty Russell <rusty@rustcorp.com.au>,
"Rafael J. Wysocki" <rjw@sisk.pl>,
linux-kernel <linux-kernel@vger.kernel.org>,
linux-pm <linux-pm@vger.kernel.org>,
linux-next <linux-next@vger.kernel.org>,
Fenghua Yu <fenghua.yu@intel.com>
Subject: Re: [PATCH] kernel/cpu.c: Add right qualifiers for intel_thermal_interrupt() and cpu_hotplug_pm_sync_init()
Date: Fri, 11 Nov 2011 12:56:43 +0530 [thread overview]
Message-ID: <4EBCCE33.2090708@linux.vnet.ibm.com> (raw)
In-Reply-To: <1320956564-21334-1-git-send-email-fenghua.yu@intel.com>
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;
next prev parent reply other threads:[~2011-11-11 7:26 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
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-10 20:22 ` Fenghua Yu
2011-11-11 7:26 ` Srivatsa S. Bhat [this message]
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
2011-11-14 23:56 ` Fenghua Yu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4EBCCE33.2090708@linux.vnet.ibm.com \
--to=srivatsa.bhat@linux.vnet.ibm.com \
--cc=fenghua.yu@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-next@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=rjw@sisk.pl \
--cc=rusty@rustcorp.com.au \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.