linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] remaining watchdog dependency fixes
@ 2017-03-01  9:15 Arnd Bergmann
  2017-03-01  9:15 ` [PATCH 1/3] watchdog: kempld: fix gcc-4.3 build Arnd Bergmann
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Arnd Bergmann @ 2017-03-01  9:15 UTC (permalink / raw)
  To: Guenter Roeck; +Cc: Wim Van Sebroeck, linux-watchdog, Lee Jones, linux-kernel

I've updated the db8500 and retu patches as requested, and
found one more patch in my backlog that we should just apply
as well.

	Arnd

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/3] watchdog: kempld: fix gcc-4.3 build
  2017-03-01  9:15 [PATCH 0/3] remaining watchdog dependency fixes Arnd Bergmann
@ 2017-03-01  9:15 ` Arnd Bergmann
  2017-03-01 14:13   ` Guenter Roeck
  2017-03-01  9:15 ` [PATCH 2/3] watchdog: db8500: add back prmcu dependency Arnd Bergmann
  2017-03-01  9:15 ` [PATCH 3/3] watchdog: retu: restore MFD dependency Arnd Bergmann
  2 siblings, 1 reply; 7+ messages in thread
From: Arnd Bergmann @ 2017-03-01  9:15 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: Wim Van Sebroeck, linux-watchdog, Lee Jones, linux-kernel, Arnd Bergmann

gcc-4.3 can't decide whether the constant value in
kempld_prescaler[PRESCALER_21] is built-time constant or
not, and gets confused by the logic in do_div():

drivers/watchdog/kempld_wdt.o: In function `kempld_wdt_set_stage_timeout':
kempld_wdt.c:(.text.kempld_wdt_set_stage_timeout+0x130): undefined reference to `__aeabi_uldivmod'

This adds a call to ACCESS_ONCE() to force it to not consider
it to be constant, and leaves the more efficient normal case
in place for modern compilers, using an #ifdef to annotate
why we do this hack.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/watchdog/kempld_wdt.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/watchdog/kempld_wdt.c b/drivers/watchdog/kempld_wdt.c
index 73c46b3a09ab..2f3b049ea301 100644
--- a/drivers/watchdog/kempld_wdt.c
+++ b/drivers/watchdog/kempld_wdt.c
@@ -140,12 +140,19 @@ static int kempld_wdt_set_stage_timeout(struct kempld_wdt_data *wdt_data,
 					unsigned int timeout)
 {
 	struct kempld_device_data *pld = wdt_data->pld;
-	u32 prescaler = kempld_prescaler[PRESCALER_21];
+	u32 prescaler;
 	u64 stage_timeout64;
 	u32 stage_timeout;
 	u32 remainder;
 	u8 stage_cfg;
 
+#if GCC_VERSION < 40400
+	/* work around a bug compiling do_div() */
+	prescaler = READ_ONCE(kempld_prescaler[PRESCALER_21]);
+#else
+	prescaler = kempld_prescaler[PRESCALER_21];
+#endif
+
 	if (!stage)
 		return -EINVAL;
 
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/3] watchdog: db8500: add back prmcu dependency
  2017-03-01  9:15 [PATCH 0/3] remaining watchdog dependency fixes Arnd Bergmann
  2017-03-01  9:15 ` [PATCH 1/3] watchdog: kempld: fix gcc-4.3 build Arnd Bergmann
