watchdog: fix watchdog_pretimeout.c build error when no default gov. is set
PATCH 1/1 watchdog: fix watchdog_pretimeout.c build error when no default gov. is set
From: Randy Dunlap <[email protected]>
Fix build error when CONFIG_WATCHDOG_PRETIMEOUT_GOV=y
# CONFIG_WATCHDOG_PRETIMEOUT_GOV_NOOP is not set # CONFIG_WATCHDOG_PRETIMEOUT_GOV_PANIC is not set
Fixes this build error:
../drivers/watchdog/watchdog_pretimeout.c: In function ‘watchdog_register_governor’:../drivers/watchdog/watchdog_pretimeout.c:139:26: error: ‘WATCHDOG_PRETIMEOUT_DEFAULT_GOV’ undeclared (first use in this function)
if (!strncmp(gov->name, WATCHDOG_PRETIMEOUT_DEFAULT_GOV,
---
Found in linux-next but applies to mainline.
drivers/watchdog/watchdog_pretimeout.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/watchdog/watchdog_pretimeout.c +4 -1
@@ -118,7 +118,6 @@ EXPORT_SYMBOL_GPL(watchdog_notify_pretimint watchdog_register_governor (struct watchdog_governor *gov) { -struct watchdog_pretimeout *p;struct governor_priv *priv; priv =kzalloc (sizeof (*priv),GFP_KERNEL );
@@ -136,8 +135,11 @@ int watchdog_register_governor(struct wa priv->gov = gov;list_add (&priv->entry, &governor_list); +#if defined(WATCHDOG_PRETIMEOUT_DEFAULT_GOV )if (!strncmp (gov->name,WATCHDOG_PRETIMEOUT_DEFAULT_GOV ,WATCHDOG_GOV_NAME_MAXLEN )) { +struct watchdog_pretimeout *p; +spin_lock_irq (&pretimeout_lock); default_gov = gov;
@@ -146,6 +148,7 @@ int watchdog_register_governor(struct wa p->wdd->gov = default_gov; spin_unlock_irq(&pretimeout_lock); } +#endif mutex_unlock (&governor_lock);
Guenter Roeck
maintainerQuoted 7 lines · Randy Dunlap
From: Randy Dunlap <[email protected]>
Fix build error when
CONFIG_WATCHDOG_PRETIMEOUT_GOV=y
#CONFIG_WATCHDOG_PRETIMEOUT_GOV_NOOPis not set
#CONFIG_WATCHDOG_PRETIMEOUT_GOV_PANICis not set
Quoted 6 lines
Fixes this build error:
../drivers/watchdog/watchdog_pretimeout.c: In function ‘watchdog_register_governor’:../drivers/watchdog/watchdog_pretimeout.c:139:26: error: ‘WATCHDOG_PRETIMEOUT_DEFAULT_GOV’ undeclared (first use in this function)
if (!strncmp(gov->name,WATCHDOG_PRETIMEOUT_DEFAULT_GOV,
Ah, I knew I missed something. The following would be a better fix, though, since it enforces that at least one pretimeout governor is enabled (matching the old code):
drivers/watchdog/Kconfig +6 -0
@@ -71,6 +71,12 @@ config WATCHDOG_PRETIMEOUT_GOV help The option allows to select watchdog pretimeout governors. +config WATCHDOG_PRETIMEOUT_GOV_SEL + tristate + depends on WATCHDOG_PRETIMEOUT_GOV + default m + select WATCHDOG_PRETIMEOUT_GOV_PANIC if WATCHDOG_PRETIMEOUT_GOV_NOOP=n + if WATCHDOG_PRETIMEOUT_GOV
Can you send v2 with the above, or do you want me to send it and give you credit ?
Thanks,
Guenter
Quoted 35 lines · Guenter Roeck
Quoted 7 lines · Randy Dunlap
From: Randy Dunlap <[email protected]>
Fix build error when
CONFIG_WATCHDOG_PRETIMEOUT_GOV=y
#CONFIG_WATCHDOG_PRETIMEOUT_GOV_NOOPis not set
#CONFIG_WATCHDOG_PRETIMEOUT_GOV_PANICis not setQuoted 6 lines
Fixes this build error:
../drivers/watchdog/watchdog_pretimeout.c: In function ‘watchdog_register_governor’:../drivers/watchdog/watchdog_pretimeout.c:139:26: error: ‘WATCHDOG_PRETIMEOUT_DEFAULT_GOV’ undeclared (first use in this function) if (!strncmp(gov->name,WATCHDOG_PRETIMEOUT_DEFAULT_GOV,Ah, I knew I missed something. The following would be a better fix, though, since it enforces that at least one pretimeout governor is enabled (matching the old code):
drivers/watchdog/Kconfig +0
-0@@ -71,6 +71,12 @@ config WATCHDOG_PRETIMEOUT_GOVhelp
The option allows to select watchdog pretimeout governors.drivers/watchdog/Kconfig +6
-0+config WATCHDOG_PRETIMEOUT_GOV_SEL + tristate + depends on WATCHDOG_PRETIMEOUT_GOV + default m + select WATCHDOG_PRETIMEOUT_GOV_PANIC if WATCHDOG_PRETIMEOUT_GOV_NOOP=n +if
WATCHDOG_PRETIMEOUT_GOV
Quoted 4 lines
Can you send v2 with the above, or do you want me to send it and give you credit ?
Thanks,
Guenter
Hi Guenter,
That's your patch. You can send it. :)
No credit needed.
cheers.
Signature · 1 line
~Randy