From f54d2cfe752e8dbc38c94f246ad98d628d6ce459 Mon Sep 17 00:00:00 2001 From: David Dai Date: Thu, 10 Oct 2019 15:27:54 -0700 Subject: [PATCH] interconnect: qcom: fix up endianness for rpmh messages Fix up le32 and le16 to int errors when converting from le types to cpu. Change-Id: I45b267195210a6ec4f2a4175eddcc541ec081043 Signed-off-by: David Dai --- drivers/interconnect/qcom/bcm-voter.c | 8 ++++---- drivers/interconnect/qcom/icc-rpmh.c | 4 ++-- include/soc/qcom/tcs.h | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/interconnect/qcom/bcm-voter.c b/drivers/interconnect/qcom/bcm-voter.c index 563677ae5452..bfcddf697a50 100644 --- a/drivers/interconnect/qcom/bcm-voter.c +++ b/drivers/interconnect/qcom/bcm-voter.c @@ -61,23 +61,23 @@ 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++) { temp = bcm->nodes[i]->sum_avg[bucket] * - bcm->aux_data.width; + le16_to_cpu(bcm->aux_data.width); do_div(temp, bcm->nodes[i]->buswidth * bcm->nodes[i]->channels); agg_avg[bucket] = max(agg_avg[bucket], temp); temp = bcm->nodes[i]->max_peak[bucket] * - bcm->aux_data.width; + le16_to_cpu(bcm->aux_data.width); do_div(temp, bcm->nodes[i]->buswidth); agg_peak[bucket] = max(agg_peak[bucket], temp); } temp = agg_avg[bucket] * 1000ULL; - do_div(temp, bcm->aux_data.unit); + do_div(temp, le32_to_cpu(bcm->aux_data.unit)); bcm->vote_x[bucket] = temp; temp = agg_peak[bucket] * 1000ULL; - do_div(temp, bcm->aux_data.unit); + do_div(temp, le32_to_cpu(bcm->aux_data.unit)); bcm->vote_y[bucket] = temp; } diff --git a/drivers/interconnect/qcom/icc-rpmh.c b/drivers/interconnect/qcom/icc-rpmh.c index a1741a32ac5f..4b6aecc143ac 100644 --- a/drivers/interconnect/qcom/icc-rpmh.c +++ b/drivers/interconnect/qcom/icc-rpmh.c @@ -127,8 +127,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); diff --git a/include/soc/qcom/tcs.h b/include/soc/qcom/tcs.h index b2014d6af957..23e9b114fd0d 100644 --- a/include/soc/qcom/tcs.h +++ b/include/soc/qcom/tcs.h @@ -66,9 +66,9 @@ struct tcs_request { #define BCM_TCS_CMD(commit, valid, vote_x, vote_y) \ (((commit) << BCM_TCS_CMD_COMMIT_SHFT) | \ ((valid) << BCM_TCS_CMD_VALID_SHFT) | \ - ((cpu_to_le32(vote_x) & \ + ((vote_x & \ BCM_TCS_CMD_VOTE_MASK) << BCM_TCS_CMD_VOTE_X_SHFT) | \ - ((cpu_to_le32(vote_y) & \ + ((vote_y & \ BCM_TCS_CMD_VOTE_MASK) << BCM_TCS_CMD_VOTE_Y_SHFT)) #endif /* __SOC_QCOM_TCS_H__ */