[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAA+hA=RqvRVm9c635NXFQSeDekBPz9DU=eP4+LrBQpRR=-swZw@mail.gmail.com>
Date: Thu, 2 Jul 2020 13:29:12 +0800
From: Dong Aisheng <dongas86@...il.com>
To: Anson Huang <anson.huang@....com>
Cc: Michael Turquette <mturquette@...libre.com>,
Stephen Boyd <sboyd@...nel.org>,
Shawn Guo <shawnguo@...nel.org>,
Sascha Hauer <s.hauer@...gutronix.de>,
Sascha Hauer <kernel@...gutronix.de>,
Fabio Estevam <festevam@...il.com>,
Peng Fan <peng.fan@....com>, Arnd Bergmann <arnd@...db.de>,
Abel Vesa <abel.vesa@....com>,
Aisheng Dong <aisheng.dong@....com>,
Andy Duan <fugang.duan@....com>,
Daniel Baluta <daniel.baluta@....com>,
YueHaibing <yuehaibing@...wei.com>,
Stephen Rothwell <sfr@...b.auug.org.au>,
linux-clk <linux-clk@...r.kernel.org>,
open list <linux-kernel@...r.kernel.org>,
"moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE"
<linux-arm-kernel@...ts.infradead.org>,
dl-linux-imx <linux-imx@....com>
Subject: Re: [PATCH V4 5/5] clk: imx8qxp: Support building i.MX8QXP clock
driver as module
On Thu, Jul 2, 2020 at 11:55 AM Anson Huang <anson.huang@....com> wrote:
[...]
> > > +{
> > > + return platform_driver_register(&imx8qxp_lpcg_clk_driver);
> > > +}
> > > +device_initcall(imx8qxp_lpcg_clk_init);
> >
> > Any reason to change to device_initcall which looks a bit strange?
> > Is it because the following line?
> > +obj-$(CONFIG_MXC_CLK_SCU) += clk-imx-scu.o clk-imx-lpcg-scu.o
> > But it looks to me they're still two modules. Aren't they?
>
> It is suggested by Arnd to NOT use builtin_platform_driver(), in order to support module
> unload, although the clock driver normally does NOT support remove, but it is better to
> follow the right way.
>
By expanding builtin_platform_driver() marcro, you will find your
patch is exactly doing the same thing
as buildin_platform_driver() which obivously is unneccesary.
#define builtin_platform_driver(__platform_driver) \
builtin_driver(__platform_driver, platform_driver_register)
#define builtin_driver(__driver, __register, ...) \
static int __init __driver##_init(void) \
{ \
return __register(&(__driver) , ##__VA_ARGS__); \
} \
device_initcall(__driver##_init);
If we want to support unload, we need a .remove() callback as current
clocks are not allocated by devm_().
If don't support, we probably can use builtin_platform_driver() first
and switch to module_platform_driver()
in the future once the driver supports release resource properly.
Regards
Aisheng
> The change in Makefile is just to link scu/lpcg library to i.MX8QXP clk driver, so that we can
> get rid of exports and below 2 .ko are needed for all i.MX SoCs with SCU inside as per your
> saying of i.MX8QXP clock driver can be extended for future SoCs with SCU.
>
> clk-imx-lpcg-scu.ko
> clk-imx-scu.ko
>
> Thanks,
> Anson
Powered by blists - more mailing lists