From: Pan Li <incarnation.p.lee@xxxxxxxxxxx> Makes header access happy by shared the memory between __le16 and u16. Signed-off-by: Pan Li <incarnation.p.lee@xxxxxxxxxxx> --- drivers/staging/typec/pd.h | 5 +++++ drivers/staging/typec/tcpci.c | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/staging/typec/pd.h b/drivers/staging/typec/pd.h index b85c0ab..244a6e9 100644 --- a/drivers/staging/typec/pd.h +++ b/drivers/staging/typec/pd.h @@ -117,6 +117,11 @@ static inline void pd_message_header_set(struct pd_message *msg, u16 header) msg->header_u16 = header; } +static inline u16 pd_message_header(struct pd_message *msg) +{ + return msg->header_u16; +} + /* PDO: Power Data Object */ #define PDO_MAX_OBJECTS 7 diff --git a/drivers/staging/typec/tcpci.c b/drivers/staging/typec/tcpci.c index 8437ea1..9a74a3d 100644 --- a/drivers/staging/typec/tcpci.c +++ b/drivers/staging/typec/tcpci.c @@ -283,7 +283,8 @@ static int tcpci_pd_transmit(struct tcpc_dev *tcpc, const struct pd_message *msg) { struct tcpci *tcpci = tcpc_to_tcpci(tcpc); - unsigned int reg, cnt, header; + unsigned int reg, cnt; + u16 header; int ret; cnt = msg ? pd_header_cnt_le(msg->header) * 4 : 0; @@ -291,7 +292,7 @@ static int tcpci_pd_transmit(struct tcpc_dev *tcpc, if (ret < 0) return ret; - header = msg ? msg->header : 0; + header = msg ? pd_message_header(msg) : 0; ret = tcpci_write16(tcpci, TCPC_TX_HDR, header); if (ret < 0) return ret; -- 1.9.1 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel