watchdog updates for v4.11-rc1, take 2

Fix fallout from enabling COMPILE_TEST
 Fix gcc-4.3 build of kempld watchdog driver
 Use hrtimer in softdog
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJYttg1AAoJEMsfJm/On5mBBacP/135qH1mSRqqvVJ+BpF13tal
 zkjOyQUJbVk4kLyaXIhBgunu6d+1bcjL/S8ZiQD1+QJmtCXcz8xAaGLCrVETt4GK
 DX6U4LowIk9sG8Qr5i1ZvmJtWLxTe4r7DBNC1QkPM839PAn5hFewhT3HQG9PCADm
 d2AiZfp/+tDUONvFcZS5MjdRIF7ZfckIXlaEBUTWLgvRV8HotTjQY6IWP9VviFHo
 XPkh6TjsBNovSfQcRfTs+tJV+RenS6XH1adNmsuHJ8CW1CNnQ6ew8UDEjNzXxiZC
 9KGzgxr8YP4eDPE6Ku0mu2bkPA2wqM8VOvzUv8kLGGUvPCyS+ZikDF2YgUyyAU5I
 7S5nASht7uExd0kcAiRfRAhwZt6HN34ug8xAg4NKxiFRXWEbYYWxxJzeKj65TCHS
 /kitrM9+SHy9xOB9ciEs+LpewPq7EEXjEuodQyWjvuzZ2ZtyW6tPm+A0YNe4lSNE
 76bF1NstuzHx4E/ygvGhClP4fE4jRc/Nf6+lgak6kg4YX9GBBZ/MKfin05klwbHr
 3VnhhAnV9+om1lbW/aADy/qo64jlDHaCOLSt/ZGOZvTv1RlbINuIwaMWetjM8Ya+
 YPXtGekAcdyGzAjBq4HxdjapG2TiaS4CugyfCePyD+mfFMyg0gDtNcJNzscwk/be
 1ZtCyg+b4AVPNON1tIqR
 =DM4t
 -----END PGP SIGNATURE-----

Merge tag 'watchdog-for-linus-v4.11-2' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging

Pull more watchdog updates from Guenter Roeck:

 - fix fallout from enabling COMPILE_TEST

 - fix gcc-4.3 build of kempld watchdog driver

 - use hrtimer in softdog

* tag 'watchdog-for-linus-v4.11-2' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging:
  watchdog: retu: restore MFD dependency
  watchdog: db8500: add back prmcu dependency
  watchdog: kempld: fix gcc-4.3 build
  watchdog: softdog: fire watchdog even if softirqs do not get to run
  watchdog: kempld: revert to full dependency
  watchdog: bcm2835: add CONFIG_OF dependency
  watchdog: sp805: add back AMBA dependency
  watchdog: menf21bmc: add I2C dependency
  watchdog: geode: restore hard CS5535_MFGPT dependency
  watchdog: wm831x watchdog really needs mfd
This commit is contained in:
Linus Torvalds 2017-03-02 12:45:46 -08:00
Родитель 474c90156c 9ad82f117f
Коммит 4f1f2b8f08
3 изменённых файлов: 43 добавлений и 25 удалений

Просмотреть файл

@ -142,6 +142,7 @@ config GPIO_WATCHDOG_ARCH_INITCALL
config MENF21BMC_WATCHDOG
tristate "MEN 14F021P00 BMC Watchdog"
depends on MFD_MENF21BMC || COMPILE_TEST
depends on I2C
select WATCHDOG_CORE
help
Say Y here to include support for the MEN 14F021P00 BMC Watchdog.
@ -176,7 +177,7 @@ config WDAT_WDT
config WM831X_WATCHDOG
tristate "WM831x watchdog"
depends on MFD_WM831X || COMPILE_TEST
depends on MFD_WM831X
select WATCHDOG_CORE
help
Support for the watchdog in the WM831x AudioPlus PMICs. When
@ -217,7 +218,7 @@ config ZIIRAVE_WATCHDOG
config ARM_SP805_WATCHDOG
tristate "ARM SP805 Watchdog"
depends on (ARM || ARM64) && (ARM_AMBA || COMPILE_TEST)
depends on (ARM || ARM64 || COMPILE_TEST) && ARM_AMBA
select WATCHDOG_CORE
help
ARM Primecell SP805 Watchdog timer. This will reboot your system when
@ -573,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
@ -585,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,
@ -851,7 +852,7 @@ config SP5100_TCO
config GEODE_WDT
tristate "AMD Geode CS5535/CS5536 Watchdog"
depends on CS5535_MFGPT || (X86 && COMPILE_TEST)
depends on CS5535_MFGPT
help
This driver enables a watchdog capability built into the
CS5535/CS5536 companion chips for the AMD Geode GX and LX
@ -1063,7 +1064,7 @@ config HP_WATCHDOG
config KEMPLD_WDT
tristate "Kontron COM Watchdog Timer"
depends on MFD_KEMPLD || COMPILE_TEST
depends on MFD_KEMPLD
select WATCHDOG_CORE
help
Support for the PLD watchdog on some Kontron ETX and COMexpress
@ -1495,7 +1496,7 @@ config BCM63XX_WDT
config BCM2835_WDT
tristate "Broadcom BCM2835 hardware watchdog"
depends on ARCH_BCM2835 || COMPILE_TEST
depends on ARCH_BCM2835 || (OF && COMPILE_TEST)
select WATCHDOG_CORE
help
Watchdog driver for the built in watchdog hardware in Broadcom

