Re: [PATCH 3/4] interconnect: qcom: icc-rpm: Make simple functions return void

From: Mike Tipton
Date: Tue May 07 2024 - 21:57:47 EST


On Tue, Mar 26, 2024 at 08:42:34PM +0100, Konrad Dybcio wrote:
> Register accesses can't just randomly fail. Change the return type of
> functions that only do that to void.
>
> Signed-off-by: Konrad Dybcio <konrad.dybcio@xxxxxxxxxx>
> ---
> drivers/interconnect/qcom/icc-rpm.c | 110 +++++++++++++++---------------------
> 1 file changed, 47 insertions(+), 63 deletions(-)
>

[...]

> @@ -115,48 +111,42 @@ static int qcom_icc_set_bimc_qos(struct icc_node *src)
> * only if we are NOT in Bypass Mode.
> */
> if (mode != NOC_QOS_MODE_BYPASS) {
> - for (i = 3; i >= 0; i--) {
> - rc = qcom_icc_bimc_set_qos_health(qp,
> - &qn->qos, i);
> - if (rc)
> - return rc;
> - }
> + qcom_icc_bimc_set_qos_health(qp, &qn->qos, 3);
> + qcom_icc_bimc_set_qos_health(qp, &qn->qos, 2);
> + qcom_icc_bimc_set_qos_health(qp, &qn->qos, 1);
> + qcom_icc_bimc_set_qos_health(qp, &qn->qos, 0);

Not sure I see the point of unrolling this loop. With the error checking
removed, the loop could be reduced to just two lines, which is shorter
than the unrolled version and isn't really any more complicated:

for (i = 3; i >= 0; i--)
qcom_icc_bimc_set_qos_health(qp, &qn->qos, i);

Unrolling the loop is also slightly out-of-scope for this patch that
claims to just change the return types.

Otherwise, patch looks good to me.