diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-01-17 21:15:38 +0100 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-01-17 21:15:38 +0100 |
commit | 6606b342febfd470b4a33acb73e360eeaca1d9bb (patch) | |
tree | 2414cc2ca582aa34be6e6ed5c830658fbf21db41 /drivers/watchdog/diag288_wdt.c | |
parent | Merge tag 'sound-4.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/ti... (diff) | |
parent | watchdog: asm9260: remove __init and __exit annotations (diff) | |
download | linux-6606b342febfd470b4a33acb73e360eeaca1d9bb.tar.xz linux-6606b342febfd470b4a33acb73e360eeaca1d9bb.zip |
Merge git://www.linux-watchdog.org/linux-watchdog
Pull watchdog updates from Wim Van Sebroeck:
"This adds following items:
- watchdog restart handler support
- watchdog reboot notifier support
- watchdog sysfs attributes
- support for the following new devices: AMD Mullins platform, AMD
Carrizo platform, meson8b SoC, CSRatlas7, TS-4800, Alphascale
asm9260-wdt, Zodiac, Sigma Designs SMP86xx/SMP87xx
- Changes in refcounting for the watchdog core
- watchdog core improvements
- and small fixes"
* git://www.linux-watchdog.org/linux-watchdog: (60 commits)
watchdog: asm9260: remove __init and __exit annotations
watchdog: Drop pointer to watchdog device from struct watchdog_device
watchdog: ziirave: Use watchdog infrastructure to create sysfs attributes
watchdog: Add support for creating driver specific sysfs attributes
watchdog: kill unref/ref ops
watchdog: stmp3xxx: Remove unused variables
watchdog: add MT7621 watchdog support
hwmon: (sch56xx) Drop watchdog driver data reference count callbacks
watchdog: da9055_wdt: Drop reference counting
watchdog: da9052_wdt: Drop reference counting
watchdog: Separate and maintain variables based on variable lifetime
watchdog: diag288: Stop re-using watchdog core internal flags
watchdog: Create watchdog device in watchdog_dev.c
watchdog: qcom-wdt: Do not set 'dev' in struct watchdog_device
watchdog: mena21: Do not use device pointer from struct watchdog_device
watchdog: gpio: Do not use device pointer from struct watchdog_device
watchdog: tangox: Print info message using pointer to platform device
watchdog: bcm2835_wdt: Drop log message if watchdog is stopped
devicetree: watchdog: add binding for Sigma Designs SMP8642 watchdog
watchdog: add support for Sigma Designs SMP86xx/SMP87xx
...
Diffstat (limited to 'drivers/watchdog/diag288_wdt.c')
-rw-r--r-- | drivers/watchdog/diag288_wdt.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/drivers/watchdog/diag288_wdt.c b/drivers/watchdog/diag288_wdt.c index 3db9d0e0673d..861d3d3133f8 100644 --- a/drivers/watchdog/diag288_wdt.c +++ b/drivers/watchdog/diag288_wdt.c @@ -106,6 +106,10 @@ static int __diag288_lpar(unsigned int func, unsigned int timeout, return __diag288(func, timeout, action, 0); } +static unsigned long wdt_status; + +#define DIAG_WDOG_BUSY 0 + static int wdt_start(struct watchdog_device *dev) { char *ebc_cmd; @@ -113,12 +117,17 @@ static int wdt_start(struct watchdog_device *dev) int ret; unsigned int func; + if (test_and_set_bit(DIAG_WDOG_BUSY, &wdt_status)) + return -EBUSY; + ret = -ENODEV; if (MACHINE_IS_VM) { ebc_cmd = kmalloc(MAX_CMDLEN, GFP_KERNEL); - if (!ebc_cmd) + if (!ebc_cmd) { + clear_bit(DIAG_WDOG_BUSY, &wdt_status); return -ENOMEM; + } len = strlcpy(ebc_cmd, wdt_cmd, MAX_CMDLEN); ASCEBC(ebc_cmd, MAX_CMDLEN); EBC_TOUPPER(ebc_cmd, MAX_CMDLEN); @@ -135,6 +144,7 @@ static int wdt_start(struct watchdog_device *dev) if (ret) { pr_err("The watchdog cannot be activated\n"); + clear_bit(DIAG_WDOG_BUSY, &wdt_status); return ret; } return 0; @@ -146,6 +156,9 @@ static int wdt_stop(struct watchdog_device *dev) diag_stat_inc(DIAG_STAT_X288); ret = __diag288(WDT_FUNC_CANCEL, 0, 0, 0); + + clear_bit(DIAG_WDOG_BUSY, &wdt_status); + return ret; } @@ -220,17 +233,10 @@ static struct watchdog_device wdt_dev = { * It makes no sense to go into suspend while the watchdog is running. * Depending on the memory size, the watchdog might trigger, while we * are still saving the memory. - * We reuse the open flag to ensure that suspend and watchdog open are - * exclusive operations */ static int wdt_suspend(void) { - if (test_and_set_bit(WDOG_DEV_OPEN, &wdt_dev.status)) { - pr_err("Linux cannot be suspended while the watchdog is in use\n"); - return notifier_from_errno(-EBUSY); - } - if (test_bit(WDOG_ACTIVE, &wdt_dev.status)) { - clear_bit(WDOG_DEV_OPEN, &wdt_dev.status); + if (test_and_set_bit(DIAG_WDOG_BUSY, &wdt_status)) { pr_err("Linux cannot be suspended while the watchdog is in use\n"); return notifier_from_errno(-EBUSY); } @@ -239,7 +245,7 @@ static int wdt_suspend(void) static int wdt_resume(void) { - clear_bit(WDOG_DEV_OPEN, &wdt_dev.status); + clear_bit(DIAG_WDOG_BUSY, &wdt_status); return NOTIFY_DONE; } |