]> www.infradead.org Git - users/hch/misc.git/commitdiff
drm/i915/vblank: use generic poll_timeout_us() instead of wait_for()
authorJani Nikula <jani.nikula@intel.com>
Thu, 28 Aug 2025 12:20:56 +0000 (15:20 +0300)
committerJani Nikula <jani.nikula@intel.com>
Thu, 4 Sep 2025 11:02:59 +0000 (14:02 +0300)
Prefer generic poll helpers over i915 custom helpers.

The functional change is losing the exponentially growing sleep of
wait_for(), which used to be 10, 20, 40, ..., 640, and 1280 us.

Use an arbitrary constant 500 us sleep instead. The timeout remains at
100 ms.

Reviewed-by: Jouni Högander <jouni.hogander@intel.com>
Link: https://lore.kernel.org/r/162dff5862d3213304491a6d2eb31a57346b523e.1756383233.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
drivers/gpu/drm/i915/display/intel_vblank.c

index 46d6db5fed11624517c69a47161ce05cf6c8fab8..c15234c1d96e721cec56e9cef33965379c96a04f 100644 (file)
@@ -3,6 +3,8 @@
  * Copyright © 2022-2023 Intel Corporation
  */
 
+#include <linux/iopoll.h>
+
 #include <drm/drm_vblank.h>
 
 #include "i915_drv.h"
@@ -493,9 +495,14 @@ static void wait_for_pipe_scanline_moving(struct intel_crtc *crtc, bool state)
 {
        struct intel_display *display = to_intel_display(crtc);
        enum pipe pipe = crtc->pipe;
+       bool is_moving;
+       int ret;
 
        /* Wait for the display line to settle/start moving */
-       if (wait_for(pipe_scanline_is_moving(display, pipe) == state, 100))
+       ret = poll_timeout_us(is_moving = pipe_scanline_is_moving(display, pipe),
+                             is_moving == state,
+                             500, 100 * 1000, false);
+       if (ret)
                drm_err(display->drm,
                        "pipe %c scanline %s wait timed out\n",
                        pipe_name(pipe), str_on_off(state));