summaryrefslogtreecommitdiff
path: root/kernel/watchdog.c
diff options
context:
space:
mode:
authorKevin Hilman <khilman@linaro.org>2015-06-11 14:37:45 -0700
committerKevin Hilman <khilman@linaro.org>2015-06-11 14:37:45 -0700
commitecdf94da6f91310d08081e05db78a6c997b44e4b (patch)
tree0528ddc7e2b34046b3bd98dedf89ca7fee40c1ae /kernel/watchdog.c
parente28f23d8aaf3c3455edcdf646d910757051a07e3 (diff)
parentc65b99f046843d2455aa231747b5a07a999a9f3d (diff)
Merge tag 'v4.1-rc6' into next/dt
Linux 4.1-rc6 Conflicts: arch/arm/boot/dts/zynq-7000.dtsi Resolution summary: Mainline had an earlier version of the commit, resolve in favor of the newer patch in next/dt branch.
Diffstat (limited to 'kernel/watchdog.c')
-rw-r--r--kernel/watchdog.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index 2316f50b07a4..581a68a04c64 100644
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -41,6 +41,8 @@
#define NMI_WATCHDOG_ENABLED (1 << NMI_WATCHDOG_ENABLED_BIT)
#define SOFT_WATCHDOG_ENABLED (1 << SOFT_WATCHDOG_ENABLED_BIT)
+static DEFINE_MUTEX(watchdog_proc_mutex);
+
#ifdef CONFIG_HARDLOCKUP_DETECTOR
static unsigned long __read_mostly watchdog_enabled = SOFT_WATCHDOG_ENABLED|NMI_WATCHDOG_ENABLED;
#else
@@ -608,26 +610,36 @@ void watchdog_nmi_enable_all(void)
{
int cpu;
- if (!watchdog_user_enabled)
- return;
+ mutex_lock(&watchdog_proc_mutex);
+
+ if (!(watchdog_enabled & NMI_WATCHDOG_ENABLED))
+ goto unlock;
get_online_cpus();
for_each_online_cpu(cpu)
watchdog_nmi_enable(cpu);
put_online_cpus();
+
+unlock:
+ mutex_unlock(&watchdog_proc_mutex);
}
void watchdog_nmi_disable_all(void)
{
int cpu;
+ mutex_lock(&watchdog_proc_mutex);
+
if (!watchdog_running)
- return;
+ goto unlock;
get_online_cpus();
for_each_online_cpu(cpu)
watchdog_nmi_disable(cpu);
put_online_cpus();
+
+unlock:
+ mutex_unlock(&watchdog_proc_mutex);
}
#else
static int watchdog_nmi_enable(unsigned int cpu) { return 0; }
@@ -744,8 +756,6 @@ static int proc_watchdog_update(void)
}
-static DEFINE_MUTEX(watchdog_proc_mutex);
-
/*
* common function for watchdog, nmi_watchdog and soft_watchdog parameter
*