Re: [PATCH 2/3] staging: typec: add tcpci_read16_le.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 06/19/2017 03:11 AM, ? ? wrote:
From: Pan Li <incarnation.p.lee@xxxxxxxxxxx>

Add tcpci_read16_le for pd_message header type __le16.
> Signed-off-by: Pan Li <incarnation.p.lee@xxxxxxxxxxx>
---
  drivers/staging/typec/tcpci.c | 15 ++++++++++-----
  1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/typec/tcpci.c b/drivers/staging/typec/tcpci.c
index 2adb543..8da4a38 100644
--- a/drivers/staging/typec/tcpci.c
+++ b/drivers/staging/typec/tcpci.c
@@ -46,12 +46,17 @@ static inline struct tcpci *tcpc_to_tcpci(struct tcpc_dev *tcpc)
  	return container_of(tcpc, struct tcpci, tcpc);
  }
-static int tcpci_read16(struct tcpci *tcpci, unsigned int reg,
-			unsigned int *val)
+static int tcpci_read16(struct tcpci *tcpci, unsigned int reg, u16 *val)
+

This is a separate fix which probably warrants a separate patch, or at the very least
should be mentioned in the subject/description.

Wonder if there is a valid use case for this function, though. Isn't status really
also little endian ? I'll have to look into the code.

Thanks,
Guenter

  {
  	return regmap_raw_read(tcpci->regmap, reg, val, sizeof(u16));
  }
+static int tcpci_read16_le(struct tcpci *tcpci, unsigned int reg, __le16 *val)
+{
+	return regmap_raw_read(tcpci->regmap, reg, val, sizeof(__le16));
+}
+
  static int tcpci_write16(struct tcpci *tcpci, unsigned int reg, u16 val)
  {
  	return regmap_raw_write(tcpci->regmap, reg, &val, sizeof(u16));
@@ -355,7 +360,8 @@ static int tcpci_init(struct tcpc_dev *tcpc)
  static irqreturn_t tcpci_irq(int irq, void *dev_id)
  {
  	struct tcpci *tcpci = dev_id;
-	unsigned int status, reg;
+	unsigned int reg;
+	u16 status;
tcpci_read16(tcpci, TCPC_ALERT, &status); @@ -389,8 +395,7 @@ static irqreturn_t tcpci_irq(int irq, void *dev_id) regmap_read(tcpci->regmap, TCPC_RX_BYTE_CNT, &cnt); - tcpci_read16(tcpci, TCPC_RX_HDR, &reg);
-		msg.header = reg;
+		tcpci_read16_le(tcpci, TCPC_RX_HDR, &msg.header);
if (WARN_ON(cnt > sizeof(msg.payload)))
  			cnt = sizeof(msg.payload);


_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux