[PATCH v3 4/5] clk: clk-gpio: add driver for gated-fixed-clocks
Heiko Stübner
heiko at sntech.de
Thu Sep 5 15:48:35 PDT 2024
Am Mittwoch, 28. August 2024, 20:30:51 CEST schrieb Stephen Boyd:
> Quoting Heiko Stuebner (2024-08-28 03:15:02)
[leaving out all the "will fix" parts :-) ]
> > +static struct platform_driver gated_fixed_clk_driver = {
> > + .probe = clk_gated_fixed_probe,
> > + .driver = {
> > + .name = "gated-fixed-clk",
> > + .of_match_table = gated_fixed_clk_match_table,
> > + },
> > +};
> > +builtin_platform_driver(gated_fixed_clk_driver);
>
> The comment above builtin_platform_driver says "Each driver may only use
> this macro once". Seems that we need to expand the macro.
each _driver_, not each file is the important point I think.
Looking at the code generation, it just wants to use the name of the
driver struct for generating the init functions.
So in the builtin_driver macro [0] it wants to use the
gated_fixed_clk_driver to create the init-function as
gated_fixed_clk_driver_init() hence anybody using the macro a second time
for the same driver would create that function two times.
Also as can be seen with the imx gpc driver [1], the two-drivers in the
same file is already in use.
I've also done a practical test with that and did [2], which resulted in
both drivers getting registered as expected:
[ 0.132087] ----init gpio_clk_driver
[ 0.132160] ----init gated_fixed_clk_driver
So not sure, if I misinterpreted your comment, but I don't think changes
are necessary for this portion.
Heiko
[0] https://elixir.bootlin.com/linux/v6.10.8/source/include/linux/device/driver.h#L284
[1]
https://elixir.bootlin.com/linux/v6.10.8/source/drivers/pmdomain/imx/gpc.c#L239
https://elixir.bootlin.com/linux/v6.10.8/source/drivers/pmdomain/imx/gpc.c#L556
[2]
diff --git a/include/linux/device/driver.h b/include/linux/device/driver.h
index 1fc8b68786de..e306f554cd0f 100644
--- a/include/linux/device/driver.h
+++ b/include/linux/device/driver.h
@@ -284,6 +284,7 @@ module_exit(__driver##_exit);
#define builtin_driver(__driver, __register, ...) \
static int __init __driver##_init(void) \
{ \
+ printk("----init %s\n", __stringify(__driver)); \
return __register(&(__driver) , ##__VA_ARGS__); \
} \
device_initcall(__driver##_init);
More information about the Linux-rockchip
mailing list