Linux clock framework development
 help / color / mirror / Atom feed
From: Samuel Holland <samuel.holland@sifive.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: linux-clk@vger.kernel.org, linux-riscv@lists.infradead.org,
	linux-kernel@vger.kernel.org,
	Emil Renner Berthing <kernel@esmil.dk>,
	Hal Feng <hal.feng@starfivetech.com>,
	Michael Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@kernel.org>,
	Paul Walmsley <paul.walmsley@sifive.com>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Albert Ou <aou@eecs.berkeley.edu>,
	Conor Dooley <conor.dooley@microchip.com>,
	Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>,
	Andy Shevchenko <andy.shevchenko@gmail.com>
Subject: Re: [PATCH v2] clk: starfive: jh7100: Use clk_hw for external input clocks
Date: Wed, 20 Mar 2024 09:59:51 -0500	[thread overview]
Message-ID: <0a807505-221c-4aa9-ac63-c442417f3030@sifive.com> (raw)
In-Reply-To: <CAMuHMdWP4R6Y6G0qzhMKJy1zJEeHE8a0XEK+Hs_D4wXB2i2BFA@mail.gmail.com>

Hi Geert,

On 2024-03-20 9:28 AM, Geert Uytterhoeven wrote:
> On Wed, Mar 20, 2024 at 2:31 PM Samuel Holland
> <samuel.holland@sifive.com> wrote:
>> On 2024-03-20 6:24 AM, Geert Uytterhoeven wrote:
>>> The Starfive JH7100 clock driver does not use the DT "clocks" property
>>> to find the external main input clock, but instead relies on the name of
>>> the actual clock provider ("osc_sys").  This is fragile, and caused
>>> breakage when sanitizing clock node names in DTS.
>>>
>>> Fix this by obtaining the external main input clock using
>>> devm_clk_get(), and passing the returned clk_hw object to
>>> devm_clk_hw_register_fixed_factor_parent_hw().
>>>
>>> While name-based look-up of the other external input clocks works as-is,
>>> convert them to a similar clk_hw-based scheme to increase uniformity,
>>> and to decrease the number of name-based look-ups.
>>>
>>> Fixes: f03606470886 ("riscv: dts: starfive: replace underscores in node names")
>>> Fixes: 4210be668a09ee20 ("clk: starfive: Add JH7100 clock generator driver")
>>> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
> 
> 
>>> --- a/drivers/clk/starfive/clk-starfive-jh7100.c
>>> +++ b/drivers/clk/starfive/clk-starfive-jh7100.c
> 
>>> @@ -284,8 +293,11 @@ static struct clk_hw *jh7100_clk_get(struct of_phandle_args *clkspec, void *data
>>>
>>>  static int __init clk_starfive_jh7100_probe(struct platform_device *pdev)
>>>  {
>>> +     static const char *jh7100_ext_clk[EXT_NUM_CLKS] =
>>> +             { "osc_sys", "osc_aud", "gmac_rmii_ref", "gmac_gr_mii_rxclk" };
>>
>> This should be __initconst. Otherwise:
> 
> With
> 
>     -       static const char *jh7100_ext_clk[EXT_NUM_CLKS] =
>     +       static const char *jh7100_ext_clk[EXT_NUM_CLKS] __initconst =
> 
> I get:
> 
>     drivers/clk/starfive/clk-starfive-jh7100.c: In function
> ‘clk_starfive_jh7100_probe’:
>     drivers/clk/starfive/clk-starfive-jh7100.c:35:37: error:
> ‘jh7100_clk_data’ causes a section type conflict with ‘jh7100_ext_clk’
>        35 | static const struct jh71x0_clk_data jh7100_clk_data[]
> __initconst = {
>           |                                     ^~~~~~~~~~~~~~~
>     drivers/clk/starfive/clk-starfive-jh7100.c:296:28: note:
> ‘jh7100_ext_clk’ was declared here
>       296 |         static const char *jh7100_ext_clk[EXT_NUM_CLKS]
> __initconst =
>           |                            ^~~~~~~~~~~~~~
> 
> which is a bit strange...
> What am I missing?

I think you need to add another "const" covering the array itself:

	static const char *const jh7100_ext_clk[EXT_NUM_CLKS] __initconst =

Regards,
Samuel


      reply	other threads:[~2024-03-20 14:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-20 11:24 [PATCH v2] clk: starfive: jh7100: Use clk_hw for external input clocks Geert Uytterhoeven
2024-03-20 13:31 ` Samuel Holland
2024-03-20 14:28   ` Geert Uytterhoeven
2024-03-20 14:59     ` Samuel Holland [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=0a807505-221c-4aa9-ac63-c442417f3030@sifive.com \
    --to=samuel.holland@sifive.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=aou@eecs.berkeley.edu \
    --cc=conor.dooley@microchip.com \
    --cc=geert@linux-m68k.org \
    --cc=hal.feng@starfivetech.com \
    --cc=kernel@esmil.dk \
    --cc=krzysztof.kozlowski@linaro.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=mturquette@baylibre.com \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    --cc=sboyd@kernel.org \
    /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