@ 2017-03-01  9:15 ` Arnd Bergmann
  2017-03-01 14:13   ` Guenter Roeck
  2017-03-01  9:15 ` [PATCH 3/3] watchdog: retu: restore MFD dependency Arnd Bergmann
  2 siblings, 1 reply; 7+ messages in thread
From: Arnd Bergmann @ 2017-03-01  9:15 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: Wim Van Sebroeck, linux-watchdog, Lee Jones, linux-kernel, Arnd Bergmann

When the db8500 watchdog is enabled without the PRCMU, we get a lot of
warnings about duplicate or missing helper functions:

In file included from drivers/watchdog/ux500_wdt.c:21:0:
include/linux/mfd/dbx500-prcmu.h:422:19: error: redefinition of 'prcmu_abb_read'
 static inline int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size)

This restores the dependency as it was.

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 47dbacf3bfb4..a199e8536ce4 100644
--- a/drivers/watchdog/Kconfig
+++ b/drivers/watchdog/Kconfig
@@ -574,7 +574,7 @@ config IMX2_WDT
 
 config UX500_WATCHDOG
 	tristate "ST-Ericsson Ux500 watchdog"
-	depends on MFD_DB8500_PRCMU || (ARM && COMPILE_TEST)
+	depends on MFD_DB8500_PRCMU
 	select WATCHDOG_CORE
 	default y
 	help
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/3] watchdog: retu: restore MFD dependency
  2017-03-01  9:15 [PATCH 0/3] remaining watchdog dependency fixes Arnd Bergmann
  2017-03-01  9:15 ` [PATCH 1/3] watchdog: kempld: fix gcc-4.3 build Arnd Bergmann
  2017-03-01  9:15 ` [PATCH 2/3] watchdog: db8500: add back prmcu dependency Arnd Bergmann
@ 2017-03-01  9:15 ` Arnd Bergmann
  2017-03-01 14:13   ` Guenter Roeck
  2 siblings, 1 reply; 7+ messages in thread
From: Arnd Bergmann @ 2017-03-01  9:15 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: Wim Van Sebroeck, linux-watchdog, Lee Jones, linux-kernel, Arnd Bergmann

The retu watchdog calls into the respective mfd driver, but fails to
link if that is diabled:

drivers/watchdog/built-in.o: In function `retu_wdt_set_timeout':
ziirave_wdt.c:(.text+0x8c88): undefined reference to `retu_write'
ziirave_wdt.c:(.text+0x8c88): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `retu_write'
drivers/watchdog/built-in.o: In function `retu_wdt_start':
ziirave_wdt.c:(.text+0x8cc8): undefined reference to `retu_write'
ziirave_wdt.c:(.text+0x8cc8): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `retu_write'

This restores the dependency as it was before

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 a199e8536ce4..52a70ee6014f 100644
--- a/drivers/watchdog/Kconfig
+++ b/drivers/watchdog/Kconfig
@@ -586,7 +586,7 @@ config UX500_WATCHDOG
 
 config RETU_WATCHDOG
 	tristate "Retu watchdog"
-	depends on MFD_RETU || COMPILE_TEST
+	depends on MFD_RETU
 	select WATCHDOG_CORE
 	help
 	  Retu watchdog driver for Nokia Internet Tablets (770, N800,
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/3] watchdog: kempld: fix gcc-4.3 build
  2017-03-01  9:15 ` [PATCH 1/3] watchdog: kempld: fix gcc-4.3 build Arnd Bergmann
@ 2017-03-01 14:13   ` Guenter Roeck
  0 siblings, 0 replies; 7+ messages in thread
From: Guenter Roeck @ 2017-03-01 14:13 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: Wim Van Sebroeck, linux-watchdog, Lee Jones, linux-kernel

On 03/01/2017 01:15 AM, Arnd Bergmann wrote:
> gcc-4.3 can't decide whether the constant value in
> kempld_prescaler[PRESCALER_21] is built-time constant or
> not, and gets confused by the logic in do_div():
>
> drivers/watchdog/kempld_wdt.o: In function `kempld_wdt_set_stage_timeout':
> kempld_wdt.c:(.text.kempld_wdt_set_stage_timeout+0x130): undefined reference to `__aeabi_uldivmod'
>
> This adds a call to ACCESS_ONCE() to force it to not consider
> it to be constant, and leaves the more efficient normal case
> in place for modern compilers, using an #ifdef to annotate
> why we do this hack.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Reviewed-by: Guenter Roeck <linux@roeck-us.net>

> ---
>  drivers/watchdog/kempld_wdt.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/watchdog/kempld_wdt.c b/drivers/watchdog/kempld_wdt.c
> index 73c46b3a09ab..2f3b049ea301 100644
> --- a/drivers/watchdog/kempld_wdt.c
> +++ b/drivers/watchdog/kempld_wdt.c
> @@ -140,12 +140,19 @@ static int kempld_wdt_set_stage_timeout(struct kempld_wdt_data *wdt_data,
>  					unsigned int timeout)
>  {
>  	struct kempld_device_data *pld = wdt_data->pld;
> -	u32 prescaler = kempld_prescaler[PRESCALER_21];
> +	u32 prescaler;
>  	u64 stage_timeout64;
>  	u32 stage_timeout;
>  	u32 remainder;
>  	u8 stage_cfg;
>
> +#if GCC_VERSION < 40400
> +	/* work around a bug compiling do_div() */
> +	prescaler = READ_ONCE(kempld_prescaler[PRESCALER_21]);
> +#else
> +	prescaler = kempld_prescaler[PRESCALER_21];
> +#endif
> +
>  	if (!stage)
>  		return -EINVAL;
>
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/3] watchdog: db8500: add back prmcu dependency
  2017-03-01  9:15 ` [PATCH 2/3] watchdog: db8500: add back prmcu dependency Arnd Bergmann
