diff mbox series

[RESEND,3/4] clk: mediatek: support COMMON_CLK_MT6779 module build

Message ID 20210813032429.14715-4-miles.chen@mediatek.com (mailing list archive)
State New, archived
Headers show
Series clk: mediatek: modularize COMMON_CLK_MT6779 | expand

Commit Message

Miles Chen Aug. 13, 2021, 3:24 a.m. UTC
To support COMMON_CLK_MT6779* module build,
add MODULE_LICENSE and export necessary symbols.

Cc: Stephen Boyd <sboyd@kernel.org>
Cc: Hanks Chen <hanks.chen@mediatek.com>
Cc: Wendell Lin <wendell.lin@mediatek.com>
Cc: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Miles Chen <miles.chen@mediatek.com>
---
 drivers/clk/mediatek/clk-mt6779-aud.c  | 2 ++
 drivers/clk/mediatek/clk-mt6779-cam.c  | 2 ++
 drivers/clk/mediatek/clk-mt6779-img.c  | 2 ++
 drivers/clk/mediatek/clk-mt6779-ipe.c  | 2 ++
 drivers/clk/mediatek/clk-mt6779-mfg.c  | 2 ++
 drivers/clk/mediatek/clk-mt6779-mm.c   | 2 ++
 drivers/clk/mediatek/clk-mt6779-vdec.c | 2 ++
 drivers/clk/mediatek/clk-mt6779-venc.c | 2 ++
 drivers/clk/mediatek/clk-mt6779.c      | 2 ++
 9 files changed, 18 insertions(+)

Comments

Stephen Boyd Aug. 29, 2021, 4:14 a.m. UTC | #1
Quoting Miles Chen (2021-08-12 20:24:28)
> diff --git a/drivers/clk/mediatek/clk-mt6779-aud.c b/drivers/clk/mediatek/clk-mt6779-aud.c
> index 11b209f95e25..439c0bc94b73 100644
> --- a/drivers/clk/mediatek/clk-mt6779-aud.c
> +++ b/drivers/clk/mediatek/clk-mt6779-aud.c
> @@ -4,6 +4,7 @@
>   * Author: Wendell Lin <wendell.lin@mediatek.com>
>   */
>  
> +#include <linux/module.h>
>  #include <linux/clk-provider.h>
>  #include <linux/of.h>
>  #include <linux/of_address.h>
> @@ -115,3 +116,4 @@ static struct platform_driver clk_mt6779_aud_drv = {
>  };
>  
>  builtin_platform_driver(clk_mt6779_aud_drv);
> +MODULE_LICENSE("GPL");

How does this work? builtin_platform_driver() means that it's not
modular code. Shouldn't that be module_platform_driver()? Have you tried
loading and unloading the module?
Miles Chen Aug. 30, 2021, 6:43 p.m. UTC | #2
On Sat, 2021-08-28 at 21:14 -0700, Stephen Boyd wrote:
> Quoting Miles Chen (2021-08-12 20:24:28)
> > diff --git a/drivers/clk/mediatek/clk-mt6779-aud.c b/drivers/clk/mediatek/clk-mt6779-aud.c
> > index 11b209f95e25..439c0bc94b73 100644
> > --- a/drivers/clk/mediatek/clk-mt6779-aud.c
> > +++ b/drivers/clk/mediatek/clk-mt6779-aud.c
> > @@ -4,6 +4,7 @@
> >   * Author: Wendell Lin <wendell.lin@mediatek.com>
> >   */
> >  
> > +#include <linux/module.h>
> >  #include <linux/clk-provider.h>
> >  #include <linux/of.h>
> >  #include <linux/of_address.h>
> > @@ -115,3 +116,4 @@ static struct platform_driver clk_mt6779_aud_drv = {
> >  };
> >  
> >  builtin_platform_driver(clk_mt6779_aud_drv);
> > +MODULE_LICENSE("GPL");
> 
> How does this work? builtin_platform_driver() means that it's not
> modular code. Shouldn't that be module_platform_driver()? Have you tried
> loading and unloading the module?

sorry for my late response. 

Thanks for pointing this out. I have the same question when I was
building this patch. That time I found some examples where
they are using builtin_platform_driver and can be built as 
kernel modules:

config CLK_IMX8QXP (tristate) && drivers/clk/imx/clk-imx8qxp-lpcg.c
config CLK_RK3399 (tristate) && drivers/clk/rockchip/clk-rk3399.c

my load test:
load these moduless and do 'lsmod' on v5.14-rc1/mt6779 environment:

