Skip to contentSkip to conversation

usb: typec: ucsi: add support for Cypress CCGx

PATCH New Wolfram Sang 1 participant 1 message Sep 5, 2018 USB

lore
Share & tools
lore
#0 lore raw

PATCH v5 2/2 usb: typec: ucsi: add support for Cypress CCGx

Quoted 23 lines · Ajay Gupta

Hi Greg,

Quoted 21 lines
Quoted 8 lines
(quoted diff) +8 -0
+static int ccg_read(struct ucsi_ccg *uc, u16 rab, u8 *data, u32 len)
+{
+	struct device *dev = uc->dev;
+	struct i2c_client *client = uc->client;
+	unsigned char buf[2];
+	struct i2c_msg msgs[] = {
+		{
+			.addr	= client->addr,

Review

Quoted 10 lines
(quoted diff) +10 -0
+			.flags  = 0x0,
+			.len	= 0x2,
+			.buf	= buf,
+		},
+		{
+			.addr	= client->addr,
+			.flags  = I2C_M_RD,
+			.buf	= data,
+		},
+	};

Are you sure you are allowed to do i2c messages off of the stack like this? Will that work on all platforms?

DMA is optional with I2C. These messages do not set the I2C_M_DMASAFE flag, so it should be OK.