Re: [PATCH v10 1/6] interconnect: icc-clk: Allow user to specify master/slave ids

From: Varadarajan Narayanan
Date: Tue Apr 30 2024 - 02:30:38 EST


On Mon, Apr 29, 2024 at 12:08:40PM +0100, Bryan O'Donoghue wrote:
> On 29/04/2024 10:13, Varadarajan Narayanan wrote:
> > for (i = 0, j = 0; i < num_clocks; i++) {
> > qp->clocks[i].clk = data[i].clk;
> > - node = icc_node_create(first_id + j);
> > + node = icc_node_create(first_id + data[i].master_id);
>
> You have a few conditionals in the way down the end of the existing for()
> loop but then you hit this
>
> onecell->nodes[j++] = node;
> }
>
> which means that this
>
> node = icc_node_create(first_id + data[i].master_id);
>
> is not analogous to this
>
> node = icc_node_create(first_id + j);
>
> So for any loop of this for() where j was incremented previously you would
> not _not_ have the same node ids after your change.
>
> In other words dropping the j index will result in different node numbering.
>
> Is that
>
> a) intended

Yes.

> b) correct

Currently, drivers/clk/qcom/clk-cbf-8996.c is the only user of
icc-clk. And, it had exactly one master and one slave node.
For this the auto generated master (= 1) and slave (= 0) was
enough.

However, when drivers/clk/qcom/gcc-ipq9574.c wanted to make use
of the icc-clk framework, it had more number of master and slave
nodes and the auto generated ids did not suit the usage.

Hence wanted to move away from the auto generated method. And
instead use the ids specified by the caller.

> and slave ids" which it does but it _also_ changes the autogenerated ids.
>
> So could you either a) fix that or b) justify it, in your commit log.

Will change the commit log and post a new version.

> Also I think the 8996 specific change should be in its own patch.

Earlier it was separate. Was squashed into this based on
community feedback. Please refer to https://lore.kernel.org/linux-arm-msm/CAA8EJpqaXU=H6Nhz2_WTYHS1A0bi1QrMdp7Y+s6HUELioCzbeg@xxxxxxxxxxxxxx/

> TBH I'm not sure the autogen change is on-purpose or warranted and for
> certain the commit log is not elucidating on which is the intended case.
>
> I think you should rewrite this patch in two ways
>
> 1. Fix the autogen case or
> 1. Justify the change for the autogen case.
> 2. Separate drivers/clk/qcom/clk-cbf-8996.c into its own patch that
> applies directly after changing the core
>
> Perhaps you've already gone through this debate with other reviewers but
> then you haven't captured that in your cover letter or commit log so at a
> minimum, please do that.

Will update the commit log and post a new version.

Thanks for the inputs.
-Varada