summaryrefslogtreecommitdiffstats
path: root/drivers/s390/char/vmwatchdog.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/s390/char/vmwatchdog.c')
-rw-r--r--drivers/s390/char/vmwatchdog.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/drivers/s390/char/vmwatchdog.c b/drivers/s390/char/vmwatchdog.c
index 19f8389291b..21a2a829bf4 100644
--- a/drivers/s390/char/vmwatchdog.c
+++ b/drivers/s390/char/vmwatchdog.c
@@ -13,6 +13,7 @@
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/watchdog.h>
+#include <linux/smp_lock.h>
#include <asm/ebcdic.h>
#include <asm/io.h>
@@ -92,23 +93,15 @@ static int vmwdt_keepalive(void)
func = vmwdt_conceal ? (wdt_init | wdt_conceal) : wdt_init;
ret = __diag288(func, vmwdt_interval, ebc_cmd, len);
+ WARN_ON(ret != 0);
kfree(ebc_cmd);
-
- if (ret) {
- printk(KERN_WARNING "%s: problem setting interval %d, "
- "cmd %s\n", __func__, vmwdt_interval,
- vmwdt_cmd);
- }
return ret;
}
static int vmwdt_disable(void)
{
int ret = __diag288(wdt_cancel, 0, "", 0);
- if (ret) {
- printk(KERN_WARNING "%s: problem disabling watchdog\n",
- __func__);
- }
+ WARN_ON(ret != 0);
return ret;
}
@@ -121,21 +114,23 @@ static int __init vmwdt_probe(void)
static char __initdata ebc_begin[] = {
194, 197, 199, 201, 213
};
- if (__diag288(wdt_init, 15, ebc_begin, sizeof(ebc_begin)) != 0) {
- printk(KERN_INFO "z/VM watchdog not available\n");
+ if (__diag288(wdt_init, 15, ebc_begin, sizeof(ebc_begin)) != 0)
return -EINVAL;
- }
return vmwdt_disable();
}
static int vmwdt_open(struct inode *i, struct file *f)
{
int ret;
- if (test_and_set_bit(0, &vmwdt_is_open))
+ lock_kernel();
+ if (test_and_set_bit(0, &vmwdt_is_open)) {
+ unlock_kernel();
return -EBUSY;
+ }
ret = vmwdt_keepalive();
if (ret)
clear_bit(0, &vmwdt_is_open);
+ unlock_kernel();
return ret ? ret : nonseekable_open(i, f);
}