mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Stephen Boyd <sboyd@kernel.org>
To: "Simek, Michal" <michal.simek@amd.com>,
	"Thangaraj, Senthil Nathan" <SenthilNathan.Thangaraj@amd.com>,
	"Trivedi Manojbhai, Naman" <Naman.TrivediManojbhai@amd.com>,
	linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org,
	mturquette@baylibre.com
Cc: linux-kernel@vger.kernel.org <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH V2] drivers: clk: zynqmp: remove clock name dependency
Date: Mon, 12 Aug 2024 11:10:55 -0700	[thread overview]
Message-ID: <1234a0176de236abb603f96ab9a1d6a1.sboyd@kernel.org> (raw)
In-Reply-To: <PH7PR12MB72845D56BF4361441AA9CB9A8A852@PH7PR12MB7284.namprd12.prod.outlook.com>

Quoting Trivedi Manojbhai, Naman (2024-08-12 05:57:13)
> >> diff --git a/drivers/clk/zynqmp/clkc.c b/drivers/clk/zynqmp/clkc.c
> >> index a91d98e238c2..b791a459280e 100644
> >> --- a/drivers/clk/zynqmp/clkc.c
> >> +++ b/drivers/clk/zynqmp/clkc.c
> >> @@ -543,7 +554,7 @@ static int zynqmp_clock_get_parents(u32 clk_id,
> >struct clock_parent *parents,
> >>   * Return: 0 on success else error+reason
> >>   */
> >>  static int zynqmp_get_parent_list(struct device_node *np, u32 clk_id,
> >> -                                 const char **parent_list, u32 *num_parents)
> >> +                                 struct clk_parent_data *parent_list,
> >> + u32 *num_parents)
> >>  {
> >>         int i = 0, ret;
> >>         u32 total_parents = clock[clk_id].num_parents; @@ -555,18
> >> +566,30 @@ static int zynqmp_get_parent_list(struct device_node *np,
> >> u32 clk_id,
> >>
> >>         for (i = 0; i < total_parents; i++) {
> >>                 if (!parents[i].flag) {
> >> -                       parent_list[i] = parents[i].name;
> >> +                       ret = of_property_match_string(np, "clock-names",
> >> +
> >> + parents[i].name);
> >
> >You shouldn't need to match 'clock-names'. The order of that property is fixed
> >in the binding, which means you can simply use the index that the name is at
> >in the binding in 'struct parent_data'.
> 
> This driver is common across multiple device families, and each device has different set of clock names in device tree/binding.  This implementation seemed to be generic for all devices. 
> To use index directly, I have to add if..else for matching compatible strings and more if..else inside each of them for matching clock names to find index. Please let me know if this is preferred approach.

It is preferred to not use clock-names and use the index directly. This
avoids a bunch of string comparisons and makes for smaller and faster
code.

  reply	other threads:[~2024-08-12 18:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-22 12:19 Naman Trivedi
2024-08-08 22:48 ` Stephen Boyd
2024-08-12 12:57   ` Trivedi Manojbhai, Naman
2024-08-12 18:10     ` Stephen Boyd [this message]
     [not found]       ` <PH7PR12MB728472C3022ADCD8DF5576DD8A962@PH7PR12MB7284.namprd12.prod.outlook.com>
     [not found]         ` <7f295bf3b095bace843c28adc9941344.sboyd@kernel.org>
2024-09-06  9:43           ` Trivedi Manojbhai, Naman

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=1234a0176de236abb603f96ab9a1d6a1.sboyd@kernel.org \
    --to=sboyd@kernel.org \
    --cc=Naman.TrivediManojbhai@amd.com \
    --cc=SenthilNathan.Thangaraj@amd.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michal.simek@amd.com \
    --cc=mturquette@baylibre.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

all inboxes | Powered by JetHome®