Skip to contentSkip to conversation

clk: spacemit: Fix module build for spacemit common ccu driver

PATCH Yixun Lan 2 participants 3 messages Dec 17, 2025 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Yixun Lan

author
#1 lore raw

Hi Inochi,

just noticed, you failed to CC to the mailing list please increase patch version and send a v3 next time..

also please see my comments below

Quoted 24 lines · Inochi Amaoto

For build spacemit common clock driver as a module, the build process require MODULE_LICENSE()/MODULE_DESCRIPTION() globally and EXPORT_SYMBOL() for every exposed symbol. Otherwise, the build will fail.

Add these missing hints, so the driver can be built as a module.

Fixes 1b72c59db0ad ("clk: spacemit: Add clock support for SpacemiT K1 SoC")

---
Change from v1:
1. Use EXPORT_SYMBOL_NS_GPL to export clock ops

---
 drivers/clk/spacemit/ccu-k1.c  | 1 +
 drivers/clk/spacemit/ccu_ddn.c | 1 +
 drivers/clk/spacemit/ccu_mix.c | 9 +++++++++
 drivers/clk/spacemit/ccu_pll.c | 5 +++++
 4 files changed, 16 insertions(+)
drivers/clk/spacemit/ccu-k1.c +0 -0
index 4761bc1e3b6e..1f42b8045bf3 100644

drivers/clk/spacemit/ccu-k1.c static struct platform_driver k1_ccu_driver = { · line 1207

Quoted 4 lines
drivers/clk/spacemit/ccu-k1.c +1 -0
@@ -1204,6 +1204,7 @@ static struct platform_driver k1_ccu_driver = {
 };
 module_platform_driver(k1_ccu_driver);
 
+MODULE_IMPORT_NS("SPACEMIT_CCU");

the name should be ok as long as no collision and unique, but.. I personally would prefer "CLK_SPACEMIT" which follow "subsytem + vendor"

drivers/clk/spacemit/ccu_pll.c

Quoted 4 lines
drivers/clk/spacemit/ccu-k1.c +0 -0
 MODULE_DESCRIPTION("SpacemiT K1 CCU driver");
 MODULE_AUTHOR("Haylen Chu <[email protected]>");
 MODULE_LICENSE("GPL");
drivers/clk/spacemit/ccu_pll.c +0 -0

[snip]...

Quoted 17 lines

index d92f0dae65a4..893af23c6b25 100644

drivers/clk/spacemit/ccu_pll.c +3 -0
@@ -7,6 +7,7 @@
 #include <linux/clk-provider.h>
 #include <linux/math.h>
 #include <linux/regmap.h>
+#include <linux/module.h>
 
 #include "ccu_common.h"
 #include "ccu_pll.h"
@@ -157,3 +158,7 @@ const struct clk_ops spacemit_ccu_pll_ops = {
 	.determine_rate = ccu_pll_determine_rate,
 	.is_enabled	= ccu_pll_is_enabled,
 };
+EXPORT_SYMBOL_NS_GPL(spacemit_ccu_pll_ops, "SPACEMIT_CCU");
+

..

Quoted 1 line

+MODULE_DESCRIPTION("SpacemiT CCU PLL/MIX/DDN common driver");

how about name it more generic? you don't know whether any other clock type will be added in the future, so
"SpacemiT CCU common clock driver"

Quoted 1 line

+MODULE_LICENSE("GPL");

I've got a comment [1] from Ziyao in the review of K3 clock driver that suggest to distill the common probe function, which make sense. So, I plan to have separated ccu_common.c file, with this change, it would be more proper to put MODULE_DESCRIPTION/MODULE_LICENSE into that file

It might takes some time to get there, as I now got a weird panic/hang issue with that change..

Signature · 1 line
Yixun Lan (dlan)
#2 lore raw
Quoted 7 lines · Yixun Lan

Hi Inochi,

just noticed, you failed to CC to the mailing list please increase patch version and send a v3 next time..

also please see my comments below

Yeah, It is my mistake. I failed to add cc/to with git send-mail.

Quoted 28 lines · Inochi Amaoto
Quoted 27 lines

For build spacemit common clock driver as a module, the build process require MODULE_LICENSE()/MODULE_DESCRIPTION() globally and EXPORT_SYMBOL() for every exposed symbol. Otherwise, the build will fail.

Add these missing hints, so the driver can be built as a module.

Fixes 1b72c59db0ad ("clk: spacemit: Add clock support for SpacemiT K1 SoC")

---
Change from v1:
1. Use EXPORT_SYMBOL_NS_GPL to export clock ops

---
 drivers/clk/spacemit/ccu-k1.c  | 1 +
 drivers/clk/spacemit/ccu_ddn.c | 1 +
 drivers/clk/spacemit/ccu_mix.c | 9 +++++++++
 drivers/clk/spacemit/ccu_pll.c | 5 +++++
 4 files changed, 16 insertions(+)
drivers/clk/spacemit/ccu-k1.c +0 -0
index 4761bc1e3b6e..1f42b8045bf3 100644
@@ -1204,6 +1204,7 @@ static struct platform_driver k1_ccu_driver = {
 };
 module_platform_driver(k1_ccu_driver);
 
Quoted 4 lines

drivers/clk/spacemit/ccu-k1.c static struct platform_driver k1_ccu_driver = { · line 1207

Quoted 1 line
drivers/clk/spacemit/ccu-k1.c +1 -0
+MODULE_IMPORT_NS("SPACEMIT_CCU");

the name should be ok as long as no collision and unique, but.. I personally would prefer "CLK_SPACEMIT" which follow "subsytem + vendor"

I disagree with you, after doing a grep, I found it is more common to use "vendor + xxx" format.

Quoted 25 lines

drivers/clk/spacemit/ccu_pll.c

Quoted 4 lines
drivers/clk/spacemit/ccu-k1.c +0 -0
 MODULE_DESCRIPTION("SpacemiT K1 CCU driver");
 MODULE_AUTHOR("Haylen Chu <[email protected]>");
 MODULE_LICENSE("GPL");
drivers/clk/spacemit/ccu_pll.c +0 -0

[snip]...

Quoted 17 lines

index d92f0dae65a4..893af23c6b25 100644

drivers/clk/spacemit/ccu_pll.c +3 -0
@@ -7,6 +7,7 @@
 #include <linux/clk-provider.h>
 #include <linux/math.h>
 #include <linux/regmap.h>
+#include <linux/module.h>
 
 #include "ccu_common.h"
 #include "ccu_pll.h"
@@ -157,3 +158,7 @@ const struct clk_ops spacemit_ccu_pll_ops = {
 	.determine_rate = ccu_pll_determine_rate,
 	.is_enabled	= ccu_pll_is_enabled,
 };
+EXPORT_SYMBOL_NS_GPL(spacemit_ccu_pll_ops, "SPACEMIT_CCU");
+

..

Quoted 5 lines
Quoted 1 line

+MODULE_DESCRIPTION("SpacemiT CCU PLL/MIX/DDN common driver");

how about name it more generic? you don't know whether any other clock type will be added in the future, so
"SpacemiT CCU common clock driver"

This is fine for me.

Quoted 7 lines
Quoted 1 line

+MODULE_LICENSE("GPL");

I've got a comment [1] from Ziyao in the review of K3 clock driver that suggest to distill the common probe function, which make sense. So, I plan to have separated ccu_common.c file, with this change, it would be more proper to put MODULE_DESCRIPTION/MODULE_LICENSE into that file

Quoted 5 lines

It might takes some time to get there, as I now got a weird panic/hang issue with that change..

I have seen the K3 driver, but I think it is still necessary to add this line to this file. As this is a fix and it may be ported to the other version if got merged. So it is better to just add these line in the ccu_pll.c and then you can move them in the file you desired.

Regards,
Inochi

author
#3 lore raw

Hi Inochi,

Quoted 3 lines · Inochi Amaoto
Quoted 2 lines · Yixun Lan

Hi Inochi,

..

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

+MODULE_IMPORT_NS("SPACEMIT_CCU");

the name should be ok as long as no collision and unique, but.. I personally would prefer "CLK_SPACEMIT" which follow "subsytem + vendor"

I disagree with you, after doing a grep, I found it is more common to use "vendor + xxx" format.

I do not have strong preference, as I said on condition that it's unique, and I do see Allwinner driver using "SUNXI_CCU" (driver/clk/sunxi-ng)

so if clock maintainer have no objection and don't want any enforcement, then it would be fine by me

Quoted 11 lines
Quoted 11 lines
Quoted 2 lines

+MODULE_LICENSE("GPL");

I've got a comment [1] from Ziyao in the review of K3 clock driver that suggest to distill the common probe function, which make sense. So, I plan to have separated ccu_common.c file, with this change, it would be more proper to put MODULE_DESCRIPTION/MODULE_LICENSE into that file

It might takes some time to get there, as I now got a weird panic/hang issue with that change..

Quoted 8 lines
Quoted 2 lines

I have seen the K3 driver, but I think it is still necessary to add this line to this file. As this is a fix and it may be ported to the other version if got merged. So it is better to just add these line in the ccu_pll.c and then you can move them in the file you desired.

fair, let's push this first, then I'll try to refactor on top of it

thanks

Signature · 1 line
Yixun Lan (dlan)