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 100 us sleep instead. The timeout remains at 1
ms.

Signed-off-by: Jani Nikula <[email protected]>
---
 drivers/gpu/drm/i915/display/intel_dsb.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_dsb.c 
b/drivers/gpu/drm/i915/display/intel_dsb.c
index 53d8ae3a70e9..6b43bd466714 100644
--- a/drivers/gpu/drm/i915/display/intel_dsb.c
+++ b/drivers/gpu/drm/i915/display/intel_dsb.c
@@ -4,6 +4,8 @@
  *
  */
 
+#include <linux/iopoll.h>
+
 #include <drm/drm_print.h>
 #include <drm/drm_vblank.h>
 
@@ -871,8 +873,14 @@ void intel_dsb_wait(struct intel_dsb *dsb)
        struct intel_crtc *crtc = dsb->crtc;
        struct intel_display *display = to_intel_display(crtc->base.dev);
        enum pipe pipe = crtc->pipe;
-
-       if (wait_for(!is_dsb_busy(display, pipe, dsb->id), 1)) {
+       bool is_busy;
+       int ret;
+
+       ret = read_poll_timeout(is_dsb_busy, is_busy,
+                               !is_busy,
+                               100, 1000, false,
+                               display, pipe, dsb->id);
+       if (ret) {
                u32 offset = intel_dsb_buffer_ggtt_offset(&dsb->dsb_buf);
 
                intel_de_write_fw(display, DSB_CTRL(pipe, dsb->id),
-- 
2.39.5

Reply via email to