From: Viresh Kumar <viresh.kumar@linaro.org>
To: rjw@rjwysocki.net, Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com>
Cc: linuxppc-dev@ozlabs.org, linux-kernel@vger.kernel.org,
linux-pm@vger.kernel.org, ego@linux.vnet.ibm.com,
shreyas@linux.vnet.ibm.com, linux-api@vger.kernel.org
Subject: Re: [PATCH v10 2/2] cpufreq: powernv: Add sysfs attributes to show throttle stats
Date: Mon, 29 Feb 2016 12:09:17 +0530 [thread overview]
Message-ID: <20160229063917.GK2791@vireshk-i7> (raw)
In-Reply-To: <1456483012-29466-3-git-send-email-shilpa.bhat@linux.vnet.ibm.com>
On 26-02-16, 16:06, Shilpasri G Bhat wrote:
> +static int powernv_cpufreq_policy_notifier(struct notifier_block *nb,
> + unsigned long action, void *data)
> +{
> + struct cpufreq_policy *policy = data;
> + int ret;
> +
> + if (action == CPUFREQ_CREATE_POLICY) {
> + ret = sysfs_create_group(&policy->kobj, &throttle_attr_grp);
> + if (ret)
> + pr_info("Failed to create throttle stats directory for cpu %d\n",
> + policy->cpu);
> + } else if (action == CPUFREQ_REMOVE_POLICY) {
> + sysfs_remove_group(&policy->kobj, &throttle_attr_grp);
> + }
> +
> + return NOTIFY_DONE;
> +}
> +
> +static struct notifier_block powernv_cpufreq_policy_nb = {
> + .notifier_call = powernv_cpufreq_policy_notifier,
> + .next = NULL,
> +};
> +
> static void powernv_cpufreq_stop_cpu(struct cpufreq_policy *policy)
> {
> struct powernv_smp_call_data freq_data;
> @@ -603,6 +708,8 @@ static inline void clean_chip_info(void)
>
> static inline void unregister_all_notifiers(void)
> {
> + cpufreq_unregister_notifier(&powernv_cpufreq_policy_nb,
> + CPUFREQ_POLICY_NOTIFIER);
> opal_message_notifier_unregister(OPAL_MSG_OCC,
> &powernv_cpufreq_opal_nb);
> unregister_reboot_notifier(&powernv_cpufreq_reboot_nb);
> @@ -628,6 +735,8 @@ static int __init powernv_cpufreq_init(void)
>
> register_reboot_notifier(&powernv_cpufreq_reboot_nb);
> opal_message_notifier_register(OPAL_MSG_OCC, &powernv_cpufreq_opal_nb);
> + cpufreq_register_notifier(&powernv_cpufreq_policy_nb,
> + CPUFREQ_POLICY_NOTIFIER);
>
> rc = cpufreq_register_driver(&powernv_cpufreq_driver);
> if (!rc)
@Rafael: This driver needs to do this *ugly* notifier hack, just because we
aren't doing kobject_add() for policy->kobj before ->init(). And we did that
because, we wanted to create the policyX structure with the first CPU in
policy->related_cpus mask and related_cpus mask isn't available until we call
->init()..
Should we do something in core to make this easier for this driver?
--
viresh
prev parent reply other threads:[~2016-02-29 6:39 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-26 10:36 [PATCH v10 0/2] cpufreq: powernv: Export throttle stat attributes and a bug fix Shilpasri G Bhat
2016-02-26 10:36 ` [PATCH v10 1/2] cpufreq: powernv: Fix bugs in powernv_cpufreq_{init/exit} Shilpasri G Bhat
2016-02-26 10:45 ` Viresh Kumar
2016-02-27 0:00 ` Rafael J. Wysocki
2016-02-26 10:36 ` [PATCH v10 2/2] cpufreq: powernv: Add sysfs attributes to show throttle stats Shilpasri G Bhat
2016-02-29 6:39 ` Viresh Kumar [this message]
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=20160229063917.GK2791@vireshk-i7 \
--to=viresh.kumar@linaro.org \
--cc=ego@linux.vnet.ibm.com \
--cc=linux-api@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linuxppc-dev@ozlabs.org \
--cc=rjw@rjwysocki.net \
--cc=shilpa.bhat@linux.vnet.ibm.com \
--cc=shreyas@linux.vnet.ibm.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;
as well as URLs for NNTP newsgroup(s).