* [PATCH] watchdog: coh901327: add COMMON_CLK dependency
@ 2020-12-03 22:33 Arnd Bergmann
2020-12-04 1:41 ` Guenter Roeck
2020-12-10 23:00 ` Nick Desaulniers
0 siblings, 2 replies; 4+ messages in thread
From: Arnd Bergmann @ 2020-12-03 22:33 UTC (permalink / raw)
To: Wim Van Sebroeck, Guenter Roeck, Nathan Chancellor, Nick Desaulniers
Cc: Arnd Bergmann, linux-watchdog, linux-kernel, clang-built-linux
From: Arnd Bergmann <arnd@arndb.de>
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")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/watchdog/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
index 8bdbd125821b..32fa6de7b820 100644
--- a/drivers/watchdog/Kconfig
+++ b/drivers/watchdog/Kconfig
@@ -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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] watchdog: coh901327: add COMMON_CLK dependency
2020-12-03 22:33 [PATCH] watchdog: coh901327: add COMMON_CLK dependency Arnd Bergmann
@ 2020-12-04 1:41 ` Guenter Roeck
2020-12-10 23:00 ` Nick Desaulniers
1 sibling, 0 replies; 4+ messages in thread
From: Guenter Roeck @ 2020-12-04 1:41 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Wim Van Sebroeck, Nathan Chancellor, Nick Desaulniers,
Arnd Bergmann, linux-watchdog, linux-kernel, clang-built-linux
On Thu, Dec 03, 2020 at 11:33:42PM +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> 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")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
> ---
> drivers/watchdog/Kconfig | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
> index 8bdbd125821b..32fa6de7b820 100644
> --- a/drivers/watchdog/Kconfig
> +++ b/drivers/watchdog/Kconfig
> @@ -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
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] watchdog: coh901327: add COMMON_CLK dependency
2020-12-03 22:33 [PATCH] watchdog: coh901327: add COMMON_CLK dependency Arnd Bergmann
2020-12-04 1:41 ` Guenter Roeck
@ 2020-12-10 23:00 ` Nick Desaulniers
2020-12-11 0:16 ` Guenter Roeck
1 sibling, 1 reply; 4+ messages in thread
From: Nick Desaulniers @ 2020-12-10 23:00 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Wim Van Sebroeck, Guenter Roeck, Nathan Chancellor,
Arnd Bergmann, linux-watchdog, LKML, clang-built-linux
On Thu, Dec 3, 2020 at 2:34 PM Arnd Bergmann <arnd@kernel.org> wrote:
>
> From: Arnd Bergmann <arnd@arndb.de>
>
> 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.
>
> Add a Kconfig dependency to only do build testing when COMMON_CLK
> is enabled.
>
> Fixes: da2a68b3eb47 ("watchdog: Enable COMPILE_TEST where possible")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> drivers/watchdog/Kconfig | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
> index 8bdbd125821b..32fa6de7b820 100644
> --- a/drivers/watchdog/Kconfig
> +++ b/drivers/watchdog/Kconfig
> @@ -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
>
--
Thanks,
~Nick Desaulniers
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] watchdog: coh901327: add COMMON_CLK dependency
2020-12-10 23:00 ` Nick Desaulniers
@ 2020-12-11 0:16 ` Guenter Roeck
0 siblings, 0 replies; 4+ messages in thread
From: Guenter Roeck @ 2020-12-11 0:16 UTC (permalink / raw)
To: Nick Desaulniers
Cc: Arnd Bergmann, Wim Van Sebroeck, Nathan Chancellor,
Arnd Bergmann, linux-watchdog, LKML, clang-built-linux
On Thu, Dec 10, 2020 at 03:00:30PM -0800, Nick Desaulniers wrote:
> On Thu, Dec 3, 2020 at 2:34 PM Arnd Bergmann <arnd@kernel.org> wrote:
> >
> > From: Arnd Bergmann <arnd@arndb.de>
> >
> > 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.
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
>
> >
> > Add a Kconfig dependency to only do build testing when COMMON_CLK
> > is enabled.
> >
> > Fixes: da2a68b3eb47 ("watchdog: Enable COMPILE_TEST where possible")
> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> > ---
> > drivers/watchdog/Kconfig | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
> > index 8bdbd125821b..32fa6de7b820 100644
> > --- a/drivers/watchdog/Kconfig
> > +++ b/drivers/watchdog/Kconfig
> > @@ -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
> >
>
>
> --
> Thanks,
> ~Nick Desaulniers
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-12-11 0:18 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-03 22:33 [PATCH] watchdog: coh901327: add COMMON_CLK dependency Arnd Bergmann
2020-12-04 1:41 ` Guenter Roeck
2020-12-10 23:00 ` Nick Desaulniers
2020-12-11 0:16 ` Guenter Roeck
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).