Linux ARM-MSM sub-architecture
 help / color / mirror / Atom feed
From: Bjorn Andersson <bjorn.andersson@linaro.org>
To: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>
Cc: Georgi Djakov <djakov@kernel.org>, Andy Gross <agross@kernel.org>,
	linux-arm-msm@vger.kernel.org
Subject: Re: [PATCH] interconnect: qcom: Fix endianness in an intermediate storage
Date: Thu, 30 Sep 2021 10:47:00 -0700	[thread overview]
Message-ID: <YVX4FMMwLA/jdDPw@ripper> (raw)
In-Reply-To: <20210930122254.8899-1-vladimir.zapolskiy@linaro.org>

On Thu 30 Sep 05:22 PDT 2021, Vladimir Zapolskiy wrote:

> A minor issue is reported by sparse:
> 
> bcm-voter.c:72:77: warning: restricted __le16 degrades to integer
> bcm-voter.c:76:78: warning: restricted __le16 degrades to integer
> bcm-voter.c:82:66: warning: incorrect type in argument 2 (different base types)
> bcm-voter.c:82:66:    expected unsigned int [usertype] base
> bcm-voter.c:82:66:    got restricted __le32 [usertype] unit
> bcm-voter.c:85:66: warning: incorrect type in argument 2 (different base types)
> bcm-voter.c:85:66:    expected unsigned int [usertype] base
> bcm-voter.c:85:66:    got restricted __le32 [usertype] unit
> 
> icc-rpmh.c:165:28: warning: incorrect type in assignment (different base types)
> icc-rpmh.c:165:28:    expected restricted __le32 [usertype] unit
> icc-rpmh.c:165:28:    got unsigned int [usertype]
> icc-rpmh.c:166:29: warning: incorrect type in assignment (different base types)
> icc-rpmh.c:166:29:    expected restricted __le16 [usertype] width
> icc-rpmh.c:166:29:    got unsigned short [usertype]
> 
> The change is intended to be non-functional, only the stored data of
> 'struct bcm_db' is changed and build time warnings from above are gone.
> 

Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>

Regards,
Bjorn

> Signed-off-by: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>
> ---
>  drivers/interconnect/qcom/bcm-voter.c | 8 ++++----
>  drivers/interconnect/qcom/icc-rpmh.c  | 4 ++--
>  2 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/interconnect/qcom/bcm-voter.c b/drivers/interconnect/qcom/bcm-voter.c
> index 8f385f9c2dd3..976938a84bd1 100644
> --- a/drivers/interconnect/qcom/bcm-voter.c
> +++ b/drivers/interconnect/qcom/bcm-voter.c
> @@ -69,20 +69,20 @@ static void bcm_aggregate(struct qcom_icc_bcm *bcm)
>  	for (bucket = 0; bucket < QCOM_ICC_NUM_BUCKETS; bucket++) {
>  		for (i = 0; i < bcm->num_nodes; i++) {
>  			node = bcm->nodes[i];
> -			temp = bcm_div(node->sum_avg[bucket] * bcm->aux_data.width,
> +			temp = bcm_div(node->sum_avg[bucket] * le16_to_cpu(bcm->aux_data.width),
>  				       node->buswidth * node->channels);
>  			agg_avg[bucket] = max(agg_avg[bucket], temp);
>  
> -			temp = bcm_div(node->max_peak[bucket] * bcm->aux_data.width,
> +			temp = bcm_div(node->max_peak[bucket] * le16_to_cpu(bcm->aux_data.width),
>  				       node->buswidth);
>  			agg_peak[bucket] = max(agg_peak[bucket], temp);
>  		}
>  
>  		temp = agg_avg[bucket] * bcm->vote_scale;
> -		bcm->vote_x[bucket] = bcm_div(temp, bcm->aux_data.unit);
> +		bcm->vote_x[bucket] = bcm_div(temp, le32_to_cpu(bcm->aux_data.unit));
>  
>  		temp = agg_peak[bucket] * bcm->vote_scale;
> -		bcm->vote_y[bucket] = bcm_div(temp, bcm->aux_data.unit);
> +		bcm->vote_y[bucket] = bcm_div(temp, le32_to_cpu(bcm->aux_data.unit));
>  	}
>  
>  	if (bcm->keepalive && bcm->vote_x[QCOM_ICC_BUCKET_AMC] == 0 &&
> diff --git a/drivers/interconnect/qcom/icc-rpmh.c b/drivers/interconnect/qcom/icc-rpmh.c
> index 3eb7936d2cf6..e8533027ce38 100644
> --- a/drivers/interconnect/qcom/icc-rpmh.c
> +++ b/drivers/interconnect/qcom/icc-rpmh.c
> @@ -162,8 +162,8 @@ int qcom_icc_bcm_init(struct qcom_icc_bcm *bcm, struct device *dev)
>  		return -EINVAL;
>  	}
>  
> -	bcm->aux_data.unit = le32_to_cpu(data->unit);
> -	bcm->aux_data.width = le16_to_cpu(data->width);
> +	bcm->aux_data.unit = data->unit;
> +	bcm->aux_data.width = data->width;
>  	bcm->aux_data.vcd = data->vcd;
>  	bcm->aux_data.reserved = data->reserved;
>  	INIT_LIST_HEAD(&bcm->list);
> -- 
> 2.33.0
> 

  reply	other threads:[~2021-09-30 17:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-30 12:22 [PATCH] interconnect: qcom: Fix endianness in an intermediate storage Vladimir Zapolskiy
2021-09-30 17:47 ` Bjorn Andersson [this message]
2021-10-04 12:29 ` Georgi Djakov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YVX4FMMwLA/jdDPw@ripper \
    --to=bjorn.andersson@linaro.org \
    --cc=agross@kernel.org \
    --cc=djakov@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=vladimir.zapolskiy@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox