From 565bb88003eea5bf3e1b8437db8c2be429d77b0c Mon Sep 17 00:00:00 2001 From: hjc Date: Tue, 8 Oct 2013 17:33:32 -0700 Subject: [PATCH] rk fb: fix fb_info free too early when shutdown --- drivers/video/rockchip/rk_fb.c | 9 ++++++--- include/linux/rk_fb.h | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/video/rockchip/rk_fb.c b/drivers/video/rockchip/rk_fb.c index 2712279e9c33..3f3696d6c7d1 100755 --- a/drivers/video/rockchip/rk_fb.c +++ b/drivers/video/rockchip/rk_fb.c @@ -1121,7 +1121,7 @@ static int rk_fb_wait_for_vsync_thread(void *data) ktime_t timestamp = dev_drv->vsync_info.timestamp; int ret = wait_event_interruptible(dev_drv->vsync_info.wait, !ktime_equal(timestamp, dev_drv->vsync_info.timestamp) && - dev_drv->vsync_info.active); + dev_drv->vsync_info.active || dev_drv->vsync_info.irq_stop); if (!ret) { sysfs_notify(&fbi->dev->kobj, NULL, "vsync"); @@ -1808,6 +1808,11 @@ int rk_fb_unregister(struct rk_lcdc_device_driver *dev_drv) return -ENOENT; } + if(fb_inf->lcdc_dev_drv[i]->vsync_info.thread){ + fb_inf->lcdc_dev_drv[i]->vsync_info.irq_stop = 1; + kthread_stop(fb_inf->lcdc_dev_drv[i]->vsync_info.thread); + } + for(i = 0; i < fb_num; i++) { kfree(dev_drv->layer_par[i]); @@ -1912,8 +1917,6 @@ static void rk_fb_shutdown(struct platform_device *pdev) if (!inf->lcdc_dev_drv[i]) continue; - if(inf->lcdc_dev_drv[i]->vsync_info.thread) - kthread_stop(inf->lcdc_dev_drv[i]->vsync_info.thread); } // kfree(fb_inf); // platform_set_drvdata(pdev, NULL); diff --git a/include/linux/rk_fb.h b/include/linux/rk_fb.h index 335e684f1d21..c0dd4ace333b 100755 --- a/include/linux/rk_fb.h +++ b/include/linux/rk_fb.h @@ -187,6 +187,7 @@ struct rk_fb_vsync { wait_queue_head_t wait; ktime_t timestamp; bool active; + bool irq_stop; int irq_refcount; struct mutex irq_lock; struct task_struct *thread; -- 2.34.1