]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/i915/tc: use generic poll_timeout_us() instead of wait_for()
authorJani Nikula <jani.nikula@intel.com>
Thu, 28 Aug 2025 12:20:57 +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 200 us sleep for the 5 ms timeout, and 1000 us
sleep for the 500 ms timeout. The timeouts remain the same.

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

index 23745fc99d353c388403f36fd4cc8efb248c0266..c4a5601c51077947a6d3d354e66dfdf7e32f1711 100644 (file)
@@ -3,6 +3,8 @@
  * Copyright © 2019 Intel Corporation
  */
 
+#include <linux/iopoll.h>
+
 #include <drm/drm_print.h>
 
 #include "i915_reg.h"
@@ -1050,8 +1052,13 @@ static bool
 xelpdp_tc_phy_wait_for_tcss_power(struct intel_tc_port *tc, bool enabled)
 {
        struct intel_display *display = to_intel_display(tc->dig_port);
+       bool is_enabled;
+       int ret;
 
-       if (wait_for(xelpdp_tc_phy_tcss_power_is_enabled(tc) == enabled, 5)) {
+       ret = poll_timeout_us(is_enabled = xelpdp_tc_phy_tcss_power_is_enabled(tc),
+                             is_enabled == enabled,
+                             200, 5000, false);
+       if (ret) {
                drm_dbg_kms(display->drm,
                            "Port %s: timeout waiting for TCSS power to get %s\n",
                            str_enabled_disabled(enabled),
@@ -1332,8 +1339,13 @@ static bool tc_phy_is_connected(struct intel_tc_port *tc,
 static bool tc_phy_wait_for_ready(struct intel_tc_port *tc)
 {
        struct intel_display *display = to_intel_display(tc->dig_port);
+       bool is_ready;
+       int ret;
 
-       if (wait_for(tc_phy_is_ready(tc), 500)) {
+       ret = poll_timeout_us(is_ready = tc_phy_is_ready(tc),
+                             is_ready,
+                             1000, 500 * 1000, false);
+       if (ret) {
                drm_err(display->drm, "Port %s: timeout waiting for PHY ready\n",
                        tc->port_name);