Просмотреть файл

@ -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;

Просмотреть файл

@ -21,13 +21,12 @@
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/hrtimer.h>
#include <linux/init.h>
#include <linux/jiffies.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/reboot.h>
#include <linux/timer.h>
#include <linux/types.h>
#include <linux/watchdog.h>
@ -54,7 +53,10 @@ module_param(soft_panic, int, 0);
MODULE_PARM_DESC(soft_panic,
"Softdog action, set to 1 to panic, 0 to reboot (default=0)");
static void softdog_fire(unsigned long data)
static struct hrtimer softdog_ticktock;
static struct hrtimer softdog_preticktock;
static enum hrtimer_restart softdog_fire(struct hrtimer *timer)
{
module_put(THIS_MODULE);
if (soft_noboot) {
@ -67,32 +69,33 @@ static void softdog_fire(unsigned long data)
emergency_restart();
pr_crit("Reboot didn't ?????\n");
}
}
static struct timer_list softdog_ticktock =
TIMER_INITIALIZER(softdog_fire, 0, 0);
return HRTIMER_NORESTART;
}
static struct watchdog_device softdog_dev;
static void softdog_pretimeout(unsigned long data)
static enum hrtimer_restart softdog_pretimeout(struct hrtimer *timer)
{
watchdog_notify_pretimeout(&softdog_dev);
}
static struct timer_list softdog_preticktock =
TIMER_INITIALIZER(softdog_pretimeout, 0, 0);
return HRTIMER_NORESTART;
}
static int softdog_ping(struct watchdog_device *w)
{
if (!mod_timer(&softdog_ticktock, jiffies + (w->timeout * HZ)))
if (!hrtimer_active(&softdog_ticktock))
__module_get(THIS_MODULE);
hrtimer_start(&softdog_ticktock, ktime_set(w->timeout, 0),
HRTIMER_MODE_REL);
if (IS_ENABLED(CONFIG_SOFT_WATCHDOG_PRETIMEOUT)) {
if (w->pretimeout)
mod_timer(&softdog_preticktock, jiffies +
(w->timeout - w->pretimeout) * HZ);
hrtimer_start(&softdog_preticktock,
ktime_set(w->timeout - w->pretimeout, 0),
HRTIMER_MODE_REL);
else
del_timer(&softdog_preticktock);
hrtimer_cancel(&softdog_preticktock);
}
return 0;
@ -100,11 +103,11 @@ static int softdog_ping(struct watchdog_device *w)
static int softdog_stop(struct watchdog_device *w)
{
if (del_timer(&softdog_ticktock))
if (hrtimer_cancel(&softdog_ticktock))
module_put(THIS_MODULE);
if (IS_ENABLED(CONFIG_SOFT_WATCHDOG_PRETIMEOUT))
del_timer(&softdog_preticktock);
hrtimer_cancel(&softdog_preticktock);
return 0;
}
@ -136,8 +139,15 @@ static int __init softdog_init(void)
watchdog_set_nowayout(&softdog_dev, nowayout);
watchdog_stop_on_reboot(&softdog_dev);
if (IS_ENABLED(CONFIG_SOFT_WATCHDOG_PRETIMEOUT))
hrtimer_init(&softdog_ticktock, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
softdog_ticktock.function = softdog_fire;
if (IS_ENABLED(CONFIG_SOFT_WATCHDOG_PRETIMEOUT)) {
softdog_info.options |= WDIOF_PRETIMEOUT;
hrtimer_init(&softdog_preticktock, CLOCK_MONOTONIC,
HRTIMER_MODE_REL);
softdog_preticktock.function = softdog_pretimeout;
}
ret = watchdog_register_device(&softdog_dev);
if (ret)