@ 2017-03-01 14:13   ` Guenter Roeck
  0 siblings, 0 replies; 7+ messages in thread
From: Guenter Roeck @ 2017-03-01 14:13 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: Wim Van Sebroeck, linux-watchdog, Lee Jones, linux-kernel

On 03/01/2017 01:15 AM, Arnd Bergmann wrote:
> When the db8500 watchdog is enabled without the PRCMU, we get a lot of
> warnings about duplicate or missing helper functions:
>
> In file included from drivers/watchdog/ux500_wdt.c:21:0:
> include/linux/mfd/dbx500-prcmu.h:422:19: error: redefinition of 'prcmu_abb_read'
>  static inline int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size)
>
> This restores the dependency as it was.
>
> 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 47dbacf3bfb4..a199e8536ce4 100644
> --- a/drivers/watchdog/Kconfig
> +++ b/drivers/watchdog/Kconfig
> @@ -574,7 +574,7 @@ config IMX2_WDT
>
>  config UX500_WATCHDOG
>  	tristate "ST-Ericsson Ux500 watchdog"
> -	depends on MFD_DB8500_PRCMU || (ARM && COMPILE_TEST)
> +	depends on MFD_DB8500_PRCMU
>  	select WATCHDOG_CORE
>  	default y
>  	help
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 3/3] watchdog: retu: restore MFD dependency
  2017-03-01  9:15 ` [PATCH 3/3] watchdog: retu: restore MFD dependency Arnd Bergmann
@ 2017-03-01 14:13   ` Guenter Roeck
  0 siblings, 0 replies; 7+ messages in thread
From: Guenter Roeck @ 2017-03-01 14:13 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: Wim Van Sebroeck, linux-watchdog, Lee Jones, linux-kernel

On 03/01/2017 01:15 AM, Arnd Bergmann wrote:
> The retu watchdog calls into the respective mfd driver, but fails to
> link if that is diabled:
>
> drivers/watchdog/built-in.o: In function `retu_wdt_set_timeout':
> ziirave_wdt.c:(.text+0x8c88): undefined reference to `retu_write'
> ziirave_wdt.c:(.text+0x8c88): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `retu_write'
> drivers/watchdog/built-in.o: In function `retu_wdt_start':
> ziirave_wdt.c:(.text+0x8cc8): undefined reference to `retu_write'
> ziirave_wdt.c:(.text+0x8cc8): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `retu_write'
>
> This restores the dependency as it was before
>
> 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 a199e8536ce4..52a70ee6014f 100644
> --- a/drivers/watchdog/Kconfig
> +++ b/drivers/watchdog/Kconfig
> @@ -586,7 +586,7 @@ config UX500_WATCHDOG
>
>  config RETU_WATCHDOG
>  	tristate "Retu watchdog"
> -	depends on MFD_RETU || COMPILE_TEST
> +	depends on MFD_RETU
>  	select WATCHDOG_CORE
>  	help
>  	  Retu watchdog driver for Nokia Internet Tablets (770, N800,
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-03-01 14:14 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-01  9:15 [PATCH 0/3] remaining watchdog dependency fixes Arnd Bergmann
2017-03-01  9:15 ` [PATCH 1/3] watchdog: kempld: fix gcc-4.3 build Arnd Bergmann
2017-03-01 14:13   ` Guenter Roeck
2017-03-01  9:15 ` [PATCH 2/3] watchdog: db8500: add back prmcu dependency Arnd Bergmann
2017-03-01 14:13   ` Guenter Roeck
2017-03-01  9:15 ` [PATCH 3/3] watchdog: retu: restore MFD dependency Arnd Bergmann
2017-03-01 14:13   ` 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).