summaryrefslogtreecommitdiff
path: root/drivers/mxc
diff options
context:
space:
mode:
authorZhou Jingyu <b02241@freescale.com>2011-04-27 12:57:12 +0800
committerZhou Jingyu <b02241@freescale.com>2011-05-09 17:20:31 +0800
commitc82491bd332b756c058098a786edb2c122c61794 (patch)
treeced5860fb4babdfa39fa0a22ecd1b50393aa24ae /drivers/mxc
parentbcbc21dc495c6a4384c8b0d7979503cba0bb4875 (diff)
ENGR00142638 pmic mc13xxx: make event thread freezable
make event thread freezable to avoid possible pmic access before driver resume is done. Signed-off-by: Zhou Jingyu <Jingyu.Zhou@freescale.com>
Diffstat (limited to 'drivers/mxc')
-rw-r--r--drivers/mxc/pmic/core/pmic_common.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/drivers/mxc/pmic/core/pmic_common.c b/drivers/mxc/pmic/core/pmic_common.c
index 7e53121f12b8..fd07c4d7e25d 100644
--- a/drivers/mxc/pmic/core/pmic_common.c
+++ b/drivers/mxc/pmic/core/pmic_common.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2009-2010 Freescale Semiconductor, Inc. All Rights Reserved.
+ * Copyright 2009-2011 Freescale Semiconductor, Inc. All Rights Reserved.
*/
/*
@@ -30,6 +30,7 @@
#include <linux/interrupt.h>
#include <linux/irq.h>
#include <linux/kthread.h>
+#include <linux/freezer.h>
#include <linux/pmic_external.h>
#include <linux/pmic_status.h>
@@ -53,9 +54,17 @@ static int pmic_event_thread_func(void *v)
unsigned int count = 0;
unsigned int irq = (int)v;
+ set_freezable_with_signal();
while (1) {
- wait_for_completion_interruptible(
- &event_completion);
+ if (wait_for_completion_interruptible(
+ &event_completion)) {
+ /* possiblely wakeup by a freeze request*/
+ try_to_freeze();
+ /* check if irq arrives when resume*/
+ if (!try_wait_for_completion(
+ &event_completion))
+ continue;
+ }
if (kthread_should_stop())
break;