linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Boyd <sboyd@kernel.org>
To: Conor Dooley <conor+dt@kernel.org>,
	Harry Austen <hpausten@protonmail.com>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Michael Turquette <mturquette@baylibre.com>,
	Michal Simek <michal.simek@amd.com>,
	Rob Herring <robh@kernel.org>
Cc: Shubhrajyoti Datta <shubhrajyoti.datta@amd.com>,
	linux-clk@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	Harry Austen <hpausten@protonmail.com>
Subject: Re: [PATCH 2/7] clk: clocking-wizard: use newer clk_hw API
Date: Tue, 23 Jul 2024 16:14:50 -0700	[thread overview]
Message-ID: <d02cd87b7a52067d6eb9b4ef3c5b7803.sboyd@kernel.org> (raw)
In-Reply-To: <20240720120048.36758-3-hpausten@protonmail.com>

General comment: do one thing in one patch, i.e. use clk_hw API and
don't also migrate to devm in one patch.

Quoting Harry Austen (2024-07-20 05:01:36)
> diff --git a/drivers/clk/xilinx/clk-xlnx-clock-wizard.c b/drivers/clk/xilinx/clk-xlnx-clock-wizard.c
> index 0ca045849ea3e..30c5cc9dcd7e9 100644
> --- a/drivers/clk/xilinx/clk-xlnx-clock-wizard.c
> +++ b/drivers/clk/xilinx/clk-xlnx-clock-wizard.c
> @@ -17,6 +17,7 @@
>  #include <linux/of.h>
>  #include <linux/math64.h>
>  #include <linux/module.h>
> +#include <linux/overflow.h>

What is this include for? __counted_by()?

>  #include <linux/err.h>
>  #include <linux/iopoll.h>
>  
> @@ -121,24 +122,22 @@ enum clk_wzrd_int_clks {
>  /**
>   * struct clk_wzrd - Clock wizard private data structure
>   *
> - * @clk_data:          Clock data
> + * @clk_data:          Output clock data
>   * @nb:                        Notifier block
>   * @base:              Memory base
>   * @clk_in1:           Handle to input clock 'clk_in1'
>   * @axi_clk:           Handle to input clock 's_axi_aclk'
>   * @clks_internal:     Internal clocks
> - * @clkout:            Output clocks
>   * @speed_grade:       Speed grade of the device
>   * @suspended:         Flag indicating power state of the device
>   */
>  struct clk_wzrd {
> -       struct clk_onecell_data clk_data;
> +       struct clk_hw_onecell_data *clk_data;

It could be placed at the end and then one allocation could be used
instead of two.

>         struct notifier_block nb;
>         void __iomem *base;
>         struct clk *clk_in1;
>         struct clk *axi_clk;
> -       struct clk *clks_internal[wzrd_clk_int_max];
> -       struct clk *clkout[WZRD_NUM_OUTPUTS];
> +       struct clk_hw *clks_internal[wzrd_clk_int_max];
>         unsigned int speed_grade;
>         bool suspended;
>  };
> @@ -1108,35 +1110,32 @@ static int clk_wzrd_probe(struct platform_device *pdev)
>                 if (!div)
>                         div = 1;
>  
> -               clk_mul_name = __clk_get_name(clk_wzrd->clks_internal[wzrd_clk_mul]);
> +               clk_mul_name = clk_hw_get_name(clk_wzrd->clks_internal[wzrd_clk_mul]);
>                 clk_wzrd->clks_internal[wzrd_clk_mul_div] =
> -                       clk_register_fixed_factor(&pdev->dev, clk_name,
> -                                                 clk_mul_name, 0, 1, div);
> +                       clk_hw_register_fixed_factor(&pdev->dev, clk_name,
> +                                                    clk_mul_name, 0, 1, div);
>         } else {
>                 ctrl_reg = clk_wzrd->base + WZRD_CLK_CFG_REG(is_versal, 0);
> -               clk_wzrd->clks_internal[wzrd_clk_mul_div] = clk_register_divider
> +               clk_wzrd->clks_internal[wzrd_clk_mul_div] = clk_hw_register_divider

Are these going to be using devm so that on failure they get
unregistered?

>                         (&pdev->dev, clk_name,
> -                        __clk_get_name(clk_wzrd->clks_internal[wzrd_clk_mul]),
> +                        clk_hw_get_name(clk_wzrd->clks_internal[wzrd_clk_mul]),
>                         flags, ctrl_reg, 0, 8, CLK_DIVIDER_ONE_BASED |
>                         CLK_DIVIDER_ALLOW_ZERO, &clkwzrd_lock);
>         }
>         if (IS_ERR(clk_wzrd->clks_internal[wzrd_clk_mul_div])) {
>                 dev_err(&pdev->dev, "unable to register divider clock\n");
> -               ret = PTR_ERR(clk_wzrd->clks_internal[wzrd_clk_mul_div]);
> -               goto err_rm_int_clk;
> +               return PTR_ERR(clk_wzrd->clks_internal[wzrd_clk_mul_div]);
>         }


  reply	other threads:[~2024-07-23 23:15 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-20 12:01 [PATCH 0/7] clk: clocking-wizard: add user clock monitor support Harry Austen
2024-07-20 12:01 ` [PATCH 1/7] clk: clocking-wizard: simplify probe/remove with devres helpers Harry Austen
2024-07-23 23:07   ` Stephen Boyd
2024-07-20 12:01 ` [PATCH 2/7] clk: clocking-wizard: use newer clk_hw API Harry Austen
2024-07-23 23:14   ` Stephen Boyd [this message]
2024-07-25 17:57     ` Harry Austen
2024-07-20 12:01 ` [PATCH 3/7] clk: clocking-wizard: move clock registration to separate function Harry Austen
2024-07-20 12:01 ` [PATCH 4/7] dt-bindings: clock: xilinx: add description of user monitor interrupt Harry Austen
2024-07-20 14:30   ` Rob Herring (Arm)
2024-07-20 14:37   ` Rob Herring
2024-07-20 20:00     ` Harry Austen
2024-07-20 12:01 ` [PATCH 5/7] clk: clocking-wizard: add user clock monitor support Harry Austen
2024-07-23 23:29   ` Stephen Boyd
2024-07-25 18:05     ` Harry Austen
2024-07-20 12:01 ` [PATCH 6/7] dt-bindings: clock: xilinx: describe whether dynamic reconfig is enabled Harry Austen
2024-07-22 17:13   ` Conor Dooley
2024-07-25 17:53     ` Harry Austen
2024-07-20 12:02 ` [PATCH 7/7] clk: clocking-wizard: move dynamic reconfig setup behind flag Harry Austen

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=d02cd87b7a52067d6eb9b4ef3c5b7803.sboyd@kernel.org \
    --to=sboyd@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=hpausten@protonmail.com \
    --cc=krzk+dt@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=robh@kernel.org \
    --cc=shubhrajyoti.datta@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;
as well as URLs for NNTP newsgroup(s).