public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] thermal/intel_powerclamp: add __init / __exit annotations
@ 2015-03-25 21:16 Mathias Krause
  2015-03-25 21:40 ` Jacob Pan
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Mathias Krause @ 2015-03-25 21:16 UTC (permalink / raw)
  To: Zhang Rui, Eduardo Valentin
  Cc: linux-pm, Mathias Krause, Arjan van de Ven, Jacob Pan

Mark the module init / exit functions with __init / __exit accodingly.
This allows making the intel_powerclamp_ids[] array __initconst, too, as
it only gets referenced from powerclamp_probe(). This is safe as
file2alias doesn't care about the section, but the symbol name for the
MODULE_DEVICE_TABLE alias.

Cc: Arjan van de Ven <arjan@linux.intel.com>
Cc: Jacob Pan <jacob.jun.pan@linux.intel.com>
Signed-off-by: Mathias Krause <minipli@googlemail.com>
---
 drivers/thermal/intel_powerclamp.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/thermal/intel_powerclamp.c b/drivers/thermal/intel_powerclamp.c
index 12623bc02f46..b0f7ced5c3ef 100644
--- a/drivers/thermal/intel_powerclamp.c
+++ b/drivers/thermal/intel_powerclamp.c
@@ -667,7 +667,7 @@ static struct thermal_cooling_device_ops powerclamp_cooling_ops = {
 };
 
 /* runs on Nehalem and later */
-static const struct x86_cpu_id intel_powerclamp_ids[] = {
+static const struct x86_cpu_id intel_powerclamp_ids[] __initconst = {
 	{ X86_VENDOR_INTEL, 6, 0x1a},
 	{ X86_VENDOR_INTEL, 6, 0x1c},
 	{ X86_VENDOR_INTEL, 6, 0x1e},
@@ -694,7 +694,7 @@ static const struct x86_cpu_id intel_powerclamp_ids[] = {
 };
 MODULE_DEVICE_TABLE(x86cpu, intel_powerclamp_ids);
 
-static int powerclamp_probe(void)
+static int __init powerclamp_probe(void)
 {
 	if (!x86_match_cpu(intel_powerclamp_ids)) {
 		pr_err("Intel powerclamp does not run on family %d model %d\n",
@@ -760,7 +760,7 @@ file_error:
 	debugfs_remove_recursive(debug_dir);
 }
 
-static int powerclamp_init(void)
+static int __init powerclamp_init(void)
 {
 	int retval;
 	int bitmap_size;
@@ -809,7 +809,7 @@ exit_free:
 }
 module_init(powerclamp_init);
 
-static void powerclamp_exit(void)
+static void __exit powerclamp_exit(void)
 {
 	unregister_hotcpu_notifier(&powerclamp_cpu_notifier);
 	end_power_clamp();
-- 
1.7.10.4


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

* Re: [PATCH] thermal/intel_powerclamp: add __init / __exit annotations
  2015-03-25 21:16 [PATCH] thermal/intel_powerclamp: add __init / __exit annotations Mathias Krause
@ 2015-03-25 21:40 ` Jacob Pan
  2015-03-25 21:59 ` Jacob Pan
  2015-03-30 22:48 ` Jacob Pan
  2 siblings, 0 replies; 4+ messages in thread
From: Jacob Pan @ 2015-03-25 21:40 UTC (permalink / raw)
  To: Mathias Krause; +Cc: Zhang Rui, Eduardo Valentin, linux-pm, Arjan van de Ven

On Wed, 25 Mar 2015 22:16:24 +0100
Mathias Krause <minipli@googlemail.com> wrote:

> Mark the module init / exit functions with __init / __exit accodingly.
> This allows making the intel_powerclamp_ids[] array __initconst, too,
> as it only gets referenced from powerclamp_probe(). This is safe as
> file2alias doesn't care about the section, but the symbol name for the
> MODULE_DEVICE_TABLE alias.
> 
Acked-by: Jacob Pan <jacob.jun.pan@linux.intel.com>

