linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] clk: clk-fixed-factor: Clear OF_POPULATED flag in case of failure
@ 2018-07-17 13:17 Rajan Vaja
  2018-07-25 16:39 ` Stephen Boyd
  2018-07-25 16:40 ` Stephen Boyd
  0 siblings, 2 replies; 5+ messages in thread
From: Rajan Vaja @ 2018-07-17 13:17 UTC (permalink / raw)
  To: mturquette, sboyd; +Cc: linux-clk, linux-kernel, Rajan Vaja

Fixed factor clock has two initializations at of_clk_init() time
and during platform driver probe. Before of_clk_init() call,
node is marked as populated and so its probe never gets called.

During of_clk_init() fixed factor clock registration may fail if
any of its parent clock is not registered. In this case, it doesn't
get chance to retry registration from probe. Clear OF_POPULATED
flag if fixed factor clock registration fails so that clock
registration is attempted again from probe.

Signed-off-by: Rajan Vaja <rajan.vaja@xilinx.com>
---
 drivers/clk/clk-fixed-factor.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/clk-fixed-factor.c b/drivers/clk/clk-fixed-factor.c
index d72ef2d..f3ae4ff 100644
--- a/drivers/clk/clk-fixed-factor.c
+++ b/drivers/clk/clk-fixed-factor.c
@@ -177,8 +177,15 @@ static struct clk *_of_fixed_factor_clk_setup(struct device_node *node)

        clk = clk_register_fixed_factor(NULL, clk_name, parent_name, flags,
                                        mult, div);
-       if (IS_ERR(clk))
+       if (IS_ERR(clk)) {
+               /*
+                * If parent clock is not registered, registration would fail.
+                * Clear OF_POPULATED flag so that clock registration can be
+                * attempted again from probe function.
+                */
+               of_node_clear_flag(node, OF_POPULATED);
                return clk;
+       }

        ret = of_clk_add_provider(node, of_clk_src_simple_get, clk);
        if (ret) {
--
2.7.4

This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] clk: clk-fixed-factor: Clear OF_POPULATED flag in case of failure
  2018-07-17 13:17 [PATCH] clk: clk-fixed-factor: Clear OF_POPULATED flag in case of failure Rajan Vaja
@ 2018-07-25 16:39 ` Stephen Boyd
  2018-07-25 16:40 ` Stephen Boyd
  1 sibling, 0 replies; 5+ messages in thread
From: Stephen Boyd @ 2018-07-25 16:39 UTC (permalink / raw)
  To: Rajan Vaja, mturquette; +Cc: linux-clk, linux-kernel, Rajan Vaja

Quoting Rajan Vaja (2018-07-17 06:17:00)
> Fixed factor clock has two initializations at of_clk_init() time
> and during platform driver probe. Before of_clk_init() call,
> node is marked as populated and so its probe never gets called.
> 
> During of_clk_init() fixed factor clock registration may fail if
> any of its parent clock is not registered. In this case, it doesn't
> get chance to retry registration from probe. Clear OF_POPULATED
> flag if fixed factor clock registration fails so that clock
> registration is attempted again from probe.
> 
> Signed-off-by: Rajan Vaja <rajan.vaja@xilinx.com>
> ---

