linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Boyd <sboyd@kernel.org>
To: Dario Binacchi <dario.binacchi@amarulasolutions.com>
Cc: linux-kernel@vger.kernel.org,
	Amarula patchwork <linux-amarula@amarulasolutions.com>,
	michael@amarulasolutions.com, kernel test robot <lkp@intel.com>,
	Allison Randal <allison@lohutok.net>,
	Miaoqian Lin <linmq006@gmail.com>,
	Michael Turquette <mturquette@baylibre.com>,
	Tero Kristo <kristo@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Tony Lindgren <tony@atomide.com>,
	linux-clk@vger.kernel.org, linux-omap@vger.kernel.org
Subject: Re: [PATCH v2] clk: ti: dra7-atl: don't allocate `parent_names' variable
Date: Tue, 01 Nov 2022 11:35:11 -0700	[thread overview]
Message-ID: <20221101183513.C63E4C433C1@smtp.kernel.org> (raw)
In-Reply-To: <CABGWkvp1iMN-4XDN_ifg6uyvQbpRzNyat_eDziWY75Cf_hCpQw@mail.gmail.com>

Quoting Dario Binacchi (2022-10-30 06:00:46)
> 
> I tried to test your suggestions on another platform (I don't have the
> hw to test the driver change) but if I
> don't add pdata.name = of_clk_get_parent_name () the board boot up fails.
> 
> As far I can see from the clk_core_populate_parent_map()
> 
> ....
> /* Copy everything over because it might be __initdata */
> for (i = 0, parent = parents; i < num_parents; i++, parent++) {
>     parent->index = -1;
>     if (parent_names) {
>         /* throw a WARN if any entries are NULL */
>        WARN(!parent_names[i],
>             "%s: invalid NULL in %s's .parent_names\n",
>             __func__, core->name);
>         ret = clk_cpy_name(&parent->name, parent_names[i],
>                                         true);
>     } else if (parent_data) {
>         parent->hw = parent_data[i].hw;
>         parent->index = parent_data[i].index;
>         ret = clk_cpy_name(&parent->fw_name,
>                                          parent_data[i].fw_name, false);
>         if (!ret)
>             ret = clk_cpy_name(&parent->name,
>                                             parent_data[i].name,
>                                             false);
> ...
> 
> 
> The function clk_cpy_name() is called with the parameter "mus_exist"
> to true in the path "parent_names" and false
> in the path "parent_data". Therefore, in the path "parent_data" it is
> allowed that parent-> name is not set.
> In doing so, therefore, the change would not even be backward compatible.
> 
> So, IMHO, there are 2 possible options:
>  1 okay to use parent_data, but we keep using of_clk_get_parent_name
> () to set parent_data::name.
>  2 okay to use the version v2 of the patch.
> 
> What do you think?

I am confused.

The struct clk_parent_data::name being used is whatever string is
returned by of_clk_get_parent_name(node, 0). That is the same as setting
struct clk_parent_data::index to 0, and not assigning the 'name' or
'fw_name' field of the parent data structure. This is a compatible
change because of_clk_get_parent_name() is getting the name of the clk
in 'clocks' for 'node' at index 0. Using the index 0 in clk_parent_data
tells clk framework that the parent of the clk being registered is the
clk in 'clocks' for the 'dev->node' that is passed in during
clk_register(). If you don't have a device pointer, use
of_clk_hw_register() to pass 'node' directly. It looks like you will
have to do that in this case to get the node pointer registered with
this clk.

      reply	other threads:[~2022-11-01 18:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-18 16:03 [PATCH v2] clk: ti: dra7-atl: don't allocate `parent_names' variable Dario Binacchi
2022-10-28  0:27 ` Stephen Boyd
2022-10-30 13:00   ` Dario Binacchi
2022-11-01 18:35     ` 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=20221101183513.C63E4C433C1@smtp.kernel.org \
    --to=sboyd@kernel.org \
    --cc=allison@lohutok.net \
    --cc=dario.binacchi@amarulasolutions.com \
    --cc=kristo@kernel.org \
    --cc=linmq006@gmail.com \
    --cc=linux-amarula@amarulasolutions.com \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=michael@amarulasolutions.com \
    --cc=mturquette@baylibre.com \
    --cc=tglx@linutronix.de \
    --cc=tony@atomide.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 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).