diff mbox

of_clk_add_(hw_)providers multipule times for one node?

Message ID 20160824180806.GE19826@codeaurora.org (mailing list archive)
State RFC, archived
Delegated to: Stephen Boyd
Headers show

Commit Message

Stephen Boyd Aug. 24, 2016, 6:08 p.m. UTC
(Please trim replies)

On 08/24, Masahiro Yamada wrote:
> 
> Looks like the whole of my series was rejected,
> but I was not sure why the following one was rejected.
> https://patchwork.kernel.org/patch/9236563/
> 

Replying to that patch would have been better.

> 
> Could you explain why -EPROBE_DEFER should be returned
> if both .get_hw and .get are missing.

That's just a bug. Perhaps this patch would be better, and look,
it saves 5 lines.

---8<----
 drivers/clk/clk.c | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)


> 
> 
> Is there a way to register an OF clk provider without .get(_hw),
> but fill it later or something?
> 

No.

Comments

Masahiro Yamada Aug. 25, 2016, 2:36 a.m. UTC | #1
Hi Stephen,


2016-08-25 3:08 GMT+09:00 Stephen Boyd <sboyd@codeaurora.org>:
> (Please trim replies)
>
> On 08/24, Masahiro Yamada wrote:
>>
>> Looks like the whole of my series was rejected,
>> but I was not sure why the following one was rejected.
>> https://patchwork.kernel.org/patch/9236563/
>>
>
> Replying to that patch would have been better.
>
>>
>> Could you explain why -EPROBE_DEFER should be returned
>> if both .get_hw and .get are missing.
>
> That's just a bug. Perhaps this patch would be better, and look,
> it saves 5 lines.
>
> ---8<----
>  drivers/clk/clk.c | 17 ++++++-----------
>  1 file changed, 6 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
> index 71cc56712666..d3d26148cdfb 100644
> --- a/drivers/clk/clk.c
> +++ b/drivers/clk/clk.c
> @@ -3174,19 +3174,14 @@ __of_clk_get_hw_from_provider(struct of_clk_provider *provider,
>                               struct of_phandle_args *clkspec)
>  {
>         struct clk *clk;
> -       struct clk_hw *hw = ERR_PTR(-EPROBE_DEFER);
>
> -       if (provider->get_hw) {
> -               hw = provider->get_hw(clkspec, provider->data);
> -       } else if (provider->get) {
> -               clk = provider->get(clkspec, provider->data);
> -               if (!IS_ERR(clk))
> -                       hw = __clk_get_hw(clk);
> -               else
> -                       hw = ERR_CAST(clk);
> -       }
> +       if (provider->get_hw)
> +               return provider->get_hw(clkspec, provider->data);
>
> -       return hw;
> +       clk = provider->get(clkspec, provider->data);
> +       if (IS_ERR(clk))
> +               return ERR_CAST(clk);
> +       return __clk_get_hw(clk);
>  }
>
>  struct clk *__of_clk_get_from_provider(struct of_phandle_args *clkspec,


Good.
Could you post it as a patch file?


Thanks!
Stephen Boyd Aug. 25, 2016, 8:30 p.m. UTC | #2
On 08/25, Masahiro Yamada wrote:
>
> Good.
> Could you post it as a patch file?
> 

Sure. I'll write up some commit text.
diff mbox

Patch

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 71cc56712666..d3d26148cdfb 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -3174,19 +3174,14 @@  __of_clk_get_hw_from_provider(struct of_clk_provider *provider,
 			      struct of_phandle_args *clkspec)
 {
 	struct clk *clk;
-	struct clk_hw *hw = ERR_PTR(-EPROBE_DEFER);
 
-	if (provider->get_hw) {
-		hw = provider->get_hw(clkspec, provider->data);
-	} else if (provider->get) {
-		clk = provider->get(clkspec, provider->data);
-		if (!IS_ERR(clk))
-			hw = __clk_get_hw(clk);
-		else
-			hw = ERR_CAST(clk);
-	}
+	if (provider->get_hw)
+		return provider->get_hw(clkspec, provider->data);
 
-	return hw;
+	clk = provider->get(clkspec, provider->data);
+	if (IS_ERR(clk))
+		return ERR_CAST(clk);
+	return __clk_get_hw(clk);
 }
 
 struct clk *__of_clk_get_from_provider(struct of_phandle_args *clkspec,