Re: [PATCH 2/2] drm/amd/display: Remove unused NUM_ELEMENTS macros

Alex Deucher
2026-04-03T13:58:41Z

Applied the series. Thanks!

On Fri, Apr 3, 2026 at 5:29 AM Linus Probert <linus.probert@gmail.com> wrote:
>
> Removes unused NUM_ELEMENTS macros. Discovered while removing cases
> where ARRAY_SIZE from the header <linus/array_size.h> can be used.
> This also aligns with the array_size.cocci coccinelle check.
>
> Suggested-by: Robert P. J. Day <rpjday@crashcourse.ca>
> Signed-off-by: Linus Probert <linus.probert@gmail.com>
> ---
> 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 ----
> 4 files changed, 12 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/display/dc/dpp/dcn10/dcn10_dpp_cm.c b/drivers/gpu/drm/amd/display/dc/dpp/dcn10/dcn10_dpp_cm.c
> index f8f6019d8304..2bdd063cc1e1 100644
> --- a/drivers/gpu/drm/amd/display/dc/dpp/dcn10/dcn10_dpp_cm.c
> +++ b/drivers/gpu/drm/amd/display/dc/dpp/dcn10/dcn10_dpp_cm.c
> @@ -49,9 +49,6 @@
> #define FN(reg_name, field_name) \
> dpp->tf_shift->field_name, dpp->tf_mask->field_name
>
> -#define NUM_ELEMENTS(a) (sizeof(a) / sizeof((a)[0]))
> -
> -
> enum dcn10_coef_filter_type_sel {
> SCL_COEF_LUMA_VERT_FILTER = 0,
> SCL_COEF_LUMA_HORZ_FILTER = 1,
> diff --git a/drivers/gpu/drm/amd/display/dc/dpp/dcn401/dcn401_dpp_cm.c b/drivers/gpu/drm/amd/display/dc/dpp/dcn401/dcn401_dpp_cm.c
> index 62bf7cea21d8..7b7a0c660d47 100644
> --- a/drivers/gpu/drm/amd/display/dc/dpp/dcn401/dcn401_dpp_cm.c
> +++ b/drivers/gpu/drm/amd/display/dc/dpp/dcn401/dcn401_dpp_cm.c
> @@ -49,9 +49,6 @@
> #define FN(reg_name, field_name) \
> dpp->tf_shift->field_name, dpp->tf_mask->field_name
>
> -#define NUM_ELEMENTS(a) (sizeof(a) / sizeof((a)[0]))
> -
> -
> enum dcn401_coef_filter_type_sel {
> SCL_COEF_LUMA_VERT_FILTER = 0,
> SCL_COEF_LUMA_HORZ_FILTER = 1,
> diff --git a/drivers/gpu/drm/amd/display/dc/mpc/dcn20/dcn20_mpc.c b/drivers/gpu/drm/amd/display/dc/mpc/dcn20/dcn20_mpc.c
> index ea73473b970a..fa600593f4c1 100644
> --- a/drivers/gpu/drm/amd/display/dc/mpc/dcn20/dcn20_mpc.c
> +++ b/drivers/gpu/drm/amd/display/dc/mpc/dcn20/dcn20_mpc.c
> @@ -43,8 +43,6 @@
> #define FN(reg_name, field_name) \
> mpc20->mpc_shift->field_name, mpc20->mpc_mask->field_name
>
> -#define NUM_ELEMENTS(a) (sizeof(a) / sizeof((a)[0]))
> -
> void mpc2_update_blending(
> struct mpc *mpc,
> struct mpcc_blnd_cfg *blnd_cfg,
> diff --git a/drivers/gpu/drm/amd/display/dc/mpc/dcn30/dcn30_mpc.c b/drivers/gpu/drm/amd/display/dc/mpc/dcn30/dcn30_mpc.c
> index 6bfd2c1294e5..ec2181d9f20b 100644
> --- a/drivers/gpu/drm/amd/display/dc/mpc/dcn30/dcn30_mpc.c
> +++ b/drivers/gpu/drm/amd/display/dc/mpc/dcn30/dcn30_mpc.c
> @@ -40,10 +40,6 @@
> #define FN(reg_name, field_name) \
> mpc30->mpc_shift->field_name, mpc30->mpc_mask->field_name
>
> -
> -#define NUM_ELEMENTS(a) (sizeof(a) / sizeof((a)[0]))
> -
> -
> void mpc3_mpc_init(struct mpc *mpc)
> {
> struct dcn30_mpc *mpc30 = TO_DCN30_MPC(mpc);
> --
> 2.53.0
>