[RFC PATCH] clk: imx8qxp: Unbreak auto module building for MXC_CLK_SCU

Sebastian Andrzej Siewior bigeasy at linutronix.de
Tue Nov 24 07:17:40 EST 2020


Automatic moudule building is broken by adding module support to
i.MX8QXP clock driver. It can be tested by ARM defconfig +
CONFIG_IMX_MBOX=m and CONFIG_MXC_CLK_SCU=m.

The compile breaks because the modules and source files are mixed.
After fixing that, the build breaks because the SCU driver has no
license or symbols, which are required by the CLK_IMX8QXP driver, are
not properly exported.

The following patch is against -rc5:

Compile module clk-imx-scu.o which contains of clk-scu.o clk-lpcg-scu.o
if CONFIG_MXC_CLK_SCU is enabled.
Compile modules clk-imx8qxp.o and clk-imx8qxp-lpcg.o if
CONFIG_CLK_IMX8QXP is enabled.
Add EXPORT_SYMBOL_GPL() to functions which fail to resolve once
CONFIG_CLK_IMX8QXP is enabled as module.
Add License GPL to clk-scu.c.

In -next it breaks additionally because device_is_bound() is not made available
to modules.
Any suggestions? Should the original commit be revoked?

Fixes: e0d0d4d86c766 ("clk: imx8qxp: Support building i.MX8QXP clock driver as module")
Signed-off-by: Sebastian Andrzej Siewior <bigeasy at linutronix.de>
---

 drivers/clk/imx/Makefile       | 6 +++---
 drivers/clk/imx/clk-lpcg-scu.c | 1 +
 drivers/clk/imx/clk-scu.c      | 4 ++++
 3 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/clk/imx/Makefile b/drivers/clk/imx/Makefile
index dd6a737d060b4..b8bf9460c91d7 100644
--- a/drivers/clk/imx/Makefile
+++ b/drivers/clk/imx/Makefile
@@ -26,9 +26,9 @@ obj-$(CONFIG_CLK_IMX8MN) += clk-imx8mn.o
 obj-$(CONFIG_CLK_IMX8MP) += clk-imx8mp.o
 obj-$(CONFIG_CLK_IMX8MQ) += clk-imx8mq.o
 
-obj-$(CONFIG_MXC_CLK_SCU) += clk-imx-scu.o clk-imx-lpcg-scu.o
-clk-imx-scu-$(CONFIG_CLK_IMX8QXP) += clk-scu.o clk-imx8qxp.o
-clk-imx-lpcg-scu-$(CONFIG_CLK_IMX8QXP) += clk-lpcg-scu.o clk-imx8qxp-lpcg.o
+obj-$(CONFIG_MXC_CLK_SCU)	+= clk-imx-scu.o
+clk-imx-scu-y			:= clk-scu.o clk-lpcg-scu.o
+obj-$(CONFIG_CLK_IMX8QXP)	+= clk-imx8qxp.o clk-imx8qxp-lpcg.o
 
 obj-$(CONFIG_CLK_IMX1)   += clk-imx1.o
 obj-$(CONFIG_CLK_IMX25)  += clk-imx25.o
diff --git a/drivers/clk/imx/clk-lpcg-scu.c b/drivers/clk/imx/clk-lpcg-scu.c
index 1f0e44f921aee..336dce43da82d 100644
--- a/drivers/clk/imx/clk-lpcg-scu.c
+++ b/drivers/clk/imx/clk-lpcg-scu.c
@@ -115,3 +115,4 @@ struct clk_hw *imx_clk_lpcg_scu(const char *name, const char *parent_name,
 
 	return hw;
 }
+EXPORT_SYMBOL_GPL(imx_clk_lpcg_scu);
diff --git a/drivers/clk/imx/clk-scu.c b/drivers/clk/imx/clk-scu.c
index b8b2072742a56..026a33606ae53 100644
--- a/drivers/clk/imx/clk-scu.c
+++ b/drivers/clk/imx/clk-scu.c
@@ -9,6 +9,7 @@
 #include <linux/clk-provider.h>
 #include <linux/err.h>
 #include <linux/slab.h>
+#include <linux/module.h>
 
 #include "clk-scu.h"
 
@@ -132,6 +133,7 @@ int imx_clk_scu_init(void)
 {
 	return imx_scu_get_handle(&ccm_ipc_handle);
 }
+EXPORT_SYMBOL_GPL(imx_clk_scu_init);
 
 /*
  * clk_scu_recalc_rate - Get clock rate for a SCU clock
@@ -387,3 +389,5 @@ struct clk_hw *__imx_clk_scu(const char *name, const char * const *parents,
 
 	return hw;
 }
+EXPORT_SYMBOL_GPL(__imx_clk_scu);
+MODULE_LICENSE("GPL");
-- 
2.29.2




More information about the linux-arm-kernel mailing list