Linux Power Management development
 help / color / mirror / Atom feed
From: Viresh Kumar <viresh.kumar@linaro.org>
To: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Cc: rjw@rjwysocki.net, linux-pm@vger.kernel.org
Subject: Re: [PATCH] cpufreq: acpi_cpufreq: base frequency attribute support
Date: Wed, 2 Mar 2016 08:08:22 +0530	[thread overview]
Message-ID: <20160302023822.GM16437@vireshk-i7> (raw)
In-Reply-To: <1456855841.21069.59.camel@linux.intel.com>

On 01-03-16, 10:10, Srinivas Pandruvada wrote:
> > What about:
> > 
> >                                 acpi_cpufreq_attr[ARRAY_SIZE(acpi_cpu
> > freq_attr) - 2] = &base_frequency;
> > 
> >                                 and a comment to describe that ?
> > 
> Will it work in this case?
> "
> Even if CONFIG_X86_ACPI_CPUFREQ_CPB is defined, 
> acpi_cpufreq_attr[2] will be set to NULL in the init callback when
> some condition fails. So we will have a NULL in the acpi_cpufreq_attr[]
> before &base_frequency if we add at fixed place. 
> "

Oh dude, you already have this hack in place in a different way. Though its
doable this way:

diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c
index 51eef87bbc37..26c026a34e1e 100644
--- a/drivers/cpufreq/acpi-cpufreq.c
+++ b/drivers/cpufreq/acpi-cpufreq.c
@@ -937,7 +937,7 @@ static void acpi_cpufreq_boost_exit(void)
 
 static int __init acpi_cpufreq_init(void)
 {
-       int ret;
+       int ret, cpb_removed = 0;
 
        if (acpi_disabled)
                return -ENODEV;
@@ -967,6 +967,7 @@ static int __init acpi_cpufreq_init(void)
                for (attr = acpi_cpufreq_attr; *attr; attr++)
                        if (*attr == &cpb) {
                                *attr = NULL;
+                               cpb_removed = 1;
                                break;
                        }
        }

And then the above statement:

acpi_cpufreq_attr[ARRAY_SIZE(acpi_cpufreq_attr) - 2 - cpb_removed] = &base_frequency;

But I would rather add another patch first to set the CPB thing in the array to
NULL and remove the ifdef from within the array. And then set it to a valid
attribute only if we are making an addition. And then you can easily keep a
count of the next NULL entry you can update.

-- 
viresh

  reply	other threads:[~2016-03-02  2:38 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-29 20:36 [PATCH] cpufreq: acpi_cpufreq: base frequency attribute support Srinivas Pandruvada
2016-03-01  2:28 ` Viresh Kumar
2016-03-01 18:10   ` Srinivas Pandruvada
2016-03-02  2:38     ` Viresh Kumar [this message]
  -- strict thread matches above, loose matches on Subject: below --
2015-10-01 22:25 Srinivas Pandruvada
2015-10-07 17:23 ` Viresh Kumar
2015-10-09 15:34   ` Srinivas Pandruvada
2015-10-15 22:45   ` Rafael J. Wysocki
2015-10-16  5:42     ` Viresh Kumar
2016-02-24 20:00       ` Srinivas Pandruvada
2016-02-24 20:05         ` Rafael J. Wysocki
2016-02-24 23:37           ` Srinivas Pandruvada
2016-02-25  3:27             ` Viresh Kumar
2016-02-25 18:07               ` Srinivas Pandruvada
2016-02-26  1:10                 ` Pandruvada, Srinivas
2016-02-26  1:57                 ` Viresh Kumar
2016-02-26 20:21                   ` Srinivas Pandruvada
2016-02-29  3:16                     ` Viresh Kumar
2016-02-29 17:11                       ` Srinivas Pandruvada
2016-03-01  2:16                         ` Viresh Kumar

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=20160302023822.GM16437@vireshk-i7 \
    --to=viresh.kumar@linaro.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=srinivas.pandruvada@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox