For a consistent way of updating enum intel_display_wa, let's sort it by
lineage number and add a comment asking for future updates to keep it
sorted.

In the same way, let's also keep __intel_display_wa() sorted.

Signed-off-by: Gustavo Sousa <[email protected]>
--
Note: this can be easily reviewed with `git show --color-moved`.
---
 drivers/gpu/drm/i915/display/intel_display_wa.c | 12 ++++++------
 drivers/gpu/drm/i915/display/intel_display_wa.h | 11 ++++++++---
 2 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display_wa.c 
b/drivers/gpu/drm/i915/display/intel_display_wa.c
index a00af39f7538..2b360447e92e 100644
--- a/drivers/gpu/drm/i915/display/intel_display_wa.c
+++ b/drivers/gpu/drm/i915/display/intel_display_wa.c
@@ -62,18 +62,18 @@ static bool intel_display_needs_wa_16025573575(struct 
intel_display *display)
 bool __intel_display_wa(struct intel_display *display, enum intel_display_wa 
wa, const char *name)
 {
        switch (wa) {
+       case INTEL_DISPLAY_WA_14011503117:
+               return DISPLAY_VER(display) == 13;
+       case INTEL_DISPLAY_WA_14025769978:
+               return DISPLAY_VER(display) == 35;
+       case INTEL_DISPLAY_WA_15018326506:
+               return display->platform.battlemage;
        case INTEL_DISPLAY_WA_16023588340:
                return intel_display_needs_wa_16023588340(display);
        case INTEL_DISPLAY_WA_16025573575:
                return intel_display_needs_wa_16025573575(display);
-       case INTEL_DISPLAY_WA_14011503117:
-               return DISPLAY_VER(display) == 13;
        case INTEL_DISPLAY_WA_22014263786:
                return IS_DISPLAY_VERx100(display, 1100, 1400);
-       case INTEL_DISPLAY_WA_15018326506:
-               return display->platform.battlemage;
-       case INTEL_DISPLAY_WA_14025769978:
-               return DISPLAY_VER(display) == 35;
        default:
                drm_WARN(display->drm, 1, "Missing Wa number: %s\n", name);
                break;
diff --git a/drivers/gpu/drm/i915/display/intel_display_wa.h 
b/drivers/gpu/drm/i915/display/intel_display_wa.h
index a68c0bb7e516..56b586e38306 100644
--- a/drivers/gpu/drm/i915/display/intel_display_wa.h
+++ b/drivers/gpu/drm/i915/display/intel_display_wa.h
@@ -21,13 +21,18 @@ static inline bool 
intel_display_needs_wa_16023588340(struct intel_display *disp
 bool intel_display_needs_wa_16023588340(struct intel_display *display);
 #endif
 
+/*
+ * This enum lists display workarounds; each entry here must have a
+ * corresponding case in __intel_display_wa().  Keep both sorted by lineage
+ * number.
+ */
 enum intel_display_wa {
+       INTEL_DISPLAY_WA_14011503117,
+       INTEL_DISPLAY_WA_14025769978,
+       INTEL_DISPLAY_WA_15018326506,
        INTEL_DISPLAY_WA_16023588340,
        INTEL_DISPLAY_WA_16025573575,
-       INTEL_DISPLAY_WA_14011503117,
        INTEL_DISPLAY_WA_22014263786,
-       INTEL_DISPLAY_WA_15018326506,
-       INTEL_DISPLAY_WA_14025769978,
 };
 
 bool __intel_display_wa(struct intel_display *display, enum intel_display_wa 
wa, const char *name);

-- 
2.52.0

Reply via email to