linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lukasz Majewski <l.majewski@samsung.com>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: Rafael Wysocki <rjw@rjwysocki.net>,
	"edubezval@gmail.com" <edubezval@gmail.com>,
	"linaro-kernel@lists.linaro.org" <linaro-kernel@lists.linaro.org>,
	"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>
Subject: Re: [PATCH V2 3/4] cpufreq: Introduce ->ready() callback for cpufreq drivers
Date: Thu, 27 Nov 2014 12:00:42 +0100	[thread overview]
Message-ID: <20141127120042.7f34e60e@amdc2363> (raw)
In-Reply-To: <8291de0dd69c731f1fc259acee190e26481f9f77.1417048449.git.viresh.kumar@linaro.org>

Hi Viresh,

> Currently there is no callback for cpufreq drivers which is called
> once the policy is ready to be used. There are some requirements
> where such a callback is required.
> 
> One of them is registering a cooling device with the help of
> of_cpufreq_cooling_register(). This routine tries to get 'struct
> cpufreq_policy' for CPUs which isn't yet initialed at the time
> ->init() is called and so we face issues while registering the
> cooling device.
> 
> Because we can't register cooling device from ->init(), we need a
> callback that is called after the policy is ready to be used and
> hence we introduce ->ready() callback.
> 
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> Reviewed-by: Eduardo Valentin <edubezval@gmail.com>
> Tested-by: Eduardo Valentin <edubezval@gmail.com>
> ---
>  drivers/cpufreq/cpufreq.c | 5 +++++
>  include/linux/cpufreq.h   | 4 ++++
>  2 files changed, 9 insertions(+)
> 
> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> index de2c3e1..a09a29c 100644
> --- a/drivers/cpufreq/cpufreq.c
> +++ b/drivers/cpufreq/cpufreq.c
> @@ -1285,8 +1285,13 @@ static int __cpufreq_add_dev(struct device
> *dev, struct subsys_interface *sif) up_write(&policy->rwsem);
>  
>  	kobject_uevent(&policy->kobj, KOBJ_ADD);
> +

Is this blank line intentional? 

>  	up_read(&cpufreq_rwsem);
>  
> +	/* Callback for handling stuff after policy is ready */
> +	if (cpufreq_driver->ready)
> +		cpufreq_driver->ready(policy);
> +
>  	pr_debug("initialization complete\n");
>  
>  	return 0;
> diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
> index db3c130..4d078ce 100644
> --- a/include/linux/cpufreq.h
> +++ b/include/linux/cpufreq.h
> @@ -267,6 +267,10 @@ struct cpufreq_driver {
>  	void		(*stop_cpu)(struct cpufreq_policy
> *policy); int		(*suspend)(struct cpufreq_policy
> *policy); int		(*resume)(struct cpufreq_policy *policy);
> +
> +	/* Will be called after the driver is fully initialized */
> +	void		(*ready)(struct cpufreq_policy *policy);
> +
>  	struct freq_attr **attr;
>  
>  	/* platform specific boost support code */

Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>

-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group

  reply	other threads:[~2014-11-27 11:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-27  0:37 [PATCH V2 0/4] cpufreq: Register cooling device after policy is ready Viresh Kumar
2014-11-27  0:37 ` [PATCH V2 1/4] cpufreq: Fix formatting issues in 'struct cpufreq_driver' Viresh Kumar
2014-11-27  0:37 ` [PATCH V2 2/4] cpufreq-dt: pass 'policy->related_cpus' to of_cpufreq_cooling_register() Viresh Kumar
2014-11-27  0:37 ` [PATCH V2 3/4] cpufreq: Introduce ->ready() callback for cpufreq drivers Viresh Kumar
2014-11-27 11:00   ` Lukasz Majewski [this message]
2014-11-27  0:37 ` [PATCH V2 4/4] cpufreq-dt: register cooling device from ->ready() callback Viresh Kumar
2014-11-27 11:08   ` Lukasz Majewski

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=20141127120042.7f34e60e@amdc2363 \
    --to=l.majewski@samsung.com \
    --cc=edubezval@gmail.com \
    --cc=linaro-kernel@lists.linaro.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=viresh.kumar@linaro.org \
    /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).