UPSTREAM: firmware: arm_scmi: Avoid padding in sensor message structure
scmi_resp_sensor_reading_complete structure is meant to represent an SCMI asynchronous reading complete message. The readings field with a 64bit type forces padding and breaks reads in scmi_sensor_reading_get. Split it in two adjacent 32bit readings_low/high subfields to avoid the padding within the structure. Alternatively we could to mark the structure packed. Link: https://lore.kernel.org/r/20210628170042.34105-1-cristian.marussi@arm.com Fixes: e2083d3673916 ("firmware: arm_scmi: Add SCMI v3.0 sensors timestamped reads") Signed-off-by: Cristian Marussi <cristian.marussi@arm.com> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com> (cherry picked from commit 187a002b07e8089f0b5657eafec50b5d05625569) Bug: 187129171 Signed-off-by: Connor O'Brien <connoro@google.com> Change-Id: Iac7e24f178da3486df742a76280c3a9a85d130e7
This commit is contained in:
parent
ea6f697c3d
commit
1e8a0d84dc
@ -166,7 +166,8 @@ struct scmi_msg_sensor_reading_get {
|
||||
|
||||
struct scmi_resp_sensor_reading_complete {
|
||||
__le32 id;
|
||||
__le64 readings;
|
||||
__le32 readings_low;
|
||||
__le32 readings_high;
|
||||
};
|
||||
|
||||
struct scmi_sensor_reading_resp {
|
||||
@ -717,7 +718,8 @@ static int scmi_sensor_reading_get(const struct scmi_protocol_handle *ph,
|
||||
|
||||
resp = t->rx.buf;
|
||||
if (le32_to_cpu(resp->id) == sensor_id)
|
||||
*value = get_unaligned_le64(&resp->readings);
|
||||
*value =
|
||||
get_unaligned_le64(&resp->readings_low);
|
||||
else
|
||||
ret = -EPROTO;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user