@@ -227,11 +227,9 @@ static void __intel_dmc_wl_take(struct intel_display *display)
wl->taken = true;
}
-static bool intel_dmc_wl_reg_in_range(i915_reg_t reg,
- const struct intel_dmc_wl_range ranges[])
+static bool intel_dmc_wl_offset_in_ranges(u32 offset,
+ const struct intel_dmc_wl_range ranges[])
{
- u32 offset = i915_mmio_reg_offset(reg);
-
for (int i = 0; ranges[i].start; i++) {
u32 end = ranges[i].end ?: ranges[i].start;
@@ -247,6 +245,7 @@ static bool intel_dmc_wl_check_range(struct intel_display *display,
u32 dc_state)
{
const struct intel_dmc_wl_range *ranges;
+ u32 offset = i915_mmio_reg_offset(reg);
if (display->params.enable_dmc_wl == ENABLE_DMC_WL_ANY_REGISTER)
return true;
@@ -255,7 +254,7 @@ static bool intel_dmc_wl_check_range(struct intel_display *display,
* Check that the offset is in one of the ranges for which
* registers are powered off during DC states.
*/
- if (intel_dmc_wl_reg_in_range(reg, powered_off_ranges))
+ if (intel_dmc_wl_offset_in_ranges(offset, powered_off_ranges))
return true;
/*
@@ -274,7 +273,7 @@ static bool intel_dmc_wl_check_range(struct intel_display *display,
ranges = NULL;
}
- if (ranges && intel_dmc_wl_reg_in_range(reg, ranges))
+ if (ranges && intel_dmc_wl_offset_in_ranges(offset, ranges))
return true;
return false;
We will add another function that checks the offset in an upcoming change. Instead of passing the reg variable to only extract the offset later, let's extract the offset before so that we do not need to repeat ourselves. Signed-off-by: Gustavo Sousa <gustavo.sousa@intel.com> --- drivers/gpu/drm/i915/display/intel_dmc_wl.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)