All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pan Xinhui <xinhuix.pan@intel.com>
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>,
	"rjw@rjwysocki.net" <rjw@rjwysocki.net>,
	Viresh Kumar <viresh.kumar@linaro.org>,
	"yanmin_zhang@linux.intel.com" <yanmin_zhang@linux.intel.com>,
	"mnipxh@163.com" <mnipxh@163.com>
Subject: Re: [PATCH] acpi-cpufreq: Add a miss ifdef CONFIG_X86_ACPI_CPUFREQ_CPB
Date: Mon, 13 Jul 2015 14:33:08 +0800	[thread overview]
Message-ID: <55A35BA4.8020800@intel.com> (raw)
In-Reply-To: <CAJZ5v0jwgtgC+01p8f5a7amPcTGUfps5f2Ph9rtt77=3BEk5Cg@mail.gmail.com>

hi, Rafeal
	thanks for your reply. :)

On 2015年07月11日 04:44, Rafael J. Wysocki wrote:
> Hi,
> 
> On Fri, Jul 10, 2015 at 7:50 AM, Pan Xinhui <xinhuix.pan@intel.com> wrote:
>>
>> If CONFIG_X86_ACPI_CPUFREQ_CPB has not been defined, the placeholder for
>> cpb is not needed. Add ifdef around it.
>>
>> Signed-off-by: Pan Xinhui <xinhuix.pan@intel.com>
>> ---
>>  drivers/cpufreq/acpi-cpufreq.c | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c
>> index e7fcaa6..314a19e 100644
>> --- a/drivers/cpufreq/acpi-cpufreq.c
>> +++ b/drivers/cpufreq/acpi-cpufreq.c
>> @@ -884,7 +884,9 @@ static int acpi_cpufreq_resume(struct cpufreq_policy *policy)
>>  static struct freq_attr *acpi_cpufreq_attr[] = {
>>         &cpufreq_freq_attr_scaling_available_freqs,
>>         &freqdomain_cpus,
>> +#ifdef CONFIG_X86_ACPI_CPUFREQ_CPB
>>         NULL,   /* this is a placeholder for cpb, do not remove */
>> +#endif
> 
> Adding the ifdef here doesn't change anything, because the next NULL
> will play the role of the one you've just #ifdefed and the structure
> will be filled with zeros from that point on anyway.
> 
Yes, adding ifdef here does not change any binary codes. But I want to make the codes more readable. :)
Patch author has noticed two *NULL* here would confuse people, especially who first read this acpi-cpufreq.c file
From code style point, it would be better to have #ifdef around it. 

> You'd need to #ifdef it in the struct freq_attr definition, but I'm
> not sure it's worth the effort.
> 

struct freq_attr *cpb* is defined in #ifdef section. :)

thanks
xinhui

>>         NULL,
>>  };
> 
> Thanks,
> Rafael
> 

WARNING: multiple messages have this Message-ID (diff)
From: Pan Xinhui <xinhuix.pan@intel.com>
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>,
	"rjw@rjwysocki.net" <rjw@rjwysocki.net>,
	Viresh Kumar <viresh.kumar@linaro.org>,
	"yanmin_zhang@linux.intel.com" <yanmin_zhang@linux.intel.com>,
	"mnipxh@163.com" <mnipxh@163.com>
Subject: Re: [PATCH] acpi-cpufreq: Add a miss ifdef CONFIG_X86_ACPI_CPUFREQ_CPB
Date: Mon, 13 Jul 2015 14:33:08 +0800	[thread overview]
Message-ID: <55A35BA4.8020800@intel.com> (raw)
In-Reply-To: <CAJZ5v0jwgtgC+01p8f5a7amPcTGUfps5f2Ph9rtt77=3BEk5Cg@mail.gmail.com>

hi, Rafeal
	thanks for your reply. :)

On 2015年07月11日 04:44, Rafael J. Wysocki wrote:
> Hi,
> 
> On Fri, Jul 10, 2015 at 7:50 AM, Pan Xinhui <xinhuix.pan@intel.com> wrote:
>>
>> If CONFIG_X86_ACPI_CPUFREQ_CPB has not been defined, the placeholder for
>> cpb is not needed. Add ifdef around it.
>>
>> Signed-off-by: Pan Xinhui <xinhuix.pan@intel.com>
>> ---
>>  drivers/cpufreq/acpi-cpufreq.c | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c
>> index e7fcaa6..314a19e 100644
>> --- a/drivers/cpufreq/acpi-cpufreq.c
>> +++ b/drivers/cpufreq/acpi-cpufreq.c
>> @@ -884,7 +884,9 @@ static int acpi_cpufreq_resume(struct cpufreq_policy *policy)
>>  static struct freq_attr *acpi_cpufreq_attr[] = {
>>         &cpufreq_freq_attr_scaling_available_freqs,
>>         &freqdomain_cpus,
>> +#ifdef CONFIG_X86_ACPI_CPUFREQ_CPB
>>         NULL,   /* this is a placeholder for cpb, do not remove */
>> +#endif
> 
> Adding the ifdef here doesn't change anything, because the next NULL
> will play the role of the one you've just #ifdefed and the structure
> will be filled with zeros from that point on anyway.
> 
Yes, adding ifdef here does not change any binary codes. But I want to make the codes more readable. :)
Patch author has noticed two *NULL* here would confuse people, especially who first read this acpi-cpufreq.c file
>From code style point, it would be better to have #ifdef around it. 

> You'd need to #ifdef it in the struct freq_attr definition, but I'm
> not sure it's worth the effort.
> 

struct freq_attr *cpb* is defined in #ifdef section. :)

thanks
xinhui

>>         NULL,
>>  };
> 
> Thanks,
> Rafael
> 

  reply	other threads:[~2015-07-13  6:35 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-10  5:50 [PATCH] acpi-cpufreq: Add a miss ifdef CONFIG_X86_ACPI_CPUFREQ_CPB Pan Xinhui
2015-07-10 20:44 ` Rafael J. Wysocki
2015-07-13  6:33   ` Pan Xinhui [this message]
2015-07-13  6:33     ` Pan Xinhui
2015-07-13 23:26     ` Rafael J. Wysocki
2015-07-14  2:09       ` Pan Xinhui
2015-07-14  2:52         ` Pan Xinhui
2015-07-18  0:34           ` Rafael J. Wysocki
2015-07-20  5:14             ` Pan Xinhui
2015-07-20 21:47               ` Rafael J. Wysocki

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=55A35BA4.8020800@intel.com \
    --to=xinhuix.pan@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mnipxh@163.com \
    --cc=rafael@kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=viresh.kumar@linaro.org \
    --cc=yanmin_zhang@linux.intel.com \
    /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.