Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/amd/display: Replace inline NUM_ELEMENTS macro with ARRAY_SIZE

Replaces the use of local NUM_ELEMENTS macro with the ARRAY_SIZE macro
defined in <linux/array_size.h>.

This aligns with existing coccinelle script array_size.cocci which has
been applied to other sources in order to remove inline
sizeof(a)/sizeof(a[0]) patterns from other source files.

Suggested-by: Robert P. J. Day <rpjday@crashcourse.ca>
Signed-off-by: Linus Probert <linus.probert@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Linus Probert and committed by
Alex Deucher
2d236617 eea85914

+6 -5
+3 -2
drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c
··· 23 23 * 24 24 */ 25 25 26 + #include <linux/array_size.h> 27 + 26 28 #include "dm_services.h" 27 29 #include "core_types.h" 28 30 #include "timing_generator.h" ··· 42 40 #include "dcn10/dcn10_hubbub.h" 43 41 #include "dce/dmub_hw_lock_mgr.h" 44 42 45 - #define NUM_ELEMENTS(a) (sizeof(a) / sizeof((a)[0])) 46 43 #define MAX_NUM_MCACHE 8 47 44 48 45 /* used as index in array of black_color_format */ ··· 231 230 int i; 232 231 enum dc_color_space_type type; 233 232 const uint16_t *val = NULL; 234 - int arr_size = NUM_ELEMENTS(output_csc_matrix); 233 + int arr_size = ARRAY_SIZE(output_csc_matrix); 235 234 236 235 type = get_color_space_type(color_space); 237 236 for (i = 0; i < arr_size; i++)
+3 -3
drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c
··· 23 23 * 24 24 */ 25 25 26 + #include <linux/array_size.h> 27 + 26 28 #include "dm_services.h" 27 29 28 30 ··· 58 56 #define FRACT_FB_DIVIDER_DEC_POINTS_MAX_NUM 6 59 57 #define CALC_PLL_CLK_SRC_ERR_TOLERANCE 1 60 58 #define MAX_PLL_CALC_ERROR 0xFFFFFFFF 61 - 62 - #define NUM_ELEMENTS(a) (sizeof(a) / sizeof((a)[0])) 63 59 64 60 static const struct spread_spectrum_data *get_ss_data_entry( 65 61 struct dce110_clk_src *clk_src, ··· 1271 1271 { 1272 1272 int i; 1273 1273 1274 - for (i = 0; i < NUM_ELEMENTS(video_optimized_pixel_rates); i++) { 1274 + for (i = 0; i < ARRAY_SIZE(video_optimized_pixel_rates); i++) { 1275 1275 const struct pixel_rate_range_table_entry *e = &video_optimized_pixel_rates[i]; 1276 1276 1277 1277 if (e->range_min_khz <= pixel_rate_khz && pixel_rate_khz <= e->range_max_khz) {