mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: Lucas Stach <dev@lynxeye.de>, barebox@lists.infradead.org
Subject: Re: [PATCH 1/3] clk: ignore of_device_ensure_probed error in clock lookup
Date: Mon, 17 Jan 2022 11:20:17 +0100	[thread overview]
Message-ID: <0ecb57c3-e0a3-076f-5bd7-4b12c59fa80e@pengutronix.de> (raw)
In-Reply-To: <10192ccb41be58fd4e53044b17e6a5838c3629d7.camel@lynxeye.de>

Hi,

On 17.01.22 10:16, Lucas Stach wrote:
> Hi Ahmad,
> 
> Am Montag, dem 17.01.2022 um 06:12 +0100 schrieb Ahmad Fatoum:
>> Hello Lucas,
>>
>> On 16.01.22 22:32, Lucas Stach wrote:
>>> For CLK_OF_DECLARE clocks there is no driver that is bound to the device,
>>> so the lookup fails before even trying to find the provider, breaking
>>> the parent_ready() logic used when initializing the declared providers.
>>>
>>> Ignore the return code from of_device_ensure_probed to allow the lookup
>>> to proceed as usual. If of_device_ensure_probed the lookup will also fail,
>>> as no provider will be found.
>>
>> This seems to be an alternate fix for the issue addressed by:
>> bd516e38dd14 ("clk: handle CLK_OF_DECLARE in deep probe")
>>
>> What do you think?
> 
> Yes, it seems to be aimed at the same issue. However, your fix in
> bd516e38dd14 doesn't fix my specific issue, as we still don't get the
> correct -EPROBE_DEFER error code for the logic in parent_ready() in
> drivers/clk/clk.c to work.
> 
> I guess we could even revert your fix if we agree that ignoring the
> return code here is the right thing to do? Attaching a dummy driver 
> doesn't seem to be totally correct, as I think it isn't prohibited to
> have both a CLK_OF_DECLARE clock controller and a real platform driver
> for other uses attached to the same OF node. While I'm not aware of any
> clock controllers where this would be the case, I have seen such
> constructs with IRQ controllers.

Sounds logical. I'll test with my fix reverted and yours applied
and report back.

> 
> Regards,
> Lucas
> 
>>
>>>
>>> Signed-off-by: Lucas Stach <dev@lynxeye.de>
>>> ---
>>>  drivers/clk/clk.c | 6 ++----
>>>  1 file changed, 2 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
>>> index 189c9c62df5c..a1d1d7f1a467 100644
>>> --- a/drivers/clk/clk.c
>>> +++ b/drivers/clk/clk.c
>>> @@ -643,11 +643,9 @@ struct clk *of_clk_get_from_provider(struct of_phandle_args *clkspec)
>>>  {
>>>  	struct of_clk_provider *provider;
>>>  	struct clk *clk = ERR_PTR(-EPROBE_DEFER);
>>> -	int ret;
>>>  
>>> -	ret = of_device_ensure_probed(clkspec->np);
>>> -	if (ret)
>>> -		return ERR_PTR(ret);
>>> +	/* Ignore error, as CLK_OF_DECLARE clocks have no proper driver. */
>>> +	of_device_ensure_probed(clkspec->np);
>>>  
>>>  	/* Check if we have such a provider in our array */
>>>  	list_for_each_entry(provider, &of_clk_providers, link) {
>>>
>>
>>
> 
> 
> 


-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


  reply	other threads:[~2022-01-17 10:21 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-16 21:32 Lucas Stach
2022-01-16 21:32 ` [PATCH 2/3] soc: imx: gpcv2: split PGC domain probe in two passes Lucas Stach
2022-01-16 21:32 ` [PATCH 3/3] ARM: mnt-reform: switch to deep-probe Lucas Stach
2022-01-17  5:12 ` [PATCH 1/3] clk: ignore of_device_ensure_probed error in clock lookup Ahmad Fatoum
2022-01-17  9:16   ` Lucas Stach
2022-01-17 10:20     ` Ahmad Fatoum [this message]
2022-01-18  5:39       ` Ahmad Fatoum
2022-01-18  7:34 ` Sascha Hauer

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=0ecb57c3-e0a3-076f-5bd7-4b12c59fa80e@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=dev@lynxeye.de \
    /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