]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/i915/opregion: use generic poll_timeout_us() instead of wait_for()
authorJani Nikula <jani.nikula@intel.com>
Thu, 28 Aug 2025 12:21:00 +0000 (15:21 +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 1 ms sleep instead. The timeout remains, being
opregion defined, 50 ms by default, and 1500 ms at most.

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

index 380314a3b4d9cb5a3854b401b8c7329032503733..cbc220310813d3b204696299677ff24381e0fe26 100644 (file)
 #include <linux/acpi.h>
 #include <linux/debugfs.h>
 #include <linux/dmi.h>
+#include <linux/iopoll.h>
 #include <acpi/video.h>
 
 #include <drm/drm_edid.h>
 #include <drm/drm_file.h>
 #include <drm/drm_print.h>
 
-#include "i915_utils.h"
 #include "intel_acpi.h"
 #include "intel_backlight.h"
 #include "intel_display_core.h"
@@ -357,10 +357,12 @@ static int swsci(struct intel_display *display,
        pci_write_config_word(pdev, SWSCI, swsci_val);
 
        /* Poll for the result. */
-#define C (((scic = swsci->scic) & SWSCI_SCIC_INDICATOR) == 0)
-       if (wait_for(C, dslp)) {
+       ret = poll_timeout_us(scic = swsci->scic,
+                             (scic & SWSCI_SCIC_INDICATOR) == 0,
+                             1000, dslp * 1000, false);
+       if (ret) {
                drm_dbg(display->drm, "SWSCI request timed out\n");
-               return -ETIMEDOUT;
+               return ret;
        }
 
        scic = (scic & SWSCI_SCIC_EXIT_STATUS_MASK) >>