Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/i915/tc: use generic poll_timeout_us() instead of wait_for()

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>

+14 -2
+14 -2
drivers/gpu/drm/i915/display/intel_tc.c
··· 3 3 * Copyright © 2019 Intel Corporation 4 4 */ 5 5 6 + #include <linux/iopoll.h> 7 + 6 8 #include <drm/drm_print.h> 7 9 8 10 #include "i915_reg.h" ··· 1052 1050 xelpdp_tc_phy_wait_for_tcss_power(struct intel_tc_port *tc, bool enabled) 1053 1051 { 1054 1052 struct intel_display *display = to_intel_display(tc->dig_port); 1053 + bool is_enabled; 1054 + int ret; 1055 1055 1056 - if (wait_for(xelpdp_tc_phy_tcss_power_is_enabled(tc) == enabled, 5)) { 1056 + ret = poll_timeout_us(is_enabled = xelpdp_tc_phy_tcss_power_is_enabled(tc), 1057 + is_enabled == enabled, 1058 + 200, 5000, false); 1059 + if (ret) { 1057 1060 drm_dbg_kms(display->drm, 1058 1061 "Port %s: timeout waiting for TCSS power to get %s\n", 1059 1062 str_enabled_disabled(enabled), ··· 1339 1332 static bool tc_phy_wait_for_ready(struct intel_tc_port *tc) 1340 1333 { 1341 1334 struct intel_display *display = to_intel_display(tc->dig_port); 1335 + bool is_ready; 1336 + int ret; 1342 1337 1343 - if (wait_for(tc_phy_is_ready(tc), 500)) { 1338 + ret = poll_timeout_us(is_ready = tc_phy_is_ready(tc), 1339 + is_ready, 1340 + 1000, 500 * 1000, false); 1341 + if (ret) { 1344 1342 drm_err(display->drm, "Port %s: timeout waiting for PHY ready\n", 1345 1343 tc->port_name); 1346 1344