From: Huang Jiachai Date: Tue, 6 Sep 2016 10:10:49 +0000 (+0800) Subject: video: rockchip: fb: add reference count for vsync X-Git-Tag: firefly_0821_release~1578 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=ac8307ae24aae8556d1abd4dc9a208e3ce9b7f62;p=firefly-linux-kernel-4.4.55.git video: rockchip: fb: add reference count for vsync Change-Id: I76ff8489f3e71f21de3461c0834424b5d1bf1962 Signed-off-by: Huang Jiachai --- diff --git a/drivers/video/rockchip/rk_fb.c b/drivers/video/rockchip/rk_fb.c index 2ff4f79af12c..fb2e34f690df 100644 --- a/drivers/video/rockchip/rk_fb.c +++ b/drivers/video/rockchip/rk_fb.c @@ -2913,9 +2913,11 @@ static int rk_fb_ioctl(struct fb_info *info, unsigned int cmd, case RK_FBIOSET_VSYNC_ENABLE: if (copy_from_user(&enable, argp, sizeof(enable))) return -EFAULT; - dev_drv->vsync_info.active = enable; + if (enable) + dev_drv->vsync_info.active++; + else + dev_drv->vsync_info.active--; break; - case RK_FBIOGET_DSP_ADDR: dev_drv->ops->get_dsp_addr(dev_drv, dsp_addr); if (copy_to_user(argp, &dsp_addr, sizeof(dsp_addr))) @@ -3467,7 +3469,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.irq_stop)); + (dev_drv->vsync_info.active > 0 || dev_drv->vsync_info.irq_stop)); if (!ret) sysfs_notify(&fbi->dev->kobj, NULL, "vsync"); diff --git a/include/linux/rk_fb.h b/include/linux/rk_fb.h index 2374664e6dfe..6fbcae14ea94 100755 --- a/include/linux/rk_fb.h +++ b/include/linux/rk_fb.h @@ -327,7 +327,7 @@ struct rk_fb_frame_time { struct rk_fb_vsync { wait_queue_head_t wait; ktime_t timestamp; - bool active; + int active; bool irq_stop; int irq_refcount; struct mutex irq_lock;