mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Stephen Boyd <sboyd@kernel.org>
To: Naman Trivedi <naman.trivedimanojbhai@amd.com>,
	linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org,
	michal.simek@amd.com, mturquette@baylibre.com,
	senthilnathan.thangaraj@amd.com
Cc: linux-kernel@vger.kernel.org,
	Naman Trivedi Manojbhai <naman.trivedimanojbhai@amd.com>
Subject: Re: [PATCH V2] drivers: clk: zynqmp: remove clock name dependency
Date: Thu, 08 Aug 2024 15:48:03 -0700	[thread overview]
Message-ID: <ac67f76d4b4b5f4bf108c1457f1263c7.sboyd@kernel.org> (raw)
In-Reply-To: <20240722121910.14647-1-naman.trivedimanojbhai@amd.com>

Quoting Naman Trivedi (2024-07-22 05:19:10)
> From: Naman Trivedi Manojbhai <naman.trivedimanojbhai@amd.com>
> 
> Use struct clk_parent_data to register the clock parents with the clock
> framework instead of parent name.
> 
> Signed-off-by: Naman Trivedi Manojbhai <naman.trivedimanojbhai@amd.com>

This is great! Thanks for doing this.

> diff --git a/drivers/clk/zynqmp/clk-gate-zynqmp.c b/drivers/clk/zynqmp/clk-gate-zynqmp.c
> index b89e55737198..6bb9704ee1d3 100644
> --- a/drivers/clk/zynqmp/clk-gate-zynqmp.c
> +++ b/drivers/clk/zynqmp/clk-gate-zynqmp.c
> @@ -104,8 +104,8 @@ static const struct clk_ops zynqmp_clk_gate_ops = {
>   *
>   * Return: clock hardware of the registered clock gate
>   */
> -struct clk_hw *zynqmp_clk_register_gate(const char *name, u32 clk_id,
> -                                       const char * const *parents,
> +struct clk_hw *zynqmp_clk_register_gate(struct device_node *np, const char *name, u32 clk_id,

General comment: Please use 'struct device' instead so that this driver
isn't DT specific. When you do that you can similarly use
devm_clk_hw_register() instead and introduce a lot of automatic cleanup.
If you want to do that in two steps that's fine. One patch that uses
parent_data/parent_hws and one that uses devm_ APIs and struct device to
register.

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

  reply	other threads:[~2024-08-08 22:48 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 [this message]
2024-08-12 12:57   ` Trivedi Manojbhai, Naman
2024-08-12 18:10     ` Stephen Boyd
     [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=ac67f76d4b4b5f4bf108c1457f1263c7.sboyd@kernel.org \
    --to=sboyd@kernel.org \
    --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 \
    --cc=naman.trivedimanojbhai@amd.com \
    --cc=senthilnathan.thangaraj@amd.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®