On 2021-12-15 03:54:17, Dmitry Baryshkov wrote: > Use ARRAY_SIZE() instead of manually specifying num_parents. This makes > adding/removing entries to/from parent_data easy and errorproof. > > Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@xxxxxxxxxx> Reviewed-by: Marijn Suijten <marijn.suijten@xxxxxxxxxxxxxx> Patch is good on its own, but it needs to be moved before patch 07/15 to make that patch valid, too. - Marijn > --- > drivers/clk/qcom/camcc-sdm845.c | 50 ++++++++++++++++----------------- > 1 file changed, 25 insertions(+), 25 deletions(-) > > diff --git a/drivers/clk/qcom/camcc-sdm845.c b/drivers/clk/qcom/camcc-sdm845.c > index f5b43dce3295..bc2fb8453911 100644 > --- a/drivers/clk/qcom/camcc-sdm845.c > +++ b/drivers/clk/qcom/camcc-sdm845.c > @@ -187,7 +187,7 @@ static struct clk_rcg2 cam_cc_bps_clk_src = { > .clkr.hw.init = &(struct clk_init_data){ > .name = "cam_cc_bps_clk_src", > .parent_names = cam_cc_parent_names_0, > - .num_parents = 6, > + .num_parents = ARRAY_SIZE(cam_cc_parent_data_0), > .flags = CLK_SET_RATE_PARENT, > .ops = &clk_rcg2_shared_ops, > }, > @@ -210,7 +210,7 @@ static struct clk_rcg2 cam_cc_cci_clk_src = { > .clkr.hw.init = &(struct clk_init_data){ > .name = "cam_cc_cci_clk_src", > .parent_names = cam_cc_parent_names_0, > - .num_parents = 6, > + .num_parents = ARRAY_SIZE(cam_cc_parent_data_0), > .ops = &clk_rcg2_ops, > }, > }; > @@ -230,7 +230,7 @@ static struct clk_rcg2 cam_cc_cphy_rx_clk_src = { > .clkr.hw.init = &(struct clk_init_data){ > .name = "cam_cc_cphy_rx_clk_src", > .parent_names = cam_cc_parent_names_0, > - .num_parents = 6, > + .num_parents = ARRAY_SIZE(cam_cc_parent_data_0), > .ops = &clk_rcg2_ops, > }, > }; > @@ -251,7 +251,7 @@ static struct clk_rcg2 cam_cc_csi0phytimer_clk_src = { > .clkr.hw.init = &(struct clk_init_data){ > .name = "cam_cc_csi0phytimer_clk_src", > .parent_names = cam_cc_parent_names_0, > - .num_parents = 6, > + .num_parents = ARRAY_SIZE(cam_cc_parent_data_0), > .flags = CLK_SET_RATE_PARENT, > .ops = &clk_rcg2_ops, > }, > @@ -266,7 +266,7 @@ static struct clk_rcg2 cam_cc_csi1phytimer_clk_src = { > .clkr.hw.init = &(struct clk_init_data){ > .name = "cam_cc_csi1phytimer_clk_src", > .parent_names = cam_cc_parent_names_0, > - .num_parents = 6, > + .num_parents = ARRAY_SIZE(cam_cc_parent_data_0), > .flags = CLK_SET_RATE_PARENT, > .ops = &clk_rcg2_ops, > }, > @@ -281,7 +281,7 @@ static struct clk_rcg2 cam_cc_csi2phytimer_clk_src = { > .clkr.hw.init = &(struct clk_init_data){ > .name = "cam_cc_csi2phytimer_clk_src", > .parent_names = cam_cc_parent_names_0, > - .num_parents = 6, > + .num_parents = ARRAY_SIZE(cam_cc_parent_data_0), > .flags = CLK_SET_RATE_PARENT, > .ops = &clk_rcg2_ops, > }, > @@ -296,7 +296,7 @@ static struct clk_rcg2 cam_cc_csi3phytimer_clk_src = { > .clkr.hw.init = &(struct clk_init_data){ > .name = "cam_cc_csi3phytimer_clk_src", > .parent_names = cam_cc_parent_names_0, > - .num_parents = 6, > + .num_parents = ARRAY_SIZE(cam_cc_parent_data_0), > .flags = CLK_SET_RATE_PARENT, > .ops = &clk_rcg2_ops, > }, > @@ -321,7 +321,7 @@ static struct clk_rcg2 cam_cc_fast_ahb_clk_src = { > .clkr.hw.init = &(struct clk_init_data){ > .name = "cam_cc_fast_ahb_clk_src", > .parent_names = cam_cc_parent_names_0, > - .num_parents = 6, > + .num_parents = ARRAY_SIZE(cam_cc_parent_data_0), > .ops = &clk_rcg2_ops, > }, > }; > @@ -344,7 +344,7 @@ static struct clk_rcg2 cam_cc_fd_core_clk_src = { > .clkr.hw.init = &(struct clk_init_data){ > .name = "cam_cc_fd_core_clk_src", > .parent_names = cam_cc_parent_names_0, > - .num_parents = 6, > + .num_parents = ARRAY_SIZE(cam_cc_parent_data_0), > .ops = &clk_rcg2_shared_ops, > }, > }; > @@ -367,7 +367,7 @@ static struct clk_rcg2 cam_cc_icp_clk_src = { > .clkr.hw.init = &(struct clk_init_data){ > .name = "cam_cc_icp_clk_src", > .parent_names = cam_cc_parent_names_0, > - .num_parents = 6, > + .num_parents = ARRAY_SIZE(cam_cc_parent_data_0), > .ops = &clk_rcg2_shared_ops, > }, > }; > @@ -391,7 +391,7 @@ static struct clk_rcg2 cam_cc_ife_0_clk_src = { > .clkr.hw.init = &(struct clk_init_data){ > .name = "cam_cc_ife_0_clk_src", > .parent_names = cam_cc_parent_names_0, > - .num_parents = 6, > + .num_parents = ARRAY_SIZE(cam_cc_parent_data_0), > .flags = CLK_SET_RATE_PARENT, > .ops = &clk_rcg2_shared_ops, > }, > @@ -414,7 +414,7 @@ static struct clk_rcg2 cam_cc_ife_0_csid_clk_src = { > .clkr.hw.init = &(struct clk_init_data){ > .name = "cam_cc_ife_0_csid_clk_src", > .parent_names = cam_cc_parent_names_0, > - .num_parents = 6, > + .num_parents = ARRAY_SIZE(cam_cc_parent_data_0), > .ops = &clk_rcg2_shared_ops, > }, > }; > @@ -428,7 +428,7 @@ static struct clk_rcg2 cam_cc_ife_1_clk_src = { > .clkr.hw.init = &(struct clk_init_data){ > .name = "cam_cc_ife_1_clk_src", > .parent_names = cam_cc_parent_names_0, > - .num_parents = 6, > + .num_parents = ARRAY_SIZE(cam_cc_parent_data_0), > .flags = CLK_SET_RATE_PARENT, > .ops = &clk_rcg2_shared_ops, > }, > @@ -443,7 +443,7 @@ static struct clk_rcg2 cam_cc_ife_1_csid_clk_src = { > .clkr.hw.init = &(struct clk_init_data){ > .name = "cam_cc_ife_1_csid_clk_src", > .parent_names = cam_cc_parent_names_0, > - .num_parents = 6, > + .num_parents = ARRAY_SIZE(cam_cc_parent_data_0), > .ops = &clk_rcg2_shared_ops, > }, > }; > @@ -457,7 +457,7 @@ static struct clk_rcg2 cam_cc_ife_lite_clk_src = { > .clkr.hw.init = &(struct clk_init_data){ > .name = "cam_cc_ife_lite_clk_src", > .parent_names = cam_cc_parent_names_0, > - .num_parents = 6, > + .num_parents = ARRAY_SIZE(cam_cc_parent_data_0), > .flags = CLK_SET_RATE_PARENT, > .ops = &clk_rcg2_shared_ops, > }, > @@ -472,7 +472,7 @@ static struct clk_rcg2 cam_cc_ife_lite_csid_clk_src = { > .clkr.hw.init = &(struct clk_init_data){ > .name = "cam_cc_ife_lite_csid_clk_src", > .parent_names = cam_cc_parent_names_0, > - .num_parents = 6, > + .num_parents = ARRAY_SIZE(cam_cc_parent_data_0), > .ops = &clk_rcg2_shared_ops, > }, > }; > @@ -497,7 +497,7 @@ static struct clk_rcg2 cam_cc_ipe_0_clk_src = { > .clkr.hw.init = &(struct clk_init_data){ > .name = "cam_cc_ipe_0_clk_src", > .parent_names = cam_cc_parent_names_0, > - .num_parents = 6, > + .num_parents = ARRAY_SIZE(cam_cc_parent_data_0), > .flags = CLK_SET_RATE_PARENT, > .ops = &clk_rcg2_shared_ops, > }, > @@ -512,7 +512,7 @@ static struct clk_rcg2 cam_cc_ipe_1_clk_src = { > .clkr.hw.init = &(struct clk_init_data){ > .name = "cam_cc_ipe_1_clk_src", > .parent_names = cam_cc_parent_names_0, > - .num_parents = 6, > + .num_parents = ARRAY_SIZE(cam_cc_parent_data_0), > .flags = CLK_SET_RATE_PARENT, > .ops = &clk_rcg2_shared_ops, > }, > @@ -527,7 +527,7 @@ static struct clk_rcg2 cam_cc_jpeg_clk_src = { > .clkr.hw.init = &(struct clk_init_data){ > .name = "cam_cc_jpeg_clk_src", > .parent_names = cam_cc_parent_names_0, > - .num_parents = 6, > + .num_parents = ARRAY_SIZE(cam_cc_parent_data_0), > .flags = CLK_SET_RATE_PARENT, > .ops = &clk_rcg2_shared_ops, > }, > @@ -552,7 +552,7 @@ static struct clk_rcg2 cam_cc_lrme_clk_src = { > .clkr.hw.init = &(struct clk_init_data){ > .name = "cam_cc_lrme_clk_src", > .parent_names = cam_cc_parent_names_0, > - .num_parents = 6, > + .num_parents = ARRAY_SIZE(cam_cc_parent_data_0), > .flags = CLK_SET_RATE_PARENT, > .ops = &clk_rcg2_shared_ops, > }, > @@ -575,7 +575,7 @@ static struct clk_rcg2 cam_cc_mclk0_clk_src = { > .clkr.hw.init = &(struct clk_init_data){ > .name = "cam_cc_mclk0_clk_src", > .parent_names = cam_cc_parent_names_0, > - .num_parents = 6, > + .num_parents = ARRAY_SIZE(cam_cc_parent_data_0), > .flags = CLK_SET_RATE_PARENT, > .ops = &clk_rcg2_ops, > }, > @@ -590,7 +590,7 @@ static struct clk_rcg2 cam_cc_mclk1_clk_src = { > .clkr.hw.init = &(struct clk_init_data){ > .name = "cam_cc_mclk1_clk_src", > .parent_names = cam_cc_parent_names_0, > - .num_parents = 6, > + .num_parents = ARRAY_SIZE(cam_cc_parent_data_0), > .flags = CLK_SET_RATE_PARENT, > .ops = &clk_rcg2_ops, > }, > @@ -605,7 +605,7 @@ static struct clk_rcg2 cam_cc_mclk2_clk_src = { > .clkr.hw.init = &(struct clk_init_data){ > .name = "cam_cc_mclk2_clk_src", > .parent_names = cam_cc_parent_names_0, > - .num_parents = 6, > + .num_parents = ARRAY_SIZE(cam_cc_parent_data_0), > .flags = CLK_SET_RATE_PARENT, > .ops = &clk_rcg2_ops, > }, > @@ -620,7 +620,7 @@ static struct clk_rcg2 cam_cc_mclk3_clk_src = { > .clkr.hw.init = &(struct clk_init_data){ > .name = "cam_cc_mclk3_clk_src", > .parent_names = cam_cc_parent_names_0, > - .num_parents = 6, > + .num_parents = ARRAY_SIZE(cam_cc_parent_data_0), > .flags = CLK_SET_RATE_PARENT, > .ops = &clk_rcg2_ops, > }, > @@ -644,7 +644,7 @@ static struct clk_rcg2 cam_cc_slow_ahb_clk_src = { > .clkr.hw.init = &(struct clk_init_data){ > .name = "cam_cc_slow_ahb_clk_src", > .parent_names = cam_cc_parent_names_0, > - .num_parents = 6, > + .num_parents = ARRAY_SIZE(cam_cc_parent_data_0), > .flags = CLK_SET_RATE_PARENT, > .ops = &clk_rcg2_ops, > }, > -- > 2.33.0 >