The extra function serves no useful purpose. This allows us to drop another superfluous pipe check warning.
Signed-off-by: Jani Nikula <[email protected]> --- drivers/gpu/drm/drm_vblank.c | 57 +++++++++++++++--------------------- 1 file changed, 23 insertions(+), 34 deletions(-) diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c index 0ff69b06b2bd..64cd96207ad5 100644 --- a/drivers/gpu/drm/drm_vblank.c +++ b/drivers/gpu/drm/drm_vblank.c @@ -1524,23 +1524,41 @@ void drm_crtc_vblank_on(struct drm_crtc *crtc) } EXPORT_SYMBOL(drm_crtc_vblank_on); -static void drm_vblank_restore(struct drm_device *dev, unsigned int pipe) +/** + * drm_crtc_vblank_restore - estimate missed vblanks and update vblank count. + * @crtc: CRTC in question + * + * Power manamement features can cause frame counter resets between vblank + * disable and enable. Drivers can use this function in their + * &drm_crtc_funcs.enable_vblank implementation to estimate missed vblanks since + * the last &drm_crtc_funcs.disable_vblank using timestamps and update the + * vblank counter. + * + * Note that drivers must have race-free high-precision timestamping support, + * i.e. &drm_crtc_funcs.get_vblank_timestamp must be hooked up and + * &drm_vblank_crtc_config.disable_immediate must be set to indicate the + * time-stamping functions are race-free against vblank hardware counter + * increments. + */ +void drm_crtc_vblank_restore(struct drm_crtc *crtc) { + struct drm_device *dev = crtc->dev; + unsigned int pipe = drm_crtc_index(crtc); + struct drm_vblank_crtc *vblank = drm_crtc_vblank_crtc(crtc); ktime_t t_vblank; - struct drm_vblank_crtc *vblank; int framedur_ns; u64 diff_ns; u32 cur_vblank, diff = 1; int count = DRM_TIMESTAMP_MAXRETRIES; u32 max_vblank_count = drm_max_vblank_count(dev, pipe); - if (drm_WARN_ON(dev, pipe >= dev->num_crtcs)) - return; + drm_WARN_ON_ONCE(dev, !crtc->funcs->get_vblank_timestamp); + drm_WARN_ON_ONCE(dev, vblank->inmodeset); + drm_WARN_ON_ONCE(dev, !vblank->config.disable_immediate); assert_spin_locked(&dev->vbl_lock); assert_spin_locked(&dev->vblank_time_lock); - vblank = drm_vblank_crtc(dev, pipe); drm_WARN_ONCE(dev, drm_debug_enabled(DRM_UT_VBL) && !vblank->framedur_ns, "Cannot compute missed vblanks without frame duration\n"); @@ -1561,35 +1579,6 @@ static void drm_vblank_restore(struct drm_device *dev, unsigned int pipe) diff, diff_ns, framedur_ns, cur_vblank - vblank->last); vblank->last = (cur_vblank - diff) & max_vblank_count; } - -/** - * drm_crtc_vblank_restore - estimate missed vblanks and update vblank count. - * @crtc: CRTC in question - * - * Power manamement features can cause frame counter resets between vblank - * disable and enable. Drivers can use this function in their - * &drm_crtc_funcs.enable_vblank implementation to estimate missed vblanks since - * the last &drm_crtc_funcs.disable_vblank using timestamps and update the - * vblank counter. - * - * Note that drivers must have race-free high-precision timestamping support, - * i.e. &drm_crtc_funcs.get_vblank_timestamp must be hooked up and - * &drm_vblank_crtc_config.disable_immediate must be set to indicate the - * time-stamping functions are race-free against vblank hardware counter - * increments. - */ -void drm_crtc_vblank_restore(struct drm_crtc *crtc) -{ - struct drm_device *dev = crtc->dev; - unsigned int pipe = drm_crtc_index(crtc); - struct drm_vblank_crtc *vblank = drm_vblank_crtc(dev, pipe); - - drm_WARN_ON_ONCE(dev, !crtc->funcs->get_vblank_timestamp); - drm_WARN_ON_ONCE(dev, vblank->inmodeset); - drm_WARN_ON_ONCE(dev, !vblank->config.disable_immediate); - - drm_vblank_restore(dev, pipe); -} EXPORT_SYMBOL(drm_crtc_vblank_restore); static int drm_queue_vblank_event(struct drm_vblank_crtc *vblank, -- 2.47.3
