Message ID | 20240416-ucsi-glink-altmode-v1-4-890db00877ac@linaro.org |
---|---|
State | New |
Headers | show |
Series | usb: typec: ucsi: glink: merge in altmode support | expand |
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@linaro.org> > --- > 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@linaro.org>
On Tue, Apr 16, 2024 at 05:20:53AM +0300, 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@linaro.org> Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> > --- > 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); > } > > > -- > 2.39.2
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); }
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@linaro.org> --- drivers/usb/typec/ucsi/ucsi_glink.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)