From 2ba162b9335c6e3ba90c77637372fc9f078aae67 Mon Sep 17 00:00:00 2001 From: Eric Miao Date: Wed, 30 Apr 2008 00:52:24 -0700 Subject: pxafb: use completion for LCD disable wait code Signed-off-by: eric miao Cc: "Antonino A. Daplas" Cc: Russell King Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/video/pxafb.c | 12 ++++-------- drivers/video/pxafb.h | 2 ++ 2 files changed, 6 insertions(+), 8 deletions(-) (limited to 'drivers/video') diff --git a/drivers/video/pxafb.c b/drivers/video/pxafb.c index 417561779ec2..a4ee7225fe2c 100644 --- a/drivers/video/pxafb.c +++ b/drivers/video/pxafb.c @@ -39,6 +39,7 @@ #include #include #include +#include #include #include @@ -810,11 +811,6 @@ static void pxafb_disable_controller(struct pxafb_info *fbi) { uint32_t lccr0; - DECLARE_WAITQUEUE(wait, current); - - set_current_state(TASK_UNINTERRUPTIBLE); - add_wait_queue(&fbi->ctrlr_wait, &wait); - /* Clear LCD Status Register */ lcd_writel(fbi, LCSR, 0xffffffff); @@ -822,8 +818,7 @@ static void pxafb_disable_controller(struct pxafb_info *fbi) lcd_writel(fbi, LCCR0, lccr0); lcd_writel(fbi, LCCR0, lccr0 | LCCR0_DIS); - schedule_timeout(200 * HZ / 1000); - remove_wait_queue(&fbi->ctrlr_wait, &wait); + wait_for_completion_timeout(&fbi->disable_done, 200 * HZ / 1000); /* disable LCD controller clock */ clk_disable(fbi->clk); @@ -840,7 +835,7 @@ static irqreturn_t pxafb_handle_irq(int irq, void *dev_id) if (lcsr & LCSR_LDD) { lccr0 = lcd_readl(fbi, LCCR0); lcd_writel(fbi, LCCR0, lccr0 | LCCR0_LDM); - wake_up(&fbi->ctrlr_wait); + complete(&fbi->disable_done); } lcd_writel(fbi, LCSR, lcsr); @@ -1190,6 +1185,7 @@ static struct pxafb_info * __init pxafb_init_fbinfo(struct device *dev) init_waitqueue_head(&fbi->ctrlr_wait); INIT_WORK(&fbi->task, pxafb_task); init_MUTEX(&fbi->ctrlr_sem); + init_completion(&fbi->disable_done); return fbi; } diff --git a/drivers/video/pxafb.h b/drivers/video/pxafb.h index b777641c5e70..f47f139fc5ed 100644 --- a/drivers/video/pxafb.h +++ b/drivers/video/pxafb.h @@ -114,6 +114,8 @@ struct pxafb_info { wait_queue_head_t ctrlr_wait; struct work_struct task; + struct completion disable_done; + #ifdef CONFIG_CPU_FREQ struct notifier_block freq_transition; struct notifier_block freq_policy; -- cgit v1.2.3