clk_mt6779_aud 16384 0 [permanent], Live 0xffff800008fd8000
clk_mt6779_mfg 16384 0 [permanent], Live 0xffff800008fd0000
clk_mt6779_venc 16384 0 [permanent], Live 0xffff800008fc8000
clk_mt6779_vdec 16384 0 [permanent], Live 0xffff800008fc0000
clk_mt6779_cam 16384 0 [permanent], Live 0xffff800008fb8000
clk_mt6779_ipe 16384 0 [permanent], Live 0xffff800008fb0000
clk_mt6779_img 16384 0 [permanent], Live 0xffff800008fa8000
clk_mt6779_mm 16384 0 [permanent], Live 0xffff800008fa0000

I did not test 'unload' kernel modules because I did not
define module_exit in this patch.

But as you pointed out, it should be module_platform_driver().
I will use module_platform_driver() in the next patch.


Miles
Stephen Boyd Sept. 1, 2021, 5:32 a.m. UTC | #3
Quoting Miles Chen (2021-08-30 11:43:04)
> 
> sorry for my late response. 
> 
> Thanks for pointing this out. I have the same question when I was
> building this patch. That time I found some examples where
> they are using builtin_platform_driver and can be built as 
> kernel modules:
> 
> config CLK_IMX8QXP (tristate) && drivers/clk/imx/clk-imx8qxp-lpcg.c
> config CLK_RK3399 (tristate) && drivers/clk/rockchip/clk-rk3399.c

We should fix those drivers. Care to send a patch?
Miles Chen Sept. 1, 2021, 10:04 p.m. UTC | #4
On Tue, 2021-08-31 at 22:32 -0700, Stephen Boyd wrote:
> Quoting Miles Chen (2021-08-30 11:43:04)
> > 
> > sorry for my late response. 
> > 
> > Thanks for pointing this out. I have the same question when I was
> > building this patch. That time I found some examples where
> > they are using builtin_platform_driver and can be built as 
> > kernel modules:
> > 
> > config CLK_IMX8QXP (tristate) && drivers/clk/imx/clk-imx8qxp-lpcg.c
> > config CLK_RK3399 (tristate) && drivers/clk/rockchip/clk-rk3399.c
> 
> We should fix those drivers. Care to send a patch?

No problem. I will check drviers/clk and submit fix patches.

Miles
diff mbox series

Patch

diff --git a/drivers/clk/mediatek/clk-mt6779-aud.c b/drivers/clk/mediatek/clk-mt6779-aud.c
index 11b209f95e25..439c0bc94b73 100644
--- a/drivers/clk/mediatek/clk-mt6779-aud.c
+++ b/drivers/clk/mediatek/clk-mt6779-aud.c
@@ -4,6 +4,7 @@ 
  * Author: Wendell Lin <wendell.lin@mediatek.com>
  */
 
+#include <linux/module.h>
 #include <linux/clk-provider.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
@@ -115,3 +116,4 @@  static struct platform_driver clk_mt6779_aud_drv = {
 };
 
 builtin_platform_driver(clk_mt6779_aud_drv);
+MODULE_LICENSE("GPL");
diff --git a/drivers/clk/mediatek/clk-mt6779-cam.c b/drivers/clk/mediatek/clk-mt6779-cam.c
index 244d4208b7fb..c99ddb210b70 100644
--- a/drivers/clk/mediatek/clk-mt6779-cam.c
+++ b/drivers/clk/mediatek/clk-mt6779-cam.c
@@ -4,6 +4,7 @@ 
  * Author: Wendell Lin <wendell.lin@mediatek.com>
  */
 
+#include <linux/module.h>
 #include <linux/clk-provider.h>
 #include <linux/platform_device.h>
 #include <dt-bindings/clock/mt6779-clk.h>
@@ -64,3 +65,4 @@  static struct platform_driver clk_mt6779_cam_drv = {
 };
 
 builtin_platform_driver(clk_mt6779_cam_drv);
+MODULE_LICENSE("GPL");
diff --git a/drivers/clk/mediatek/clk-mt6779-img.c b/drivers/clk/mediatek/clk-mt6779-img.c
index 26292a45c613..bf652052879c 100644
--- a/drivers/clk/mediatek/clk-mt6779-img.c
+++ b/drivers/clk/mediatek/clk-mt6779-img.c
@@ -4,6 +4,7 @@ 
  * Author: Wendell Lin <wendell.lin@mediatek.com>
  */
 
+#include <linux/module.h>
 #include <linux/clk-provider.h>
 #include <linux/platform_device.h>
 #include <dt-bindings/clock/mt6779-clk.h>
@@ -56,3 +57,4 @@  static struct platform_driver clk_mt6779_img_drv = {
 };
 
 builtin_platform_driver(clk_mt6779_img_drv);
