Re: [PATCH v2 06/16] clk: starfive: Add JH7100 clock generator driver
From: Andy Shevchenko
Date: Wed Oct 27 2021 - 06:33:33 EST
On Wed, Oct 27, 2021 at 12:24:07PM +0200, Emil Renner Berthing wrote:
> On Wed, 27 Oct 2021 at 02:54, Stephen Boyd <sboyd@xxxxxxxxxx> wrote:
> > Quoting Emil Renner Berthing (2021-10-26 15:35:36)
> > > On Tue, 26 Oct 2021 at 22:20, Stephen Boyd <sboyd@xxxxxxxxxx> wrote:
> > > > Quoting Emil Renner Berthing (2021-10-21 10:42:13)
...
> > > > > +static int __init clk_starfive_jh7100_probe(struct platform_device *pdev)
> > > >
> > > > Drop __init as this can be called after kernel init is over.
> > >
> > > Oh interesting, I'd like to know when that can happen. The comment for
> > > the builtin_platform_driver macro says it's just a wrapper for
> >
> > I thought this was using module_platform_driver() macro?
> >
> > > device_initcall.
> > >
> > > Won't we then need to remove all the __initconst tags too since the
> > > probe function walks through jh7100_clk_data which eventually
> > > references all __initconst data?
> >
> > Yes. If it's builtin_platform_driver() it can't be a module/tristate
> > Kconfig, in which case all the init markings can stay.
>
> Yes, it's already bool in the Kconfig file. After looking into this I
> think it's better to do like the rockchip drivers and use
> builtin_platform_driver_probe to make sure the probe function only
> called at kernel init time:
>
> static struct platform_driver clk_starfive_jh7100_driver = {
> .driver = {
> .name = "clk-starfive-jh7100",
> .of_match_table = clk_starfive_jh7100_match,
> .suppress_bind_attrs = true,
> },
> };
> builtin_platform_driver_probe(clk_starfive_jh7100_driver,
> clk_starfive_jh7100_probe);
>
> @Andy: is the supress_bind_attrs what you were asking about?
Clever chap! :-)
Yes, that's what I have in mind.
...
> > If it's never going to be a module then don't add any module_* things.
>
> So does that just mean no MODULE_DEVICE_TABLE or should I also remove
> MODULE_DESCRIPTION, MODULE_AUTHOR and MODULE_LICENSE? I'm just double
> checking because the rockchip drivers seem to have MODULE_DESCRIPTION
> and MODULE_LICENSE lines.
You may comment them out. Convert them to comments or so.
But in general yes, they are no-ops in such case.
--
With Best Regards,
Andy Shevchenko