On Thu, 2025-08-28 at 15:21 +0300, Jani Nikula wrote:
> 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.
> 
> Signed-off-by: Jani Nikula <[email protected]>

Reviewed-by: Jouni Högander <[email protected]>

> ---
>  drivers/gpu/drm/i915/display/intel_opregion.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_opregion.c
> b/drivers/gpu/drm/i915/display/intel_opregion.c
> index 380314a3b4d9..cbc220310813 100644
> --- a/drivers/gpu/drm/i915/display/intel_opregion.c
> +++ b/drivers/gpu/drm/i915/display/intel_opregion.c
> @@ -28,13 +28,13 @@
>  #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) >>

Reply via email to