+MODULE_LICENSE("GPL");
diff --git a/drivers/clk/mediatek/clk-mt6779-ipe.c b/drivers/clk/mediatek/clk-mt6779-ipe.c
index bb519075639c..a1a1c9cb329a 100644
--- a/drivers/clk/mediatek/clk-mt6779-ipe.c
+++ b/drivers/clk/mediatek/clk-mt6779-ipe.c
@@ -4,6 +4,7 @@ 
  * Author: Wendell Lin <wendell.lin@mediatek.com>
  */
 
+#include <linux/module.h>
 #include <linux/clk-provider.h>
 #include <linux/platform_device.h>
 #include <dt-bindings/clock/mt6779-clk.h>
@@ -58,3 +59,4 @@  static struct platform_driver clk_mt6779_ipe_drv = {
 };
 
 builtin_platform_driver(clk_mt6779_ipe_drv);
+MODULE_LICENSE("GPL");
diff --git a/drivers/clk/mediatek/clk-mt6779-mfg.c b/drivers/clk/mediatek/clk-mt6779-mfg.c
index c6ee2a89c070..9bf48c56d852 100644
--- a/drivers/clk/mediatek/clk-mt6779-mfg.c
+++ b/drivers/clk/mediatek/clk-mt6779-mfg.c
@@ -4,6 +4,7 @@ 
  * Author: Wendell Lin <wendell.lin@mediatek.com>
  */
 
+#include <linux/module.h>
 #include <linux/clk-provider.h>
 #include <linux/platform_device.h>
 
@@ -53,3 +54,4 @@  static struct platform_driver clk_mt6779_mfg_drv = {
 };
 
 builtin_platform_driver(clk_mt6779_mfg_drv);
+MODULE_LICENSE("GPL");
diff --git a/drivers/clk/mediatek/clk-mt6779-mm.c b/drivers/clk/mediatek/clk-mt6779-mm.c
index 059c1a41ac7a..d5ead5531026 100644
--- a/drivers/clk/mediatek/clk-mt6779-mm.c
+++ b/drivers/clk/mediatek/clk-mt6779-mm.c
@@ -4,6 +4,7 @@ 
  * Author: Wendell Lin <wendell.lin@mediatek.com>
  */
 
+#include <linux/module.h>
 #include <linux/clk-provider.h>
 #include <linux/platform_device.h>
 #include <dt-bindings/clock/mt6779-clk.h>
@@ -106,3 +107,4 @@  static struct platform_driver clk_mt6779_mm_drv = {
 };
 
 builtin_platform_driver(clk_mt6779_mm_drv);
+MODULE_LICENSE("GPL");
diff --git a/drivers/clk/mediatek/clk-mt6779-vdec.c b/drivers/clk/mediatek/clk-mt6779-vdec.c
index 1900da2586a1..ff7390e4c5f5 100644
--- a/drivers/clk/mediatek/clk-mt6779-vdec.c
+++ b/drivers/clk/mediatek/clk-mt6779-vdec.c
@@ -4,6 +4,7 @@ 
  * Author: Wendell Lin <wendell.lin@mediatek.com>
  */
 
+#include <linux/module.h>
 #include <linux/clk-provider.h>
 #include <linux/platform_device.h>
 
@@ -65,3 +66,4 @@  static struct platform_driver clk_mt6779_vdec_drv = {
 };
 
 builtin_platform_driver(clk_mt6779_vdec_drv);
+MODULE_LICENSE("GPL");
diff --git a/drivers/clk/mediatek/clk-mt6779-venc.c b/drivers/clk/mediatek/clk-mt6779-venc.c
index b41d1f859edc..489bf64346e3 100644
--- a/drivers/clk/mediatek/clk-mt6779-venc.c
+++ b/drivers/clk/mediatek/clk-mt6779-venc.c
@@ -4,6 +4,7 @@ 
  * Author: Wendell Lin <wendell.lin@mediatek.com>
  */
 
+#include <linux/module.h>
 #include <linux/clk-provider.h>
 #include <linux/platform_device.h>
 
@@ -56,3 +57,4 @@  static struct platform_driver clk_mt6779_venc_drv = {
 };
 
 builtin_platform_driver(clk_mt6779_venc_drv);
+MODULE_LICENSE("GPL");
diff --git a/drivers/clk/mediatek/clk-mt6779.c b/drivers/clk/mediatek/clk-mt6779.c
index 6e0d3a166729..9825385c9f94 100644
--- a/drivers/clk/mediatek/clk-mt6779.c
+++ b/drivers/clk/mediatek/clk-mt6779.c
@@ -4,6 +4,7 @@ 
  * Author: Wendell Lin <wendell.lin@mediatek.com>
  */
 
+#include <linux/module.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/of_device.h>
@@ -1314,3 +1315,4 @@  static int __init clk_mt6779_init(void)
 }
 
 arch_initcall(clk_mt6779_init);
+MODULE_LICENSE("GPL");