static int s3cfb_wait_for_vsync(struct s3cfb_global *ctrl) { ktime_t prev_timestamp; int ret; prev_timestamp = ctrl->vsync_timestamp; ret = wait_event_interruptible_timeout(ctrl->vsync_wait, s3cfb_vsync_timestamp_changed(ctrl, prev_timestamp), msecs_to_jiffies(100)); if (ret == 0) return -ETIMEDOUT; if (ret < 0) return ret; return ret; }
static int s3cfb_wait_for_vsync_thread(void *data) { struct s3cfb_global *fbdev = data; while (!kthread_should_stop()) { ktime_t prev_timestamp = fbdev->vsync_timestamp; int ret = wait_event_interruptible_timeout(fbdev->vsync_wq, s3cfb_vsync_timestamp_changed(fbdev, prev_timestamp), msecs_to_jiffies(100)); if (ret > 0) { char *envp[2]; char buf[64]; snprintf(buf, sizeof(buf), "VSYNC=%llu", ktime_to_ns(fbdev->vsync_timestamp)); envp[0] = buf; envp[1] = NULL; kobject_uevent_env(&fbdev->dev->kobj, KOBJ_CHANGE, envp); } } return 0; }