/* Generally the counter will reset across mode sets. If interrupts are enabled around this call, we don't have to do anything since the counter will have already been incremented.  */
int drm_modeset_ctl(struct drm_device *dev, void *data, struct drm_file *file_priv)
/* Generally the counter will reset across mode sets. If interrupts are enabled around this call, we don't have to do anything since the counter will have already been incremented.  */
int drm_modeset_ctl(struct drm_device *dev, void *data, struct drm_file *file_priv)
{
	struct drm_modeset_ctl *modeset = data;
	int crtc, ret = 0;
	if (!dev->num_crtcs)
		goto out;
	crtc = modeset->crtc;
	if (crtc >= dev->num_crtcs) {
		ret = -EINVAL;
		goto out;
	}
	switch (modeset->cmd) {
	case _DRM_PRE_MODESET:
		drm_vblank_pre_modeset(dev, crtc);
		break;
	case _DRM_POST_MODESET:
		drm_vblank_post_modeset(dev, crtc);
		break;
	default:
		ret = -EINVAL;
		break;
	}
out:
	return ret;
}