interconnect: qcom: fix endian annotations of BCM aux data
Subsystems (2)
PATCH 1/1 interconnect: qcom: fix endian annotations of BCM aux data
struct qcom_icc_bcm::aux_data stores the values parsed from the command db, converted to native byte order, but is typed as the raw little-endian struct bcm_db. Sparse therefore complains when the converted values are assigned to the __le32/__le16 fields and when those restricted fields are used in bandwidth calculations.
Give aux_data its own native-endian struct type so the parsed values are stored with matching annotations, keeping struct bcm_db as the on-disk format returned by cmd_db_read_aux_data(). No functional change.
--- drivers/interconnect/qcom/icc-rpmh.h | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-)
drivers/interconnect/qcom/icc-rpmh.h +18 -1
@@ -45,6 +45,9 @@ struct qcom_icc_provider {* @width: multiplier used to convert bytes/sec bw value to an RPMh msg * @vcd: virtual clock domain that this bcm belongs to * @reserved: reserved field +* +* This is the little-endian on-disk format returned by +* cmd_db_read_aux_data(). */ struct bcm_db {__le32 unit;
@@ -53,6 +56,20 @@ struct bcm_db {u8 reserved; }; +/** +* struct bcm_aux_data - Auxiliary data of a BCM in native byte order +* @unit: divisor used to convert bytes/sec bw value to an RPMh msg +* @width: multiplier used to convert bytes/sec bw value to an RPMh msg +* @vcd: virtual clock domain that this bcm belongs to +* @reserved: reserved field +*/ +struct bcm_aux_data { +u32 unit; +u16 width; +u8 vcd; +u8 reserved; +}; +#define MAX_PORTS 4/**
@@ -135,7 +152,7 @@ struct qcom_icc_bcm {u32 enable_mask;bool dirty;bool keepalive; -struct bcm_db aux_data; +struct bcm_aux_data aux_data;struct list_head list;struct list_head ws_list;size_t num_nodes;
Signature · 1 line
2.55.0
Quoted 5 lines · Rosen Penev
struct
qcom_icc_bcm::aux_datastores the values parsed from the command db, converted to native byte order, but is typed as the raw little-endian structbcm_db. Sparse therefore complains when the converted values are assigned to the __le32/__le16 fields and when those restricted fields are used in bandwidth calculations.
This should be fixed by using cpu_to_leXX()/leXX_to_cpu() when accessing these fields instead
Konrad