diff mbox

[06/14] cpufreq: cpu0: defer probe if clock isn't registered yet

Message ID CAKohpomk-pyv6Risyq_b8h3DJNGxBoUWu1Y9cApvoz3CwOtL=w@mail.gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Viresh Kumar July 2, 2014, 11:32 a.m. UTC
On 2 July 2014 11:25, Viresh Kumar <viresh.kumar@linaro.org> wrote:
> On 2 July 2014 11:23, Shawn Guo <shawn.guo@linaro.org> wrote:
>> On Tue, Jul 01, 2014 at 10:02:35PM +0530, Viresh Kumar wrote:
>
>>> diff --git a/drivers/cpufreq/cpufreq-cpu0.c b/drivers/cpufreq/cpufreq-cpu0.c
>>> index 4273a5f..b5b8e1c 100644
>>> --- a/drivers/cpufreq/cpufreq-cpu0.c
>>> +++ b/drivers/cpufreq/cpufreq-cpu0.c
>>> @@ -150,8 +150,17 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev)
>>>
>>>       cpu_clk = clk_get(cpu_dev, NULL);
>>>       if (IS_ERR(cpu_clk)) {
>>> -             ret = PTR_ERR(cpu_clk);
>>
>> If you keep this ...
>>
>>> -             pr_err("failed to get cpu0 clock: %d\n", ret);
>>> +             /*
>>> +              * If cpu's clk node is present, but clock is not yet
>>> +              * registered, we should try defering probe.
>>> +              */
>>> +             if (PTR_ERR(cpu_clk) == -EPROBE_DEFER) {
>>
>> ... you can use 'ret' here ...
>>
>>> +                     dev_err(cpu_dev, "cpu0 clock not ready, retry\n");
>>> +                     ret = -EPROBE_DEFER;
>>
>> ... this can be saved ...
>>
>>> +             } else {
>>> +                     ret = PTR_ERR(cpu_clk);
>>
>> ... and this as well.
>
> All accepted. Thanks.

The motive of this patch is changed completely after what you suggested
and so logs are updated as well:

    cpufreq: cpu0: print relevant error when we defer probe

    Currently, we defer probe if regulator_get() returned -EPROBE_DEFER, i.e.
    regulator isn't registered yet.

    The same is true for clock as well and should be done there.

    Current code already does it, but it wasn't intentional probably.
Its just that
    we are returning the right error with wrong print message.

    Fix print message to convey right error.

    Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 drivers/cpufreq/cpufreq-cpu0.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Stephen Boyd July 3, 2014, 12:38 a.m. UTC | #1
On 07/02/14 04:32, Viresh Kumar wrote:
>
> diff --git a/drivers/cpufreq/cpufreq-cpu0.c b/drivers/cpufreq/cpufreq-cpu0.c
> index 4273a5f..0c16b2f 100644
> --- a/drivers/cpufreq/cpufreq-cpu0.c
> +++ b/drivers/cpufreq/cpufreq-cpu0.c
> @@ -151,7 +151,16 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev)
>         cpu_clk = clk_get(cpu_dev, NULL);
>         if (IS_ERR(cpu_clk)) {
>                 ret = PTR_ERR(cpu_clk);
> -               pr_err("failed to get cpu0 clock: %d\n", ret);
> +
> +               /*
> +                * If cpu's clk node is present, but clock is not yet
> +                * registered, we should try defering probe.
> +                */
> +               if (ret == -EPROBE_DEFER)
> +                       dev_err(cpu_dev, "cpu0 clock not ready, retry\n");

Please make this a dev_dbg() or just remove it entirely. Sending a
message to the log on probe defer just duplicates what the driver core
is already doing.
diff mbox

Patch

diff --git a/drivers/cpufreq/cpufreq-cpu0.c b/drivers/cpufreq/cpufreq-cpu0.c
index 4273a5f..0c16b2f 100644
--- a/drivers/cpufreq/cpufreq-cpu0.c
+++ b/drivers/cpufreq/cpufreq-cpu0.c
@@ -151,7 +151,16 @@  static int cpu0_cpufreq_probe(struct platform_device *pdev)
        cpu_clk = clk_get(cpu_dev, NULL);
        if (IS_ERR(cpu_clk)) {
                ret = PTR_ERR(cpu_clk);
-               pr_err("failed to get cpu0 clock: %d\n", ret);
+
+               /*
+                * If cpu's clk node is present, but clock is not yet
+                * registered, we should try defering probe.
+                */
+               if (ret == -EPROBE_DEFER)
+                       dev_err(cpu_dev, "cpu0 clock not ready, retry\n");
+               else
+                       dev_err(cpu_dev, "failed to get cpu0 clock: %d\n", ret);
+
                goto out_put_reg;
        }
--
To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in