rk fb: fix fb_info free too early when shutdown
authorhjc <hjc@rock-chips.com>
Wed, 9 Oct 2013 00:33:32 +0000 (17:33 -0700)
committerhjc <hjc@rock-chips.com>
Wed, 9 Oct 2013 00:33:32 +0000 (17:33 -0700)
drivers/video/rockchip/rk_fb.c
include/linux/rk_fb.h

index 2712279e9c331fc765046dcd4b33ebf00917e99f..3f3696d6c7d1b1fbc1f63dbeb74014788713f4e7 100755 (executable)
@@ -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);
index 335e684f1d216e37a33253677ee4e16067b54fdc..c0dd4ace333be1abfa16e48cc4b2c9fb640f49ea 100755 (executable)
@@ -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;