clk/sunxi/media: Fix builds with COMMON_CLK and HAVE_LEGACY_CLK
Subsystems (10)
cover clk/sunxi/media: Fix builds with COMMON_CLK and HAVE_LEGACY_CLK
Hi,
Multiple configurations create unbuildable config by selecting COMMON_CLK and HAVE_LEGACY_CLK. The first simply should not be selected.
The patches 2/3 and 3/3 address this specific problem. I performed few compile tests and I am still building other configurations, therefore they were marked as RFC.
Best regards,
Krzysztof
Krzysztof Kozlowski (3):
clk: fix redefinition of clk_prepare on MIPS with HAVE_LEGACY_CLK
ARM: sunxi: do not select COMMON_CLK to fix builds
media: atomisp: do not select COMMON_CLK to fix builds
arch/arm/mach-sunxi/Kconfig | 1 + drivers/clk/clk.c | 4 ++++ drivers/staging/media/atomisp/Kconfig | 2 +- sound/soc/sunxi/Kconfig | 2 +- 4 files changed, 7 insertions(+), 2 deletions(-)
Signature · 7 lines
2.25.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 1/3 clk: fix redefinition of clk_prepare on MIPS with HAVE_LEGACY_CLK
COMMON_CLK even though is a user-selectable symbol, is still selected by multiple other config options. COMMON_CLK should not be used when legacy clocks are provided by architecture, so it correctly depends on !HAVE_LEGACY_CLK.
However it is possible to create a config which selects both COMMON_CLK (by SND_SUN8I_CODEC) and HAVE_LEGACY_CLK (by SOC_RT305X) which leads to compile errors (MIPS architecture):
drivers/clk/clk.c:855:6: error: redefinition of ‘clk_unprepare’
In file included from drivers/clk/clk.c:9:
include/linux/clk.h:263:20: note: previous definition of ‘clk_unprepare’ was here
The definitions clk_bulk_prepare() (and unprepare) already have proper surrounding #ifdef so add them also for clk_prepare()/clk_unprepare().
--- drivers/clk/clk.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/clk/clk.c +4 -0
@@ -841,6 +841,7 @@ static void clk_core_unprepare_lock(struct clk_core *core)clk_prepare_unlock (); } +#ifdef CONFIG_HAVE_CLK_PREPARE /** * clk_unprepare - undo preparation of a clock source * @clk: the clk being unprepared
@@ -860,6 +861,7 @@ void clk_unprepare(struct clk *clk) clk_core_unprepare_lock(clk->core); }EXPORT_SYMBOL_GPL (clk_unprepare); +#endif static int clk_core_prepare (struct clk_core *core) {
@@ -921,6 +923,7 @@ static int clk_core_prepare_lock(struct clk_core *core)return ret; } +#ifdef CONFIG_HAVE_CLK_PREPARE /** * clk_prepare - prepare a clock source * @clk: the clk being prepared
@@ -941,6 +944,7 @@ int clk_prepare(struct clk *clk) return clk_core_prepare_lock(clk->core); }EXPORT_SYMBOL_GPL (clk_prepare); +#endif /* CONFIG_HAVE_CLK_PREPARE */ static void clk_core_disable (struct clk_core *core) {
Signature · 7 lines
2.25.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Stephen Boyd
maintainerRe: [PATCH 1/3] clk: fix redefinition of clk_prepare on MIPS with HAVE_LEGACY_CLK
Quoting Krzysztof Kozlowski (2020-11-15 09:09:48)
Quoted 7 lines
COMMON_CLKeven though is a user-selectable symbol, is still selected by multiple other config options.COMMON_CLKshould not be used when legacy clocks are provided by architecture, so it correctly depends on !HAVE_LEGACY_CLK.However it is possible to create a config which selects both
COMMON_CLK(bySND_SUN8I_CODEC) andHAVE_LEGACY_CLK(bySOC_RT305X) which leads to
Why is SND_SUN8I_CODEC selecting COMMON_CLK? Or really, why is SOC_RT305X selecting HAVE_LEGACY_CLK?
Re: [PATCH 1/3] clk: fix redefinition of clk_prepare on MIPS with HAVE_LEGACY_CLK
Quoted 11 lines · Stephen Boyd
Quoting Krzysztof Kozlowski (2020-11-15 09:09:48)
Quoted 7 lines
COMMON_CLKeven though is a user-selectable symbol, is still selected by multiple other config options.COMMON_CLKshould not be used when legacy clocks are provided by architecture, so it correctly depends on !HAVE_LEGACY_CLK.However it is possible to create a config which selects both
COMMON_CLK(bySND_SUN8I_CODEC) andHAVE_LEGACY_CLK(bySOC_RT305X) which leads toWhy is
SND_SUN8I_CODECselectingCOMMON_CLK? Or really, why isSOC_RT305XselectingHAVE_LEGACY_CLK?
The SND_SUN8I_CODEC I fixed in following patch (I sent separately v2 of it).
The SOC_RT305X select HAVE_LEGACY_CLK? because it is an old, Ralink platform, not converted to Common clock frm. Few clock operations are defined in: arch/mips/ralink/clk.c
Best regards,
Krzysztof
Stephen Boyd
maintainerRe: [PATCH 1/3] clk: fix redefinition of clk_prepare on MIPS with HAVE_LEGACY_CLK
Quoting Krzysztof Kozlowski (2020-11-17 23:48:12)
Quoted 13 lines · Stephen Boyd
Quoted 11 lines
Quoting Krzysztof Kozlowski (2020-11-15 09:09:48)
Quoted 7 lines
COMMON_CLKeven though is a user-selectable symbol, is still selected by multiple other config options.COMMON_CLKshould not be used when legacy clocks are provided by architecture, so it correctly depends on !HAVE_LEGACY_CLK.However it is possible to create a config which selects both
COMMON_CLK(bySND_SUN8I_CODEC) andHAVE_LEGACY_CLK(bySOC_RT305X) which leads toWhy is
SND_SUN8I_CODECselectingCOMMON_CLK? Or really, why isSOC_RT305XselectingHAVE_LEGACY_CLK?
Quoted 7 lines
The
SND_SUN8I_CODECI fixed in following patch (I sent separately v2 of it).The
SOC_RT305XselectHAVE_LEGACY_CLK? because it is an old, Ralink platform, not converted to Common clock frm. Few clock operations are defined in:arch/mips/ralink/clk.c
Ok so this patch isn't necessary then? It seems OK to select HAVE_LEGACY_CLK but not to select COMMON_CLK unless it's architecture code that can't be enabled when the other architecture code is selecting HAVE_LEGACY_CLK.
Re: [PATCH 1/3] clk: fix redefinition of clk_prepare on MIPS with HAVE_LEGACY_CLK
Quoted 17 lines · Stephen Boyd
Quoting Krzysztof Kozlowski (2020-11-17 23:48:12)
Quoted 16 lines · Stephen Boyd
Quoted 11 lines
Quoting Krzysztof Kozlowski (2020-11-15 09:09:48)
Quoted 7 lines
COMMON_CLKeven though is a user-selectable symbol, is still selected by multiple other config options.COMMON_CLKshould not be used when legacy clocks are provided by architecture, so it correctly depends on !HAVE_LEGACY_CLK.However it is possible to create a config which selects both
COMMON_CLK(bySND_SUN8I_CODEC) andHAVE_LEGACY_CLK(bySOC_RT305X) which leads toWhy is
SND_SUN8I_CODECselectingCOMMON_CLK? Or really, why isSOC_RT305XselectingHAVE_LEGACY_CLK?The
SND_SUN8I_CODECI fixed in following patch (I sent separately v2 of it).
Quoted 6 lines
Quoted 4 lines
The
SOC_RT305XselectHAVE_LEGACY_CLK? because it is an old, Ralink platform, not converted to Common clock frm. Few clock operations are defined in:arch/mips/ralink/clk.cOk so this patch isn't necessary then?
For this particular build failure - it is not necessary anymore.
However there might more of such errors - just not discovered yet. Also, the clock bulk API has such ifdefs so it kind of symmetrical and consistent approach.
Quoted 4 lines
It seems OK to select
HAVE_LEGACY_CLKbut not to selectCOMMON_CLKunless it's architecture code that can't be enabled when the other architecture code is selectingHAVE_LEGACY_CLK.
Best regards,
Krzysztof
Stephen Boyd
maintainerRe: [PATCH 1/3] clk: fix redefinition of clk_prepare on MIPS with HAVE_LEGACY_CLK
Quoting Krzysztof Kozlowski (2020-11-25 06:15:05)
Quoted 10 lines · Stephen Boyd
Quoted 2 lines
Ok so this patch isn't necessary then?
For this particular build failure - it is not necessary anymore.
However there might more of such errors - just not discovered yet. Also, the clock bulk API has such ifdefs so it kind of symmetrical and consistent approach.
Ok. Patches always welcome.
RFC 2/3 ARM: sunxi: do not select COMMON_CLK to fix builds
In reply to Krzysztof KozlowskiCOMMON_CLK is a user-selectable option with its own dependencies. The most important dependency is !HAVE_LEGACY_CLK. User-selectable drivers should not select COMMON_CLK because they will create a dependency cycle and build failures. For example on MIPS a configuration with COMMON_CLK (selected by SND_SUN8I_CODEC) and HAVE_LEGACY_CLK (selected by SOC_RT305X) is possible:
WARNING: unmet direct dependencies detected for COMMON_CLK
Depends on [n]: !HAVE_LEGACY_CLK [=y]
Selected by [y]:
- SND_SUN8I_CODEC [=y] && SOUND [=y] && !UML && SND [=y] && SND_SOC [=y] &&
(ARCH_SUNXI || COMPILE_TEST [=y]) && OF [=y] && (MACH_SUN8I || ARM64 && ARCH_SUNXI || COMPILE_TEST [=y])
/usr/bin/mips-linux-gnu-ld: drivers/clk/clk.o: in function `clk_set_rate':
(.text+0xaeb4): multiple definition of `clk_set_rate'; arch/mips/ralink/clk.o:(.text+0x88): first defined here
--- arch/arm/mach-sunxi/Kconfig | 1 + sound/soc/sunxi/Kconfig | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-)
arch/arm/mach-sunxi/Kconfig +1 -0
@@ -4,6 +4,7 @@ menuconfig ARCH_SUNXI depends on ARCH_MULTI_V5 || ARCH_MULTI_V7 select ARCH_HAS_RESET_CONTROLLER select CLKSRC_MMIO + select COMMON_CLK select GENERIC_IRQ_CHIP select GPIOLIB select PINCTRL
sound/soc/sunxi/Kconfig +1 -1
@@ -14,7 +14,7 @@ config SND_SUN8I_CODEC tristate "Allwinner SUN8I audio codec" depends on OF depends on MACH_SUN8I || (ARM64 && ARCH_SUNXI) || COMPILE_TEST - select COMMON_CLK + depends on COMMON_CLK select REGMAP_MMIO help This option enables the digital part of the internal audio codec for
Signature · 7 lines
2.25.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Re: [RFC 2/3] ARM: sunxi: do not select COMMON_CLK to fix builds
Quoted 6 lines · Krzysztof Kozlowski
COMMON_CLKis a user-selectable option with its own dependencies. The most important dependency is !HAVE_LEGACY_CLK. User-selectable drivers should not selectCOMMON_CLKbecause they will create a dependency cycle and build failures. For example on MIPS a configuration withCOMMON_CLK(selected bySND_SUN8I_CODEC) andHAVE_LEGACY_CLK(selected bySOC_RT305X) is possible:
Ah, that makes sense.
Quoted 21 lines
WARNING: unmet direct dependencies detected for
COMMON_CLK
Depends on [n]: !HAVE_LEGACY_CLK [=y]
Selected by [y]:
-SND_SUN8I_CODEC[=y] && SOUND [=y] && !UML && SND [=y] &&SND_SOC[=y] &&
(ARCH_SUNXI||COMPILE_TEST[=y]) && OF [=y] && (MACH_SUN8I|| ARM64 &&ARCH_SUNXI||COMPILE_TEST[=y])
/usr/bin/mips-linux-gnu-ld:drivers/clk/clk.o: in function `clk_set_rate':
(.text+0xaeb4): multiple definition of `clk_set_rate'; arch/mips/ralink/clk.o:(.text+0x88): first defined hereSigned-off-by Krzysztof Kozlowski <[email protected]>--- arch/arm/mach-sunxi/Kconfig | 1 + sound/soc/sunxi/Kconfig | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-)arch/arm/mach-sunxi/Kconfig +0
-0
arch/arm/mach-sunxi/Kconfig menuconfig ARCH_SUNXI · line 7
Quoted 4 lines
arch/arm/mach-sunxi/Kconfig +1
-0@@ -4,6 +4,7 @@ menuconfig ARCH_SUNXI depends on ARCH_MULTI_V5 || ARCH_MULTI_V7 select ARCH_HAS_RESET_CONTROLLER select CLKSRC_MMIO + select COMMON_CLK
This is not necessary, since ARCH_SUNXI depends (through ARCH_MULTI_V{5,7}) on ARCH_MULTIPLATFORM, which selects COMMON_CLK already.
Quoted 9 lines
arch/arm/mach-sunxi/Kconfig +0
-0select GENERIC_IRQ_CHIP select GPIOLIB select PINCTRLsound/soc/sunxi/Kconfig +0
-0
sound/soc/sunxi/Kconfig config SND_SUN8I_CODEC · line 20
Quoted 8 lines
sound/soc/sunxi/Kconfig +1
-1@@ -14,7 +14,7 @@ config SND_SUN8I_CODEC tristate "Allwinner SUN8I audio codec" depends on OF depends on MACH_SUN8I || (ARM64 && ARCH_SUNXI) || COMPILE_TEST - select COMMON_CLK + depends on COMMON_CLK select REGMAP_MMIO help This option enables the digital part of the internal audio codec for
For this file:
Thanks,
Samuel
Re: [RFC 2/3] ARM: sunxi: do not select COMMON_CLK to fix builds
Quoted 26 lines · Samuel Holland
Quoted 6 lines · Krzysztof Kozlowski
COMMON_CLKis a user-selectable option with its own dependencies. The most important dependency is !HAVE_LEGACY_CLK. User-selectable drivers should not selectCOMMON_CLKbecause they will create a dependency cycle and build failures. For example on MIPS a configuration withCOMMON_CLK(selected bySND_SUN8I_CODEC) andHAVE_LEGACY_CLK(selected bySOC_RT305X) is possible:Ah, that makes sense.
Quoted 16 lines
WARNING: unmet direct dependencies detected for
COMMON_CLK
Depends on [n]: !HAVE_LEGACY_CLK [=y]
Selected by [y]:
-SND_SUN8I_CODEC[=y] && SOUND [=y] && !UML && SND [=y] &&SND_SOC[=y] &&
(ARCH_SUNXI||COMPILE_TEST[=y]) && OF [=y] && (MACH_SUN8I|| ARM64 &&ARCH_SUNXI||COMPILE_TEST[=y])
/usr/bin/mips-linux-gnu-ld:drivers/clk/clk.o: in function `clk_set_rate':
(.text+0xaeb4): multiple definition of `clk_set_rate'; arch/mips/ralink/clk.o:(.text+0x88): first defined hereSigned-off-by Krzysztof Kozlowski <[email protected]>--- arch/arm/mach-sunxi/Kconfig | 1 + sound/soc/sunxi/Kconfig | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-)
Quoted 12 lines
arch/arm/mach-sunxi/Kconfig menuconfig ARCH_SUNXI · line 7
Quoted 9 lines
arch/arm/mach-sunxi/Kconfig +1
-0@@ -4,6 +4,7 @@ menuconfig ARCH_SUNXI depends on ARCH_MULTI_V5 || ARCH_MULTI_V7 select ARCH_HAS_RESET_CONTROLLER select CLKSRC_MMIO + select COMMON_CLKThis is not necessary, since
ARCH_SUNXIdepends (through ARCH_MULTI_V{5,7}) onARCH_MULTIPLATFORM, which selectsCOMMON_CLKalready.
Thanks. I'll send a v2 with changes and your review.
Best regards,
Krzysztof
RFC 3/3 media: atomisp: do not select COMMON_CLK to fix builds
In reply to Krzysztof KozlowskiCOMMON_CLK is a user-selectable option with its own dependencies. The most important dependency is !HAVE_LEGACY_CLK. User-selectable drivers should not select COMMON_CLK because they will create a dependency cycle and build failures.
--- drivers/staging/media/atomisp/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/atomisp/Kconfig +1 -1
@@ -2,9 +2,9 @@ menuconfig INTEL_ATOMISP bool "Enable support to Intel Atom ISP camera drivers" depends on X86 && EFI && PCI && ACPI + depends on COMMON_CLK select IOSF_MBI select MEDIA_CONTROLLER - select COMMON_CLK help Enable support for the Intel ISP2 camera interfaces and MIPI sensor drivers.
Signature · 7 lines
2.25.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Re: [RFC 3/3] media: atomisp: do not select COMMON_CLK to fix builds
Quoting Krzysztof Kozlowski (2020-11-15 09:09:50)
Quoted 6 lines
COMMON_CLKis a user-selectable option with its own dependencies. The most important dependency is !HAVE_LEGACY_CLK. User-selectable drivers should not selectCOMMON_CLKbecause they will create a dependency cycle and build failures.Signed-off-by Krzysztof Kozlowski <[email protected]>
This is fallout from making the COMMON_CLK symbol selectable in commit bbd7ffdbef68 ("clk: Allow the common clk framework to be selectable"). Before then we needed drivers to select the COMMON_CLK config so that the framework was enabled. Now that isn't necessary and any user-selectable options should be moved to depends syntax.