[PATCH 0/2] drm/amd/display: Replace NUM_ELEMENTS -> ARRAY_SIZE

From: Linus Probert

Date: Fri Apr 03 2026 - 04:26:09 EST


There's a coccinelle script which attempts to replace cases where sizeof
array is divided by sizeof an element. Most of these occurences have
been handled but a few remained in this driver in the shape of the
NUM_ELEMENTS macro.

In two cases the NUM_ELEMENTS macro has been removed and its use has
been replaced by ARRAY_SIZE. (1)
In 4 files the NUM_ELEMENTS macro existed but was never used so it has
just been removed. (2)

I couldn't trace why these cases hadn't been picked up by the coccinelle
check. Just NAK this if there's a reason for NUM_ELEMENTS to be kept as
is. Thanks.

Linus Probert (2):
drm/amd/display: Replace inline NUM_ELEMENTS macro with ARRAY_SIZE
drm/amd/display: Remove unused NUM_ELEMENTS macros

drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c | 5 +++--
drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c | 6 +++---
drivers/gpu/drm/amd/display/dc/dpp/dcn10/dcn10_dpp_cm.c | 3 ---
drivers/gpu/drm/amd/display/dc/dpp/dcn401/dcn401_dpp_cm.c | 3 ---
drivers/gpu/drm/amd/display/dc/mpc/dcn20/dcn20_mpc.c | 2 --
drivers/gpu/drm/amd/display/dc/mpc/dcn30/dcn30_mpc.c | 4 ----
6 files changed, 6 insertions(+), 17 deletions(-)

--
2.53.0