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

memory: mtk-smi: Use ARRAY_SIZE to define MTK_SMI_CLK_NR_MAX

This definition is tied to the number of SMI common clocks (the array
mtk_smi_common_clks): improve the definition by using the ARRAY_SIZE
macro instead. That will also reduce room for mistakes when updating
the aforementioned array in the future.

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Reviewed-by: Yong Wu <yong.wu@mediatek.com>
Link: https://lore.kernel.org/r/20211015151557.510726-1-angelogioacchino.delregno@collabora.com
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>

authored by

AngeloGioacchino Del Regno and committed by
Krzysztof Kozlowski
205e1776 e783362e

+1 -2
+1 -2
drivers/memory/mtk-smi.c
··· 94 94 MTK_SMI_GEN2_SUB_COMM, /* gen2 smi sub common */ 95 95 }; 96 96 97 - #define MTK_SMI_CLK_NR_MAX 4 98 - 99 97 /* larbs: Require apb/smi clocks while gals is optional. */ 100 98 static const char * const mtk_smi_larb_clks[] = {"apb", "smi", "gals"}; 101 99 #define MTK_SMI_LARB_REQ_CLK_NR 2 ··· 104 106 * sub common: Require apb/smi/gals0 clocks in has_gals case. Otherwise, only apb/smi are required. 105 107 */ 106 108 static const char * const mtk_smi_common_clks[] = {"apb", "smi", "gals0", "gals1"}; 109 + #define MTK_SMI_CLK_NR_MAX ARRAY_SIZE(mtk_smi_common_clks) 107 110 #define MTK_SMI_COM_REQ_CLK_NR 2 108 111 #define MTK_SMI_COM_GALS_REQ_CLK_NR MTK_SMI_CLK_NR_MAX 109 112 #define MTK_SMI_SUB_COM_GALS_REQ_CLK_NR 3