Commit f4513a55 authored by Kevin Hilman's avatar Kevin Hilman Committed by Tony Lindgren

ARM: OMAP: fix suspend for twl4030

Use competions instead of manually setting scheduler state.
daemonize kernel thread and set PF_NOFREEZE.
Signed-off-by: default avatarKevin Hilman <khilman@mvista.com>
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
parent c6a2af22
...@@ -146,6 +146,7 @@ static void twl_init_irq(void); ...@@ -146,6 +146,7 @@ static void twl_init_irq(void);
/**** Data Structures */ /**** Data Structures */
/* To have info on T2 IRQ substem activated or not */ /* To have info on T2 IRQ substem activated or not */
static unsigned char twl_irq_used = FREE; static unsigned char twl_irq_used = FREE;
static struct completion irq_event;
/* Structure to define on TWL4030 Slave ID */ /* Structure to define on TWL4030 Slave ID */
struct twl4030_client { struct twl4030_client {
...@@ -459,11 +460,16 @@ static int twl4030_irq_thread(void *data) ...@@ -459,11 +460,16 @@ static int twl4030_irq_thread(void *data)
static unsigned i2c_errors; static unsigned i2c_errors;
const static unsigned max_i2c_errors = 100; const static unsigned max_i2c_errors = 100;
daemonize("twl4030-irq");
current->flags |= PF_NOFREEZE;
while (!kthread_should_stop()) { while (!kthread_should_stop()) {
int ret; int ret;
int module_irq; int module_irq;
u8 pih_isr; u8 pih_isr;
wait_for_completion_interruptible(&irq_event);
ret = twl4030_i2c_read_u8(TWL4030_MODULE_PIH, &pih_isr, ret = twl4030_i2c_read_u8(TWL4030_MODULE_PIH, &pih_isr,
REG_PIH_ISR_P1); REG_PIH_ISR_P1);
if (ret) { if (ret) {
...@@ -491,16 +497,9 @@ static int twl4030_irq_thread(void *data) ...@@ -491,16 +497,9 @@ static int twl4030_irq_thread(void *data)
} }
} }
local_irq_disable();
set_current_state(TASK_INTERRUPTIBLE);
desc->chip->unmask(irq); desc->chip->unmask(irq);
local_irq_enable();
schedule();
} }
set_current_state(TASK_RUNNING);
return 0; return 0;
} }
...@@ -516,7 +515,7 @@ static int twl4030_irq_thread(void *data) ...@@ -516,7 +515,7 @@ static int twl4030_irq_thread(void *data)
static void do_twl4030_irq(unsigned int irq, irq_desc_t *desc) static void do_twl4030_irq(unsigned int irq, irq_desc_t *desc)
{ {
const unsigned int cpu = smp_processor_id(); const unsigned int cpu = smp_processor_id();
struct task_struct *thread = get_irq_data(irq);
/* /*
* Earlier this was desc->triggered = 1; * Earlier this was desc->triggered = 1;
*/ */
...@@ -530,8 +529,7 @@ static void do_twl4030_irq(unsigned int irq, irq_desc_t *desc) ...@@ -530,8 +529,7 @@ static void do_twl4030_irq(unsigned int irq, irq_desc_t *desc)
if (!desc->depth) { if (!desc->depth) {
kstat_cpu(cpu).irqs[irq]++; kstat_cpu(cpu).irqs[irq]++;
if (thread && thread->state != TASK_RUNNING) complete(&irq_event);
wake_up_process(thread);
} }
} }
...@@ -637,8 +635,9 @@ struct task_struct *start_twl4030_irq_thread(int irq) ...@@ -637,8 +635,9 @@ struct task_struct *start_twl4030_irq_thread(int irq)
{ {
struct task_struct *thread; struct task_struct *thread;
thread = kthread_create(twl4030_irq_thread, (void *)irq, init_completion(&irq_event);
"twl4030 irq %d", irq); thread = kthread_run(twl4030_irq_thread, (void *)irq,
"twl4030 irq %d", irq);
if (!thread) if (!thread)
pr_err("%s: could not create twl4030 irq %d thread!\n", pr_err("%s: could not create twl4030 irq %d thread!\n",
__FUNCTION__,irq); __FUNCTION__,irq);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment