Prefer generic poll helpers over i915 custom helpers.

The sleep and timeout remain the same as for wait_for_us().

Signed-off-by: Jani Nikula <jani.nik...@intel.com>
---
 drivers/gpu/drm/i915/display/icl_dsi.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/icl_dsi.c 
b/drivers/gpu/drm/i915/display/icl_dsi.c
index 44310984bb57..37faa8f19f6e 100644
--- a/drivers/gpu/drm/i915/display/icl_dsi.c
+++ b/drivers/gpu/drm/i915/display/icl_dsi.c
@@ -25,6 +25,8 @@
  *   Jani Nikula <jani.nik...@intel.com>
  */
 
+#include <linux/iopoll.h>
+
 #include <drm/display/drm_dsc_helper.h>
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_fixed.h>
@@ -72,8 +74,12 @@ static int payload_credits_available(struct intel_display 
*display,
 static bool wait_for_header_credits(struct intel_display *display,
                                    enum transcoder dsi_trans, int hdr_credit)
 {
-       if (wait_for_us(header_credits_available(display, dsi_trans) >=
-                       hdr_credit, 100)) {
+       int ret, available;
+
+       ret = poll_timeout_us(available = header_credits_available(display, 
dsi_trans),
+                             available >= hdr_credit,
+                             10, 100, false);
+       if (ret) {
                drm_err(display->drm, "DSI header credits not released\n");
                return false;
        }
@@ -84,8 +90,12 @@ static bool wait_for_header_credits(struct intel_display 
*display,
 static bool wait_for_payload_credits(struct intel_display *display,
                                     enum transcoder dsi_trans, int 
payld_credit)
 {
-       if (wait_for_us(payload_credits_available(display, dsi_trans) >=
-                       payld_credit, 100)) {
+       int ret, available;
+
+       ret = poll_timeout_us(available = payload_credits_available(display, 
dsi_trans),
+                             available >= payld_credit,
+                             10, 100, false);
+       if (ret) {
                drm_err(display->drm, "DSI payload credits not released\n");
                return false;
        }
-- 
2.47.2

Reply via email to