From: Viresh Kumar <viresh.kumar@linaro.org>
To: Rafael Wysocki <rjw@rjwysocki.net>,
srinivas.pandruvada@linux.intel.com,
Viresh Kumar <viresh.kumar@linaro.org>
Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH] cpufreq: acpi: Allow new dynamics attributes to be added to acpi_cpufreq_attr
Date: Thu, 3 Mar 2016 11:10:05 +0530 [thread overview]
Message-ID: <f73d4b3690f7166730bafa2e0d7b5b9dcf29f2de.1456983554.git.viresh.kumar@linaro.org> (raw)
In-Reply-To: <1456945994-5616-1-git-send-email-srinivas.pandruvada@linux.intel.com>
acpi_cpufreq_attr contains at least one dynamically populated (removed)
attribute today, cpb. But the code isn't friendly enough for new
attributes to be populated in a similar way.
Make some changes to allow new attributes to be easily added to the
struct.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
Srinivas,
This should make it easy for you to add another dynamic entry into the
acpi_cpufreq_attr structure.
drivers/cpufreq/acpi-cpufreq.c | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c
index 59a7b380fbe2..c37617ddcc9e 100644
--- a/drivers/cpufreq/acpi-cpufreq.c
+++ b/drivers/cpufreq/acpi-cpufreq.c
@@ -866,7 +866,7 @@ static struct freq_attr *acpi_cpufreq_attr[] = {
&cpufreq_freq_attr_scaling_available_freqs,
&freqdomain_cpus,
#ifdef CONFIG_X86_ACPI_CPUFREQ_CPB
- &cpb,
+ NULL, /* Extra space for cpb if required */
#endif
NULL,
};
@@ -917,6 +917,7 @@ static void acpi_cpufreq_boost_exit(void)
static int __init acpi_cpufreq_init(void)
{
+ struct freq_attr **attr;
int ret;
if (acpi_disabled)
@@ -932,6 +933,10 @@ static int __init acpi_cpufreq_init(void)
if (ret)
return ret;
+ /* Find first empty entry */
+ for (attr = acpi_cpufreq_attr; *attr; attr++)
+ ;
+
#ifdef CONFIG_X86_ACPI_CPUFREQ_CPB
/* this is a sysfs file with a strange name and an even stranger
* semantic - per CPU instantiation, but system global effect.
@@ -939,17 +944,11 @@ static int __init acpi_cpufreq_init(void)
* only if configured. This is considered legacy code, which
* will probably be removed at some point in the future.
*/
- if (!check_amd_hwpstate_cpu(0)) {
- struct freq_attr **attr;
-
+ if (check_amd_hwpstate_cpu(0))
+ *attr++ = &cpb;
+ else
pr_debug("CPB unsupported, do not expose it\n");
- for (attr = acpi_cpufreq_attr; *attr; attr++)
- if (*attr == &cpb) {
- *attr = NULL;
- break;
- }
- }
#endif
acpi_cpufreq_boost_init();
--
2.7.1.410.g6faf27b
next parent reply other threads:[~2016-03-03 5:40 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1456945994-5616-1-git-send-email-srinivas.pandruvada@linux.intel.com>
2016-03-03 5:40 ` Viresh Kumar [this message]
2016-03-03 17:29 ` Rafael J. Wysocki
2016-03-09 9:41 ` Viresh Kumar
2016-03-09 13:13 ` Rafael J. Wysocki
2016-03-16 4:53 ` Viresh Kumar
2016-03-16 12:30 ` 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=f73d4b3690f7166730bafa2e0d7b5b9dcf29f2de.1456983554.git.viresh.kumar@linaro.org \
--to=viresh.kumar@linaro.org \
--cc=linaro-kernel@lists.linaro.org \
--cc=linux-kernel@vger.kernel.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
all inboxes | Powered by JetHome®