[1/6] acpi : move the acpi_idle_driver variable declaration

Message ID 1347013172-12465-2-git-send-email-daniel.lezcano@linaro.org
State New
Headers show

Commit Message

Daniel Lezcano Sept. 7, 2012, 10:19 a.m.
This variable is only used in the in processor_driver.c.
This patch reduces the scope of the variable by moving it
to this file.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Acked-by: Peter De Schrijver <pdeschrijver@nvidia.com>
Tested-by: Peter De Schrijver <pdeschrijver@nvidia.com>
---
 drivers/acpi/processor_driver.c |    2 +-
 include/acpi/processor.h        |    1 -
 2 files changed, 1 insertions(+), 2 deletions(-)

Comments

Rafael J. Wysocki Sept. 7, 2012, 9:19 p.m. | #1
On Friday, September 07, 2012, Daniel Lezcano wrote:
> This variable is only used in the in processor_driver.c.
> This patch reduces the scope of the variable by moving it
> to this file.

Well, the changelog is wrong (because the scope of the variable is
not reduced by moving it out of the header) and I don't see the point.

Is there any _real_ problem with that definition in processor.h?

Rafael


> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
> Acked-by: Peter De Schrijver <pdeschrijver@nvidia.com>
> Tested-by: Peter De Schrijver <pdeschrijver@nvidia.com>
> ---
>  drivers/acpi/processor_driver.c |    2 +-
>  include/acpi/processor.h        |    1 -
>  2 files changed, 1 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/acpi/processor_driver.c b/drivers/acpi/processor_driver.c
> index bfc31cb..e1f6330 100644
> --- a/drivers/acpi/processor_driver.c
> +++ b/drivers/acpi/processor_driver.c
> @@ -113,7 +113,7 @@ static struct acpi_driver acpi_processor_driver = {
>  
>  DEFINE_PER_CPU(struct acpi_processor *, processors);
>  EXPORT_PER_CPU_SYMBOL(processors);
> -
> +extern struct cpuidle_driver acpi_idle_driver;
>  struct acpi_processor_errata errata __read_mostly;
>  
>  /* --------------------------------------------------------------------------
> diff --git a/include/acpi/processor.h b/include/acpi/processor.h
> index db427fa..8b2c39a 100644
> --- a/include/acpi/processor.h
> +++ b/include/acpi/processor.h
> @@ -332,7 +332,6 @@ int acpi_processor_power_exit(struct acpi_processor *pr,
>  			      struct acpi_device *device);
>  int acpi_processor_suspend(struct device *dev);
>  int acpi_processor_resume(struct device *dev);
> -extern struct cpuidle_driver acpi_idle_driver;
>  
>  /* in processor_thermal.c */
>  int acpi_processor_get_limit_info(struct acpi_processor *pr);
>
Daniel Lezcano Sept. 11, 2012, 11:14 a.m. | #2
On 09/07/2012 11:19 PM, Rafael J. Wysocki wrote:
> On Friday, September 07, 2012, Daniel Lezcano wrote:
>> This variable is only used in the in processor_driver.c.
>> This patch reduces the scope of the variable by moving it
>> to this file.
> 
> Well, the changelog is wrong (because the scope of the variable is
> not reduced by moving it out of the header) and I don't see the point.

Yes, you are right.

> Is there any _real_ problem with that definition in processor.h?

It is not a real problem. There is no issue fixed by this patch.
It is just reorganizing the code little by little. The intent is to
group what is related to cpuidle to the C files here processor_driver.c.


>> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
>> Acked-by: Peter De Schrijver <pdeschrijver@nvidia.com>
>> Tested-by: Peter De Schrijver <pdeschrijver@nvidia.com>
>> ---
>>  drivers/acpi/processor_driver.c |    2 +-
>>  include/acpi/processor.h        |    1 -
>>  2 files changed, 1 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/acpi/processor_driver.c b/drivers/acpi/processor_driver.c
>> index bfc31cb..e1f6330 100644
>> --- a/drivers/acpi/processor_driver.c
>> +++ b/drivers/acpi/processor_driver.c
>> @@ -113,7 +113,7 @@ static struct acpi_driver acpi_processor_driver = {
>>  
>>  DEFINE_PER_CPU(struct acpi_processor *, processors);
>>  EXPORT_PER_CPU_SYMBOL(processors);
>> -
>> +extern struct cpuidle_driver acpi_idle_driver;
>>  struct acpi_processor_errata errata __read_mostly;
>>  
>>  /* --------------------------------------------------------------------------
>> diff --git a/include/acpi/processor.h b/include/acpi/processor.h
>> index db427fa..8b2c39a 100644
>> --- a/include/acpi/processor.h
>> +++ b/include/acpi/processor.h
>> @@ -332,7 +332,6 @@ int acpi_processor_power_exit(struct acpi_processor *pr,
>>  			      struct acpi_device *device);
>>  int acpi_processor_suspend(struct device *dev);
>>  int acpi_processor_resume(struct device *dev);
>> -extern struct cpuidle_driver acpi_idle_driver;
>>  
>>  /* in processor_thermal.c */
>>  int acpi_processor_get_limit_info(struct acpi_processor *pr);
>>
>
Rafael J. Wysocki Sept. 11, 2012, 8:28 p.m. | #3
On Tuesday, September 11, 2012, Daniel Lezcano wrote:
> On 09/07/2012 11:19 PM, Rafael J. Wysocki wrote:
> > On Friday, September 07, 2012, Daniel Lezcano wrote:
> >> This variable is only used in the in processor_driver.c.
> >> This patch reduces the scope of the variable by moving it
> >> to this file.
> > 
> > Well, the changelog is wrong (because the scope of the variable is
> > not reduced by moving it out of the header) and I don't see the point.
> 
> Yes, you are right.
> 
> > Is there any _real_ problem with that definition in processor.h?
> 
> It is not a real problem. There is no issue fixed by this patch.
> It is just reorganizing the code little by little. The intent is to
> group what is related to cpuidle to the C files here processor_driver.c.

However, it is not recommended to put "extern something" type of declarations
into *.c files.  All of them should go into headers (although not necessarily
in include/linux for that matter).

Thanks,
Rafael

Patch

diff --git a/drivers/acpi/processor_driver.c b/drivers/acpi/processor_driver.c
index bfc31cb..e1f6330 100644
--- a/drivers/acpi/processor_driver.c
+++ b/drivers/acpi/processor_driver.c
@@ -113,7 +113,7 @@  static struct acpi_driver acpi_processor_driver = {
 
 DEFINE_PER_CPU(struct acpi_processor *, processors);
 EXPORT_PER_CPU_SYMBOL(processors);
-
+extern struct cpuidle_driver acpi_idle_driver;
 struct acpi_processor_errata errata __read_mostly;
 
 /* --------------------------------------------------------------------------
diff --git a/include/acpi/processor.h b/include/acpi/processor.h
index db427fa..8b2c39a 100644
--- a/include/acpi/processor.h
+++ b/include/acpi/processor.h
@@ -332,7 +332,6 @@  int acpi_processor_power_exit(struct acpi_processor *pr,
 			      struct acpi_device *device);
 int acpi_processor_suspend(struct device *dev);
 int acpi_processor_resume(struct device *dev);
-extern struct cpuidle_driver acpi_idle_driver;
 
 /* in processor_thermal.c */
 int acpi_processor_get_limit_info(struct acpi_processor *pr);