mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-09 12:33:18 -04:00
drm/i915/dmc_wl: Use sentinel item for range tables
We are currently using ARRAY_SIZE() to iterate address ranges in intel_dmc_wl_check_range(). In upcoming changes, we will be using more than a single table and will extract the range checking logic into a dedicated function that takes a range table as argument. As we will not able to use ARRAY_SIZE() then, let's make range tables contain a sentinel item at the end and use that instead of having to pass the size as parameter in this future function. 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-7-gustavo.sousa@intel.com
This commit is contained in:
committed by
Matt Roper
parent
7a522aa6cf
commit
1e15bc5bd7
@@ -53,6 +53,7 @@ struct intel_dmc_wl_range {
|
||||
|
||||
static struct intel_dmc_wl_range lnl_wl_range[] = {
|
||||
{ .start = 0x60000, .end = 0x7ffff },
|
||||
{},
|
||||
};
|
||||
|
||||
static void __intel_dmc_wl_release(struct intel_display *display)
|
||||
@@ -104,7 +105,7 @@ static bool intel_dmc_wl_check_range(i915_reg_t reg)
|
||||
bool wl_needed = false;
|
||||
u32 offset = i915_mmio_reg_offset(reg);
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(lnl_wl_range); i++) {
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user