> Cc: Arjan van de Ven <arjan@linux.intel.com>
> Cc: Jacob Pan <jacob.jun.pan@linux.intel.com>
> Signed-off-by: Mathias Krause <minipli@googlemail.com>
> ---
>  drivers/thermal/intel_powerclamp.c |    8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/thermal/intel_powerclamp.c
> b/drivers/thermal/intel_powerclamp.c index 12623bc02f46..b0f7ced5c3ef
> 100644 --- a/drivers/thermal/intel_powerclamp.c
> +++ b/drivers/thermal/intel_powerclamp.c
> @@ -667,7 +667,7 @@ static struct thermal_cooling_device_ops
> powerclamp_cooling_ops = { };
>  
>  /* runs on Nehalem and later */
> -static const struct x86_cpu_id intel_powerclamp_ids[] = {
> +static const struct x86_cpu_id intel_powerclamp_ids[] __initconst = {
>  	{ X86_VENDOR_INTEL, 6, 0x1a},
>  	{ X86_VENDOR_INTEL, 6, 0x1c},
>  	{ X86_VENDOR_INTEL, 6, 0x1e},
> @@ -694,7 +694,7 @@ static const struct x86_cpu_id
> intel_powerclamp_ids[] = { };
>  MODULE_DEVICE_TABLE(x86cpu, intel_powerclamp_ids);
>  
> -static int powerclamp_probe(void)
> +static int __init powerclamp_probe(void)
>  {
>  	if (!x86_match_cpu(intel_powerclamp_ids)) {
>  		pr_err("Intel powerclamp does not run on family %d
> model %d\n", @@ -760,7 +760,7 @@ file_error:
>  	debugfs_remove_recursive(debug_dir);
>  }
>  
> -static int powerclamp_init(void)
> +static int __init powerclamp_init(void)
>  {
>  	int retval;
>  	int bitmap_size;
> @@ -809,7 +809,7 @@ exit_free:
>  }
>  module_init(powerclamp_init);
>  
> -static void powerclamp_exit(void)
> +static void __exit powerclamp_exit(void)
>  {
>  	unregister_hotcpu_notifier(&powerclamp_cpu_notifier);
>  	end_power_clamp();
> -- 
> 1.7.10.4
> 




-- 
Jacob Pan

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

* Re: [PATCH] thermal/intel_powerclamp: add __init / __exit annotations
  2015-03-25 21:16 [PATCH] thermal/intel_powerclamp: add __init / __exit annotations Mathias Krause
  2015-03-25 21:40 ` Jacob Pan
@ 2015-03-25 21:59 ` Jacob Pan
  2015-03-30 22:48 ` Jacob Pan
  2 siblings, 0 replies; 4+ messages in thread
From: Jacob Pan @ 2015-03-25 21:59 UTC (permalink / raw)
  To: Mathias Krause; +Cc: Zhang Rui, Eduardo Valentin, linux-pm, Arjan van de Ven

On Wed, 25 Mar 2015 22:16:24 +0100
Mathias Krause <minipli@googlemail.com> wrote:

> Mark the module init / exit functions with __init / __exit accodingly.
> This allows making the intel_powerclamp_ids[] array __initconst, too,
> as it only gets referenced from powerclamp_probe(). This is safe as
> file2alias doesn't care about the section, but the symbol name for the
> MODULE_DEVICE_TABLE alias.
> 
Acked-by: Jacob Pan <jacob.jun.pan@linux.intel.com>

> Cc: Arjan van de Ven <arjan@linux.intel.com>
> Cc: Jacob Pan <jacob.jun.pan@linux.intel.com>
> Signed-off-by: Mathias Krause <minipli@googlemail.com>
> ---
>  drivers/thermal/intel_powerclamp.c |    8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/thermal/intel_powerclamp.c
> b/drivers/thermal/intel_powerclamp.c index 12623bc02f46..b0f7ced5c3ef
> 100644 --- a/drivers/thermal/intel_powerclamp.c
> +++ b/drivers/thermal/intel_powerclamp.c
> @@ -667,7 +667,7 @@ static struct thermal_cooling_device_ops
> powerclamp_cooling_ops = { };
>  
>  /* runs on Nehalem and later */
> -static const struct x86_cpu_id intel_powerclamp_ids[] = {
> +static const struct x86_cpu_id intel_powerclamp_ids[] __initconst = {
>  	{ X86_VENDOR_INTEL, 6, 0x1a},
>  	{ X86_VENDOR_INTEL, 6, 0x1c},
>  	{ X86_VENDOR_INTEL, 6, 0x1e},
> @@ -694,7 +694,7 @@ static const struct x86_cpu_id
> intel_powerclamp_ids[] = { };
>  MODULE_DEVICE_TABLE(x86cpu, intel_powerclamp_ids);
>  
> -static int powerclamp_probe(void)
> +static int __init powerclamp_probe(void)
>  {
>  	if (!x86_match_cpu(intel_powerclamp_ids)) {
>  		pr_err("Intel powerclamp does not run on family %d
> model %d\n", @@ -760,7 +760,7 @@ file_error:
>  	debugfs_remove_recursive(debug_dir);
>  }
>  
> -static int powerclamp_init(void)
> +static int __init powerclamp_init(void)
>  {
>  	int retval;
>  	int bitmap_size;
> @@ -809,7 +809,7 @@ exit_free:
>  }
>  module_init(powerclamp_init);
>  
> -static void powerclamp_exit(void)
> +static void __exit powerclamp_exit(void)
>  {
>  	unregister_hotcpu_notifier(&powerclamp_cpu_notifier);
>  	end_power_clamp();
> -- 
> 1.7.10.4
> 




-- 
Jacob Pan

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

* Re: [PATCH] thermal/intel_powerclamp: add __init / __exit annotations
  2015-03-25 21:16 [PATCH] thermal/intel_powerclamp: add __init / __exit annotations Mathias Krause
  2015-03-25 21:40 ` Jacob Pan
  2015-03-25 21:59 ` Jacob Pan
@ 2015-03-30 22:48 ` Jacob Pan
  2 siblings, 0 replies; 4+ messages in thread
From: Jacob Pan @ 2015-03-30 22:48 UTC (permalink / raw)
  To: Mathias Krause; +Cc: Zhang Rui, Eduardo Valentin, linux-pm, Arjan van de Ven

On Wed, 25 Mar 2015 22:16:24 +0100
Mathias Krause <minipli@googlemail.com> wrote:

> Mark the module init / exit functions with __init / __exit accodingly.
> This allows making the intel_powerclamp_ids[] array __initconst, too,
> as it only gets referenced from powerclamp_probe(). This is safe as
> file2alias doesn't care about the section, but the symbol name for the
> MODULE_DEVICE_TABLE alias.
> 
looks good to me.

Thanks,

Jacob
> Cc: Arjan van de Ven <arjan@linux.intel.com>
> Cc: Jacob Pan <jacob.jun.pan@linux.intel.com>
> Signed-off-by: Mathias Krause <minipli@googlemail.com>
> ---
>  drivers/thermal/intel_powerclamp.c |    8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/thermal/intel_powerclamp.c
> b/drivers/thermal/intel_powerclamp.c index 12623bc02f46..b0f7ced5c3ef
> 100644 --- a/drivers/thermal/intel_powerclamp.c
> +++ b/drivers/thermal/intel_powerclamp.c
> @@ -667,7 +667,7 @@ static struct thermal_cooling_device_ops
> powerclamp_cooling_ops = { };
>  
>  /* runs on Nehalem and later */
> -static const struct x86_cpu_id intel_powerclamp_ids[] = {
> +static const struct x86_cpu_id intel_powerclamp_ids[] __initconst = {
>  	{ X86_VENDOR_INTEL, 6, 0x1a},
>  	{ X86_VENDOR_INTEL, 6, 0x1c},
>  	{ X86_VENDOR_INTEL, 6, 0x1e},
> @@ -694,7 +694,7 @@ static const struct x86_cpu_id
> intel_powerclamp_ids[] = { };
>  MODULE_DEVICE_TABLE(x86cpu, intel_powerclamp_ids);
>  
> -static int powerclamp_probe(void)
> +static int __init powerclamp_probe(void)
>  {
>  	if (!x86_match_cpu(intel_powerclamp_ids)) {
>  		pr_err("Intel powerclamp does not run on family %d
> model %d\n", @@ -760,7 +760,7 @@ file_error:
>  	debugfs_remove_recursive(debug_dir);
>  }
>  
> -static int powerclamp_init(void)
> +static int __init powerclamp_init(void)
>  {
>  	int retval;
>  	int bitmap_size;
> @@ -809,7 +809,7 @@ exit_free:
>  }
>  module_init(powerclamp_init);
>  
> -static void powerclamp_exit(void)
> +static void __exit powerclamp_exit(void)
>  {
>  	unregister_hotcpu_notifier(&powerclamp_cpu_notifier);
>  	end_power_clamp();
> -- 
> 1.7.10.4
> 




-- 
Jacob Pan

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

end of thread, other threads:[~2015-03-30 22:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-25 21:16 [PATCH] thermal/intel_powerclamp: add __init / __exit annotations Mathias Krause
2015-03-25 21:40 ` Jacob Pan
2015-03-25 21:59 ` Jacob Pan
2015-03-30 22:48 ` Jacob Pan

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