mirror of
https://github.com/torvalds/linux.git
synced 2026-05-28 17:13:52 +02:00
soc: qcom: fix endianness for QMI header
The members of QMI header have to be swapped on big endian platforms. Use __le16 types instead of u16 ones. Signed-off-by: Alexander Wilhelm <alexander.wilhelm@westermo.com> Fixes:9b8a11e826("soc: qcom: Introduce QMI encoder/decoder") Fixes:3830d0771e("soc: qcom: Introduce QMI helpers") Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com> Link: https://lore.kernel.org/r/20250522143530.3623809-3-alexander.wilhelm@westermo.com Signed-off-by: Bjorn Andersson <andersson@kernel.org>
This commit is contained in:
parent
3ced38da5f
commit
07a4688833
|
|
@ -776,9 +776,9 @@ void *qmi_encode_message(int type, unsigned int msg_id, size_t *len,
|
|||
|
||||
hdr = msg;
|
||||
hdr->type = type;
|
||||
hdr->txn_id = txn_id;
|
||||
hdr->msg_id = msg_id;
|
||||
hdr->msg_len = msglen;
|
||||
hdr->txn_id = cpu_to_le16(txn_id);
|
||||
hdr->msg_id = cpu_to_le16(msg_id);
|
||||
hdr->msg_len = cpu_to_le16(msglen);
|
||||
|
||||
*len = sizeof(*hdr) + msglen;
|
||||
|
||||
|
|
|
|||
|
|
@ -400,7 +400,7 @@ static void qmi_invoke_handler(struct qmi_handle *qmi, struct sockaddr_qrtr *sq,
|
|||
|
||||
for (handler = qmi->handlers; handler->fn; handler++) {
|
||||
if (handler->type == hdr->type &&
|
||||
handler->msg_id == hdr->msg_id)
|
||||
handler->msg_id == le16_to_cpu(hdr->msg_id))
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -488,7 +488,7 @@ static void qmi_handle_message(struct qmi_handle *qmi,
|
|||
/* If this is a response, find the matching transaction handle */
|
||||
if (hdr->type == QMI_RESPONSE) {
|
||||
mutex_lock(&qmi->txn_lock);
|
||||
txn = idr_find(&qmi->txns, hdr->txn_id);
|
||||
txn = idr_find(&qmi->txns, le16_to_cpu(hdr->txn_id));
|
||||
|
||||
/* Ignore unexpected responses */
|
||||
if (!txn) {
|
||||
|
|
@ -514,7 +514,7 @@ static void qmi_handle_message(struct qmi_handle *qmi,
|
|||
} else {
|
||||
/* Create a txn based on the txn_id of the incoming message */
|
||||
memset(&tmp_txn, 0, sizeof(tmp_txn));
|
||||
tmp_txn.id = hdr->txn_id;
|
||||
tmp_txn.id = le16_to_cpu(hdr->txn_id);
|
||||
|
||||
qmi_invoke_handler(qmi, sq, &tmp_txn, buf, len);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,9 +24,9 @@ struct socket;
|
|||
*/
|
||||
struct qmi_header {
|
||||
u8 type;
|
||||
u16 txn_id;
|
||||
u16 msg_id;
|
||||
u16 msg_len;
|
||||
__le16 txn_id;
|
||||
__le16 msg_id;
|
||||
__le16 msg_len;
|
||||
} __packed;
|
||||
|
||||
#define QMI_REQUEST 0
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user