soc: qcom: watchdog_v2: Change completion to wait_queue
Prepare for future changes which will require waiting on several conditions prior to petting the watchdog. Change-Id: I1a62b6ec73e7cd581a535316029956ea7ce23ba0 Signed-off-by: Patrick Daly <pdaly@codeaurora.org>
This commit is contained in:
parent
7c71a4d3c7
commit
cf5a632479
1 changed files with 12 additions and 7 deletions
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2012-2015, The Linux Foundation. All rights reserved.
|
/* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License version 2 and
|
* it under the terms of the GNU General Public License version 2 and
|
||||||
|
@ -26,6 +26,7 @@
|
||||||
#include <linux/cpu.h>
|
#include <linux/cpu.h>
|
||||||
#include <linux/cpu_pm.h>
|
#include <linux/cpu_pm.h>
|
||||||
#include <linux/platform_device.h>
|
#include <linux/platform_device.h>
|
||||||
|
#include <linux/wait.h>
|
||||||
#include <soc/qcom/scm.h>
|
#include <soc/qcom/scm.h>
|
||||||
#include <soc/qcom/memory_dump.h>
|
#include <soc/qcom/memory_dump.h>
|
||||||
#include <soc/qcom/watchdog.h>
|
#include <soc/qcom/watchdog.h>
|
||||||
|
@ -77,7 +78,8 @@ struct msm_watchdog_data {
|
||||||
bool enabled;
|
bool enabled;
|
||||||
struct task_struct *watchdog_task;
|
struct task_struct *watchdog_task;
|
||||||
struct timer_list pet_timer;
|
struct timer_list pet_timer;
|
||||||
struct completion pet_complete;
|
wait_queue_head_t pet_complete;
|
||||||
|
bool timer_expired;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -298,7 +300,8 @@ static void pet_task_wakeup(unsigned long data)
|
||||||
{
|
{
|
||||||
struct msm_watchdog_data *wdog_dd =
|
struct msm_watchdog_data *wdog_dd =
|
||||||
(struct msm_watchdog_data *)data;
|
(struct msm_watchdog_data *)data;
|
||||||
complete(&wdog_dd->pet_complete);
|
wdog_dd->timer_expired = true;
|
||||||
|
wake_up(&wdog_dd->pet_complete);
|
||||||
}
|
}
|
||||||
|
|
||||||
static __ref int watchdog_kthread(void *arg)
|
static __ref int watchdog_kthread(void *arg)
|
||||||
|
@ -310,10 +313,11 @@ static __ref int watchdog_kthread(void *arg)
|
||||||
|
|
||||||
sched_setscheduler(current, SCHED_FIFO, ¶m);
|
sched_setscheduler(current, SCHED_FIFO, ¶m);
|
||||||
while (!kthread_should_stop()) {
|
while (!kthread_should_stop()) {
|
||||||
while (wait_for_completion_interruptible(
|
while (wait_event_interruptible(
|
||||||
&wdog_dd->pet_complete) != 0)
|
wdog_dd->pet_complete,
|
||||||
|
wdog_dd->timer_expired) != 0)
|
||||||
;
|
;
|
||||||
reinit_completion(&wdog_dd->pet_complete);
|
wdog_dd->timer_expired = false;
|
||||||
if (enable) {
|
if (enable) {
|
||||||
delay_time = msecs_to_jiffies(wdog_dd->pet_time);
|
delay_time = msecs_to_jiffies(wdog_dd->pet_time);
|
||||||
if (wdog_dd->do_ipi_ping)
|
if (wdog_dd->do_ipi_ping)
|
||||||
|
@ -561,7 +565,8 @@ static void init_watchdog_data(struct msm_watchdog_data *wdog_dd)
|
||||||
atomic_notifier_chain_register(&panic_notifier_list,
|
atomic_notifier_chain_register(&panic_notifier_list,
|
||||||
&wdog_dd->panic_blk);
|
&wdog_dd->panic_blk);
|
||||||
mutex_init(&wdog_dd->disable_lock);
|
mutex_init(&wdog_dd->disable_lock);
|
||||||
init_completion(&wdog_dd->pet_complete);
|
init_waitqueue_head(&wdog_dd->pet_complete);
|
||||||
|
wdog_dd->timer_expired = false;
|
||||||
wake_up_process(wdog_dd->watchdog_task);
|
wake_up_process(wdog_dd->watchdog_task);
|
||||||
init_timer(&wdog_dd->pet_timer);
|
init_timer(&wdog_dd->pet_timer);
|
||||||
wdog_dd->pet_timer.data = (unsigned long)wdog_dd;
|
wdog_dd->pet_timer.data = (unsigned long)wdog_dd;
|
||||||
|
|
Loading…
Add table
Reference in a new issue