Messages in this thread | | | From | Dong Aisheng <> | Date | Thu, 2 Jul 2020 13:29:12 +0800 | 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@nxp.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
| |