Skip to contentSkip to conversation

watchdog: coh901327: add COMMON_CLK dependency

PATCH In review Arnd Bergmann 3 participants 4 messages Dec 3, 2020 – Dec 11, 2020 Watchdog device drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 watchdog: coh901327: add COMMON_CLK dependency

From: Arnd Bergmann <[email protected]>

clang produces a build failure in configurations without COMMON_CLK when a timeout calculation goes wrong:

arm-linux-gnueabi-ld: drivers/watchdog/coh901327_wdt.o: in function `coh901327_enable':
coh901327_wdt.c:(.text+0x50): undefined reference to `__bad_udelay'

Add a Kconfig dependency to only do build testing when COMMON_CLK is enabled.

Fixes da2a68b3eb47 ("watchdog: Enable COMPILE_TEST where possible")
---
 drivers/watchdog/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/watchdog/Kconfig +1 -1
index 8bdbd125821b..32fa6de7b820 100644
@@ -631,7 +631,7 @@ config SUNXI_WATCHDOG
 
 config COH901327_WATCHDOG
 	bool "ST-Ericsson COH 901 327 watchdog"
-	depends on ARCH_U300 || (ARM && COMPILE_TEST)
+	depends on ARCH_U300 || (ARM && COMMON_CLK && COMPILE_TEST)
 	default y if MACH_U300
 	select WATCHDOG_CORE
 	help
Signature · 1 line
2.27.0
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

clang produces a build failure in configurations without COMMON_CLK when a timeout calculation goes wrong:

Quoted 8 lines

arm-linux-gnueabi-ld: drivers/watchdog/coh901327_wdt.o: in function `coh901327_enable':
coh901327_wdt.c:(.text+0x50): undefined reference to `__bad_udelay'

Add a Kconfig dependency to only do build testing when COMMON_CLK is enabled.

Fixes da2a68b3eb47 ("watchdog: Enable COMPILE_TEST where possible")
Quoted 20 lines
---
 drivers/watchdog/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/watchdog/Kconfig +1 -1
index 8bdbd125821b..32fa6de7b820 100644
@@ -631,7 +631,7 @@ config SUNXI_WATCHDOG
 
 config COH901327_WATCHDOG
 	bool "ST-Ericsson COH 901 327 watchdog"
-	depends on ARCH_U300 || (ARM && COMPILE_TEST)
+	depends on ARCH_U300 || (ARM && COMMON_CLK && COMPILE_TEST)
 	default y if MACH_U300
 	select WATCHDOG_CORE
 	help
Signature · 1 line
2.27.0
#2 lore raw
In reply to Arnd Bergmann
Quoted 8 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

clang produces a build failure in configurations without COMMON_CLK when a timeout calculation goes wrong:

arm-linux-gnueabi-ld: drivers/watchdog/coh901327_wdt.o: in function `coh901327_enable':
coh901327_wdt.c:(.text+0x50): undefined reference to `__bad_udelay'

Isn't a linkage failure against __bad_udelay supposed to be interpreted as a value too large being passed to udelay()? IIRC, this was an issue for someone building an Apple touchpad driver with Clang at -O3...you sent a fix for that:
https://github.com/ClangBuiltLinux/linux/issues/678,
https://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git/commit/?id=fff2d0f701e6753591609739f8ab9be1c8e80ebb.

Quoted 26 lines

Add a Kconfig dependency to only do build testing when COMMON_CLK is enabled.

Fixes da2a68b3eb47 ("watchdog: Enable COMPILE_TEST where possible")
---
 drivers/watchdog/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/watchdog/Kconfig +1 -2
index 8bdbd125821b..32fa6de7b820 100644
@@ -631,7 +631,7 @@ config SUNXI_WATCHDOG
 
 config COH901327_WATCHDOG
        bool "ST-Ericsson COH 901 327 watchdog"
-       depends on ARCH_U300 || (ARM && COMPILE_TEST)
+       depends on ARCH_U300 || (ARM && COMMON_CLK && COMPILE_TEST)
        default y if MACH_U300
        select WATCHDOG_CORE
        help
--

2.27.0

Signature · 2 lines
Thanks,
~Nick Desaulniers
maintainer
#3 lore raw
Quoted 10 lines · Nick Desaulniers
Quoted 8 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

clang produces a build failure in configurations without COMMON_CLK when a timeout calculation goes wrong:

arm-linux-gnueabi-ld: drivers/watchdog/coh901327_wdt.o: in function `coh901327_enable':
coh901327_wdt.c:(.text+0x50): undefined reference to `__bad_udelay'

Quoted 6 lines

Isn't a linkage failure against __bad_udelay supposed to be interpreted as a value too large being passed to udelay()? IIRC, this was an issue for someone building an Apple touchpad driver with Clang at -O3...you sent a fix for that:
https://github.com/ClangBuiltLinux/linux/issues/678,
https://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git/commit/?id=fff2d0f701e6753591609739f8ab9be1c8e80ebb.

The problem is likely that clk_get_rate() returns a constant 0, which in the real world would end up in a divide by 0 crash. An alternative might be be to add

	freq = clk_get_rate(clk);

--> if (freq == 0)
--> return;

but I don't know if that would really be worth the effort. I prefer the current fix.

Guenter

Quoted 32 lines
Quoted 27 lines

Add a Kconfig dependency to only do build testing when COMMON_CLK is enabled.

Fixes da2a68b3eb47 ("watchdog: Enable COMPILE_TEST where possible")
---
 drivers/watchdog/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/watchdog/Kconfig +1 -2
index 8bdbd125821b..32fa6de7b820 100644
@@ -631,7 +631,7 @@ config SUNXI_WATCHDOG
 
 config COH901327_WATCHDOG
        bool "ST-Ericsson COH 901 327 watchdog"
-       depends on ARCH_U300 || (ARM && COMPILE_TEST)
+       depends on ARCH_U300 || (ARM && COMMON_CLK && COMPILE_TEST)
        default y if MACH_U300
        select WATCHDOG_CORE
        help
--

2.27.0

Signature · 2 lines
Thanks,
~Nick Desaulniers