Skip to contentSkip to conversation

clk: stm32: fix COMPILE_TEST builds

PATCH In review Rosen Penev 2 participants 5 messages Jul 19 – Jul 20

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v2 cover clk: stm32: fix COMPILE_TEST builds

The STM32MP clock drivers have COMPILE_TEST in their Kconfig depends, but they fail to build (and are not even compiled) when ARCH_STM32 is disabled. The first patch adds a missing bitfield.h include so the drivers build standalone, and the second wires up the Makefile gate to the STM32MP clock symbol so the directory is actually traversed under COMPILE_TEST.

v2: split up in two patches.

Rosen Penev (2):
clk: stm32: add missing bitfield.h header
clk: stm32: allow STM32MP COMPILE_TEST builds

 drivers/clk/Makefile              | 2 +-
 drivers/clk/stm32/clk-stm32mp21.c | 1 +
 drivers/clk/stm32/clk-stm32mp25.c | 1 +
 3 files changed, 3 insertions(+), 1 deletion(-)
Signature · 1 line
2.55.0
#1 lore raw

PATCH v2 1/2 clk: stm32: add missing bitfield.h header

It seems some ARM header includes this and the build passes there, but nowhere else. Note that the driver has COMPILE_TEST in depends.

Fixes 37ae8501cdb0 ("clk: stm32: introduce clocks for STM32MP21 platfor")
---
 drivers/clk/stm32/clk-stm32mp21.c | 1 +
 drivers/clk/stm32/clk-stm32mp25.c | 1 +
 2 files changed, 2 insertions(+)
drivers/clk/stm32/clk-stm32mp21.c +1 -0
index c8a37b716bd5..bdb17419908c 100644
@@ -4,6 +4,7 @@
  * Author: Gabriel Fernandez <[email protected]> for STMicroelectronics.
  */
 
+#include <linux/bitfield.h>
 #include <linux/bus/stm32_firewall_device.h>
 #include <linux/clk-provider.h>
 #include <linux/io.h>
drivers/clk/stm32/clk-stm32mp25.c +1 -0
index 52f0e8a12926..eb0bc918ecee 100644
@@ -4,6 +4,7 @@
  * Author: Gabriel Fernandez <[email protected]> for STMicroelectronics.
  */
 
+#include <linux/bitfield.h>
 #include <linux/bus/stm32_firewall_device.h>
 #include <linux/clk-provider.h>
 #include <linux/io.h>
Signature · 1 line
2.55.0
Reviewed-by on v2 1/2
#2 lore raw

Re: [PATCHv2 1/2] clk: stm32: add missing bitfield.h header

Quoted 5 lines · Rosen Penev

It seems some ARM header includes this and the build passes there, but nowhere else. Note that the driver has COMPILE_TEST in depends.

Fixes 37ae8501cdb0 ("clk: stm32: introduce clocks for STM32MP21 platfor")
#3 lore raw

PATCH v2 2/2 clk: stm32: allow STM32MP COMPILE_TEST builds

In reply to Rosen Penev

COMMON_CLK_STM32MP already allows COMPILE_TEST, but the parent clock Makefile only descends into drivers/clk/stm32 for ARCH_STM32. Use the STM32MP clock symbol for that directory gate instead.

Tested with:
make LLVM=1 ARCH=loongarch drivers/clk/stm32/

Assisted-by Codex:GPT-5.5
---
 drivers/clk/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/Makefile +1 -1
index 8383f9f1da51..bbcedf5d60ea 100644
@@ -151,7 +151,7 @@ obj-y					+= spacemit/
 obj-$(CONFIG_PLAT_SPEAR)		+= spear/
 obj-y					+= sprd/
 obj-$(CONFIG_ARCH_STI)			+= st/
-obj-$(CONFIG_ARCH_STM32)		+= stm32/
+obj-$(CONFIG_COMMON_CLK_STM32MP)	+= stm32/
 obj-y					+= starfive/
 obj-$(CONFIG_ARCH_SUNXI)		+= sunxi/
 obj-y					+= sunxi-ng/
Signature · 1 line
2.55.0
Reviewed-by on v2 2/2
#4 lore raw

Re: [PATCHv2 2/2] clk: stm32: allow STM32MP COMPILE_TEST builds

Quoted 9 lines · Rosen Penev

COMMON_CLK_STM32MP already allows COMPILE_TEST, but the parent clock Makefile only descends into drivers/clk/stm32 for ARCH_STM32. Use the STM32MP clock symbol for that directory gate instead.

Tested with:
make LLVM=1 ARCH=loongarch drivers/clk/stm32/

Assisted-by Codex:GPT-5.5