drm/i915/dmc_wl: Extract intel_dmc_wl_reg_in_range()

We will be using more than one range table in
intel_dmc_wl_check_range(). As such, move the logic to a new function
and name it intel_dmc_wl_reg_in_range().

Reviewed-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Gustavo Sousa <gustavo.sousa@intel.com>
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20241108130218.24125-8-gustavo.sousa@intel.com
This commit is contained in:
Gustavo Sousa
2024-11-08 09:57:12 -03:00
committed by Matt Roper
parent 1e15bc5bd7
commit 83329df1be

View File

@@ -99,21 +99,22 @@ static void intel_dmc_wl_work(struct work_struct *work)
spin_unlock_irqrestore(&wl->lock, flags);
}
static bool intel_dmc_wl_check_range(i915_reg_t reg)
static bool intel_dmc_wl_reg_in_range(i915_reg_t reg,
const struct intel_dmc_wl_range ranges[])
{
int i;
bool wl_needed = false;
u32 offset = i915_mmio_reg_offset(reg);
for (i = 0; lnl_wl_range[i].start; i++) {
if (offset >= lnl_wl_range[i].start &&
offset <= lnl_wl_range[i].end) {
wl_needed = true;
break;
}
for (int i = 0; ranges[i].start; i++) {
if (ranges[i].start <= offset && offset <= ranges[i].end)
return true;
}
return wl_needed;
return false;
}
static bool intel_dmc_wl_check_range(i915_reg_t reg)
{
return intel_dmc_wl_reg_in_range(reg, lnl_wl_range);
}
static bool __intel_dmc_wl_supported(struct intel_display *display)