From: Stephen Boyd <sboyd@kernel.org>
To: Alexandre Mergnat <amergnat@baylibre.com>, wens Tsai <wens213@gmail.com>
Cc: Mike Turquette <mturquette@baylibre.com>,
linux-clk <linux-clk@vger.kernel.org>,
linux-kernel <linux-kernel@vger.kernel.org>,
baylibre-upstreaming@groups.io,
Jerome Brunet <jbrunet@baylibre.com>
Subject: Re: [PATCH] clk: fix clock global name usage.
Date: Wed, 12 Jun 2019 16:00:36 -0700 [thread overview]
Message-ID: <20190612230037.52B5B20896@mail.kernel.org> (raw)
In-Reply-To: <CAGb2v661GYVmq9Xvw9j3RN1jV5Xe2c-naHkvEcVFSbHkeW3HBQ@mail.gmail.com>
Quoting wens Tsai (2019-06-10 23:46:17)
> On Fri, May 24, 2019 at 3:29 PM Alexandre Mergnat <amergnat@baylibre.com> wrote:
> >
> > A recent patch allows the clock framework to specify the parent
> > relationship with either the clk_hw pointer, the global name or through
> > Device Tree name.
> >
> > But the global name isn't handled by the clk framework because the DT name
> > is considered valid even if it's NULL, so of_clk_get_hw() returns an
> > unexpected clock (the first clock specified in DT).
> >
> > This can be fixed by calling of_clk_get_hw() only when DT name is not NULL.
> >
> > Fixes: fc0c209c147f ("clk: Allow parents to be specified without string names")
> > Cc: Jerome Brunet <jbrunet@baylibre.com>
> > Signed-off-by: Alexandre Mergnat <amergnat@baylibre.com>
> > ---
> > drivers/clk/clk.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
> > index bdb077ba59b9..9624a75e5a8d 100644
> > --- a/drivers/clk/clk.c
> > +++ b/drivers/clk/clk.c
> > @@ -368,7 +368,7 @@ static struct clk_core *clk_core_get(struct clk_core *core, u8 p_index)
> > const char *dev_id = dev ? dev_name(dev) : NULL;
> > struct device_node *np = core->of_node;
> >
> > - if (np && index >= 0)
> > + if (name && np && index >= 0)
>
> I think the opposite should be the case. If either the name or index is valid,
> and there's a device node backing it, the code path should be entered.
>
> This is implied by the description of struct clk_parent_data:
>
> @index: parent index local to provider registering clk (if @fw_name absent)
>
> So the code path should be valid regardless of the value of .index.
>
> That would make it
>
> if (np && (name || index >= 0)) ...
>
Sure. I'll post my fix and pick the patch into clk-fixes so that this
works.
prev parent reply other threads:[~2019-06-13 17:03 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-24 7:27 [PATCH] clk: fix clock global name usage Alexandre Mergnat
2019-05-24 14:33 ` Stephen Boyd
2019-05-24 15:00 ` Jerome Brunet
2019-05-24 17:44 ` Stephen Boyd
2019-05-24 18:12 ` Jerome Brunet
2019-06-06 22:54 ` Stephen Boyd
2019-06-10 9:37 ` Jerome Brunet
2019-06-11 6:46 ` wens Tsai
2019-06-12 23:00 ` 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=20190612230037.52B5B20896@mail.kernel.org \
--to=sboyd@kernel.org \
--cc=amergnat@baylibre.com \
--cc=baylibre-upstreaming@groups.io \
--cc=jbrunet@baylibre.com \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mturquette@baylibre.com \
--cc=wens213@gmail.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.