Thread (21 messages) 21 messages, 4 authors, 2020-07-02

Re: [PATCH V4 5/5] clk: imx8qxp: Support building i.MX8QXP clock driver as module

From: Dong Aisheng <hidden>
Date: 2020-07-02 05:43:17
Also in: linux-clk, lkml

On Thu, Jul 2, 2020 at 11:55 AM Anson Huang [off-list ref] wrote:
[...]
quoted
quoted
+{
+       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
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help