Re: [PATCH 4/8] usb: typec: ucsi: glink: use le32 for message data

From: Neil Armstrong
Date: Tue Apr 16 2024 - 13:28:49 EST


On 16/04/2024 04:20, Dmitry Baryshkov wrote:
The message structures as transferred by the PMIC_GLINK use le32 for
data encoding. Correct struct accessors to follow the lead of the main
pmic_glink.c driver.

Fixes: 62b5412b1f4a ("usb: typec: ucsi: add PMIC Glink UCSI driver")
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@xxxxxxxxxx>
---
drivers/usb/typec/ucsi/ucsi_glink.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/typec/ucsi/ucsi_glink.c b/drivers/usb/typec/ucsi/ucsi_glink.c
index 6be9d89d4a28..d029cc9d82e3 100644
--- a/drivers/usb/typec/ucsi/ucsi_glink.c
+++ b/drivers/usb/typec/ucsi/ucsi_glink.c
@@ -33,7 +33,7 @@ struct ucsi_read_buf_req_msg {
struct ucsi_read_buf_resp_msg {
struct pmic_glink_hdr hdr;
u8 buf[UCSI_BUF_SIZE];
- u32 ret_code;
+ __le32 ret_code;
};
struct ucsi_write_buf_req_msg {
@@ -44,13 +44,13 @@ struct ucsi_write_buf_req_msg {
struct ucsi_write_buf_resp_msg {
struct pmic_glink_hdr hdr;
- u32 ret_code;
+ __le32 ret_code;
};
struct ucsi_notify_ind_msg {
struct pmic_glink_hdr hdr;
- u32 notification;
- u32 receiver;
+ __le32 notification;
+ __le32 receiver;
u32 reserved;
};
@@ -255,7 +255,7 @@ static void pmic_glink_ucsi_write_ack(struct pmic_glink_ucsi *ucsi, const void *
if (resp->ret_code)
return;
- ucsi->sync_val = resp->ret_code;
+ ucsi->sync_val = le32_to_cpu(resp->ret_code);
complete(&ucsi->write_ack);
}


Reviewed-by: Neil Armstrong <neil.armstrong@xxxxxxxxxx>