From: Stephen Boyd <sboyd@kernel.org>
To: Bjorn Andersson <bjorn.andersson@linaro.org>
Cc: Michael Turquette <mturquette@baylibre.com>,
linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org,
Niklas Cassel <niklas.cassel@linaro.org>
Subject: Re: [PATCH] clk: Use parent node pointer during registration if necessary
Date: Sat, 04 Jan 2020 23:07:11 -0800 [thread overview]
Message-ID: <20200105070712.6C7012085B@mail.kernel.org> (raw)
In-Reply-To: <20200103073926.GM988120@minitux>
Quoting Bjorn Andersson (2020-01-02 23:39:26)
> On Mon 30 Dec 11:04 PST 2019, Stephen Boyd wrote:
>
> > Sometimes clk drivers are attached to devices which are children of a
> > parent device that is connected to a node in DT. This happens when
> > devices are MFD-ish and the parent device driver mostly registers child
> > devices to match against drivers placed in their respective subsystem
> > directories like drivers/clk, drivers/regulator, etc. When the clk
> > driver calls clk_register() with a device pointer, that struct device
> > pointer won't have a device_node associated with it because it was
> > created purely in software as a way to partition logic to a subsystem.
> >
> > This causes problems for the way we find parent clks for the clks
> > registered by these child devices because we look at the registering
> > device's device_node pointer to lookup 'clocks' and 'clock-names'
> > properties. Let's use the parent device's device_node pointer if the
> > registering device doesn't have a device_node but the parent does. This
> > simplifies clk registration code by avoiding the need to assign some
> > device_node to the device registering the clk.
> >
> > Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
> > Reported-by: Niklas Cassel <niklas.cassel@linaro.org>
> > Signed-off-by: Stephen Boyd <sboyd@kernel.org>
> > ---
> >
> > I decided to introduce a new function instead of trying to jam it all
> > in the one line where we assign np. This way the function gets the
> > true 'np' as an argument all the time.
> >
>
> Looks better.
>
> > drivers/clk/clk.c | 27 +++++++++++++++++++++++++--
> > 1 file changed, 25 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
> > index b68e200829f2..a743fffe8e46 100644
> > --- a/drivers/clk/clk.c
> > +++ b/drivers/clk/clk.c
> > @@ -3719,6 +3719,28 @@ __clk_register(struct device *dev, struct device_node *np, struct clk_hw *hw)
> > return ERR_PTR(ret);
> > }
> >
> > +/**
> > + * dev_or_parent_of_node - Get device node of @dev or @dev's parent
>
> ()
This has been left out historically in this file. I'll add it but I
guess I should really take a pass at updating the docs in the whole
file!
>
> > + * @dev: Device to get device node of
> > + *
> > + * Returns: device node pointer of @dev, or the device node pointer of
>
> Return: (no 's')
Thanks.
>
>
> With that,
>
> Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
> Tested-by: Bjorn Andersson <bjorn.andersson@linaro.org>
>
prev parent reply other threads:[~2020-01-05 7:07 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-30 19:04 [PATCH] clk: Use parent node pointer during registration if necessary Stephen Boyd
2020-01-03 0:17 ` Niklas Cassel
2020-01-03 7:39 ` Bjorn Andersson
2020-01-05 7:07 ` Stephen Boyd [this message]
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=20200105070712.6C7012085B@mail.kernel.org \
--to=sboyd@kernel.org \
--cc=bjorn.andersson@linaro.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mturquette@baylibre.com \
--cc=niklas.cassel@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).