Applied to clk-next


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] clk: clk-fixed-factor: Clear OF_POPULATED flag in case of failure
  2018-07-17 13:17 [PATCH] clk: clk-fixed-factor: Clear OF_POPULATED flag in case of failure Rajan Vaja
  2018-07-25 16:39 ` Stephen Boyd
@ 2018-07-25 16:40 ` Stephen Boyd
  2018-07-26 13:03   ` Rajan Vaja
  1 sibling, 1 reply; 5+ messages in thread
From: Stephen Boyd @ 2018-07-25 16:40 UTC (permalink / raw)
  To: Rajan Vaja, mturquette; +Cc: linux-clk, linux-kernel, Rajan Vaja

Quoting Rajan Vaja (2018-07-17 06:17:00)
> Fixed factor clock has two initializations at of_clk_init() time
> and during platform driver probe. Before of_clk_init() call,
> node is marked as populated and so its probe never gets called.
> 
> During of_clk_init() fixed factor clock registration may fail if
> any of its parent clock is not registered. In this case, it doesn't
> get chance to retry registration from probe. Clear OF_POPULATED
> flag if fixed factor clock registration fails so that clock
> registration is attempted again from probe.
> 
> Signed-off-by: Rajan Vaja <rajan.vaja@xilinx.com>
> ---
>  drivers/clk/clk-fixed-factor.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/clk/clk-fixed-factor.c b/drivers/clk/clk-fixed-factor.c
> index d72ef2d..f3ae4ff 100644
> --- a/drivers/clk/clk-fixed-factor.c
> +++ b/drivers/clk/clk-fixed-factor.c
> @@ -177,8 +177,15 @@ static struct clk *_of_fixed_factor_clk_setup(struct device_node *node)
> 
>         clk = clk_register_fixed_factor(NULL, clk_name, parent_name, flags,
>                                         mult, div);
> -       if (IS_ERR(clk))
> +       if (IS_ERR(clk)) {
> +               /*
> +                * If parent clock is not registered, registration would fail.
> +                * Clear OF_POPULATED flag so that clock registration can be
> +                * attempted again from probe function.
> +                */
> +               of_node_clear_flag(node, OF_POPULATED);
>                 return clk;
> +       }

BTW, this patch was seriously mangled for me so I had to apply it by
hand. Please be more careful next time and consider using something like
git-send-email and git-format-patch to send patches.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH] clk: clk-fixed-factor: Clear OF_POPULATED flag in case of failure
  2018-07-25 16:40 ` Stephen Boyd
@ 2018-07-26 13:03   ` Rajan Vaja
  2018-07-26 15:27     ` Stephen Boyd
  0 siblings, 1 reply; 5+ messages in thread
From: Rajan Vaja @ 2018-07-26 13:03 UTC (permalink / raw)
  To: Stephen Boyd; +Cc: linux-clk, linux-kernel, mturquette

Hi Stephen,

> -----Original Message-----
> From: Stephen Boyd [mailto:sboyd@kernel.org]
> Sent: 25 July 2018 10:11 PM
> To: Rajan Vaja <RAJANV@xilinx.com>; mturquette@baylibre.com
> Cc: linux-clk@vger.kernel.org; linux-kernel@vger.kernel.org; Rajan Vaja
> <RAJANV@xilinx.com>
> Subject: Re: [PATCH] clk: clk-fixed-factor: Clear OF_POPULATED flag in case of
> failure
> 
> Quoting Rajan Vaja (2018-07-17 06:17:00)
> > Fixed factor clock has two initializations at of_clk_init() time
> > and during platform driver probe. Before of_clk_init() call,
> > node is marked as populated and so its probe never gets called.
> >
> > During of_clk_init() fixed factor clock registration may fail if
> > any of its parent clock is not registered. In this case, it doesn't
> > get chance to retry registration from probe. Clear OF_POPULATED
> > flag if fixed factor clock registration fails so that clock
> > registration is attempted again from probe.
> >
> > Signed-off-by: Rajan Vaja <rajan.vaja@xilinx.com>
> > ---
> >  drivers/clk/clk-fixed-factor.c | 9 ++++++++-
> >  1 file changed, 8 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/clk/clk-fixed-factor.c b/drivers/clk/clk-fixed-factor.c
> > index d72ef2d..f3ae4ff 100644
> > --- a/drivers/clk/clk-fixed-factor.c
> > +++ b/drivers/clk/clk-fixed-factor.c
> > @@ -177,8 +177,15 @@ static struct clk *_of_fixed_factor_clk_setup(struct
> device_node *node)
> >
> >         clk = clk_register_fixed_factor(NULL, clk_name, parent_name, flags,
> >                                         mult, div);
> > -       if (IS_ERR(clk))
> > +       if (IS_ERR(clk)) {
> > +               /*
> > +                * If parent clock is not registered, registration would fail.
> > +                * Clear OF_POPULATED flag so that clock registration can be
> > +                * attempted again from probe function.
> > +                */
> > +               of_node_clear_flag(node, OF_POPULATED);
> >                 return clk;
> > +       }
> 
> BTW, this patch was seriously mangled for me so I had to apply it by
> hand. Please be more careful next time and consider using something like
> git-send-email and git-format-patch to send patches.
[Rajan] I used git-send-email only and sent same way as I used to send other patches. Not sure where was issue.
Sorry for the inconvenience.  


^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH] clk: clk-fixed-factor: Clear OF_POPULATED flag in case of failure
  2018-07-26 13:03   ` Rajan Vaja
@ 2018-07-26 15:27     ` Stephen Boyd
  0 siblings, 0 replies; 5+ messages in thread
From: Stephen Boyd @ 2018-07-26 15:27 UTC (permalink / raw)
  To: Rajan Vaja; +Cc: linux-clk, linux-kernel, mturquette

Quoting Rajan Vaja (2018-07-26 06:03:16)
> Hi Stephen,
> 
> > -----Original Message-----
> > From: Stephen Boyd [mailto:sboyd@kernel.org]
> > Sent: 25 July 2018 10:11 PM
> > To: Rajan Vaja <RAJANV@xilinx.com>; mturquette@baylibre.com
> > Cc: linux-clk@vger.kernel.org; linux-kernel@vger.kernel.org; Rajan Vaja
> > <RAJANV@xilinx.com>
> > Subject: Re: [PATCH] clk: clk-fixed-factor: Clear OF_POPULATED flag in case of
> > failure
> > 
> > Quoting Rajan Vaja (2018-07-17 06:17:00)
> > > Fixed factor clock has two initializations at of_clk_init() time
> > > and during platform driver probe. Before of_clk_init() call,
> > > node is marked as populated and so its probe never gets called.
> > >
> > > During of_clk_init() fixed factor clock registration may fail if
> > > any of its parent clock is not registered. In this case, it doesn't
> > > get chance to retry registration from probe. Clear OF_POPULATED
> > > flag if fixed factor clock registration fails so that clock
> > > registration is attempted again from probe.
> > >
> > > Signed-off-by: Rajan Vaja <rajan.vaja@xilinx.com>
> > > ---
> > >  drivers/clk/clk-fixed-factor.c | 9 ++++++++-
> > >  1 file changed, 8 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/clk/clk-fixed-factor.c b/drivers/clk/clk-fixed-factor.c
> > > index d72ef2d..f3ae4ff 100644
> > > --- a/drivers/clk/clk-fixed-factor.c
> > > +++ b/drivers/clk/clk-fixed-factor.c
> > > @@ -177,8 +177,15 @@ static struct clk *_of_fixed_factor_clk_setup(struct
> > device_node *node)
> > >
> > >         clk = clk_register_fixed_factor(NULL, clk_name, parent_name, flags,
> > >                                         mult, div);
> > > -       if (IS_ERR(clk))
> > > +       if (IS_ERR(clk)) {
> > > +               /*
> > > +                * If parent clock is not registered, registration would fail.
> > > +                * Clear OF_POPULATED flag so that clock registration can be
> > > +                * attempted again from probe function.
> > > +                */
> > > +               of_node_clear_flag(node, OF_POPULATED);
> > >                 return clk;
> > > +       }
> > 
> > BTW, this patch was seriously mangled for me so I had to apply it by
> > hand. Please be more careful next time and consider using something like
> > git-send-email and git-format-patch to send patches.
> [Rajan] I used git-send-email only and sent same way as I used to send other patches. Not sure where was issue.
> Sorry for the inconvenience.  
> 

It must be your Outlook server messing things up. I see
Content-Transfer-Encoding: quoted-printable in the headers, which
probably caused my MUA to choke and line break things in the wrong
place.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-07-26 15:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-17 13:17 [PATCH] clk: clk-fixed-factor: Clear OF_POPULATED flag in case of failure Rajan Vaja
2018-07-25 16:39 ` Stephen Boyd
2018-07-25 16:40 ` Stephen Boyd
2018-07-26 13:03   ` Rajan Vaja
2018-07-26 15:27     ` Stephen Boyd

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).