mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
interconnect: qcom: fix endian annotations of BCM aux data
struct qcom_icc_bcm::aux_data keeps a copy of the struct bcm_db read from the command db, whose unit and width fields are annotated as __le32/__le16 to describe the little-endian on-disk format. Using those restricted types directly in bandwidth calculations makes sparse complain about endianness. Keep aux_data typed as struct bcm_db, copied verbatim from the command db buffer, and convert the fields with le32_to_cpu()/le16_to_cpu() at the places where unit and width are used. No functional change. Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all/202609221350.3Y8MOce9-lkp@intel.com/ Assisted-by: LLM Signed-off-by: Rosen Penev <rosenp@gmail.com> Link: https://patch.msgid.link/20260923185059.25196-1-rosenp@gmail.com Signed-off-by: Georgi Djakov <djakov@kernel.org>
This commit is contained in:
parent
e0667aa9c6
commit
cdffc9152b
|
|
@ -99,20 +99,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 &&
|
||||
|
|
|
|||
|
|
@ -166,19 +166,19 @@ static int qcom_icc_get_bw(struct icc_node *node, u32 *avg, u32 *peak)
|
|||
peak_max = INT_MAX;
|
||||
} else {
|
||||
if (x) {
|
||||
x *= bcm->aux_data.unit;
|
||||
x *= le32_to_cpu(bcm->aux_data.unit);
|
||||
do_div(x, bcm->vote_scale);
|
||||
x *= qn->buswidth * qn->channels;
|
||||
do_div(x, bcm->aux_data.width);
|
||||
do_div(x, le16_to_cpu(bcm->aux_data.width));
|
||||
|
||||
avg_max = max(avg_max, x);
|
||||
}
|
||||
|
||||
if (y) {
|
||||
y *= bcm->aux_data.unit;
|
||||
y *= le32_to_cpu(bcm->aux_data.unit);
|
||||
do_div(y, bcm->vote_scale);
|
||||
y *= qn->buswidth;
|
||||
do_div(y, bcm->aux_data.width);
|
||||
do_div(y, le16_to_cpu(bcm->aux_data.width));
|
||||
|
||||
peak_max = max(peak_max, y);
|
||||
}
|
||||
|
|
@ -228,10 +228,7 @@ 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.vcd = data->vcd;
|
||||
bcm->aux_data.reserved = data->reserved;
|
||||
bcm->aux_data = *data;
|
||||
INIT_LIST_HEAD(&bcm->list);
|
||||
INIT_LIST_HEAD(&bcm->ws_list);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user