Skip to contentSkip to conversation

i2c-ismt: add Initialize DMA buffer code ismt_access()

PATCH In review James Ralston 3 participants 4 messages Sep 24, 2013 – Sep 28, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 i2c-ismt: add Initialize DMA buffer code ismt_access()

This patch adds code to Initialize the DMA buffer to compensate for possible hardware data corruption.

---
 drivers/i2c/busses/i2c-ismt.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
drivers/i2c/busses/i2c-ismt.c +3 -0
index 8ed79a0..d3f30ea 100644
@@ -393,6 +393,9 @@ static int ismt_access(struct i2c_adapter *adap, u16 addr,
 
 	desc = &priv->hw[priv->head];
 
+	/* Initialize the DMA buffer */
+	memset(priv->dma_buffer, 0, (I2C_SMBUS_BLOCK_MAX+1));
+
 	/* Initialize the descriptor */
 	memset(desc, 0, sizeof(struct ismt_desc));
 	desc->tgtaddr_rw = ISMT_DESC_ADDR_RW(addr, read_write);
Signature · 1 line
1.7.7.6
#1 lore raw
Quoted 1 line · James Ralston

This patch adds code to Initialize the DMA buffer to compensate for possible hardware data corruption.

Take care of the line width here.

Quoted 10 lines
---
 drivers/i2c/busses/i2c-ismt.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
drivers/i2c/busses/i2c-ismt.c +0 -0
index 8ed79a0..d3f30ea 100644

drivers/i2c/busses/i2c-ismt.c static int ismt_access(struct i2c_adapter *adap, u16 addr, · line 397

Quoted 5 lines
drivers/i2c/busses/i2c-ismt.c +2 -0
@@ -393,6 +393,9 @@ static int ismt_access(struct i2c_adapter *adap, u16 addr,
 
 	desc = &priv->hw[priv->head];
 
+	/* Initialize the DMA buffer */
+	memset(priv->dma_buffer, 0, (I2C_SMBUS_BLOCK_MAX+1));

sizeof()?

Quoted 7 lines
drivers/i2c/busses/i2c-ismt.c +1 -0
+
 	/* Initialize the descriptor */
 	memset(desc, 0, sizeof(struct ismt_desc));
 	desc->tgtaddr_rw = ISMT_DESC_ADDR_RW(addr, read_write);
Signature · 1 line
1.7.7.6
maintainer
#2 lore raw
Quoted 16 lines · Wolfram Sang
Quoted 1 line · James Ralston

This patch adds code to Initialize the DMA buffer to compensate for possible hardware data corruption.

Take care of the line width here.

Quoted 11 lines
---
 drivers/i2c/busses/i2c-ismt.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
drivers/i2c/busses/i2c-ismt.c +0 -0
index 8ed79a0..d3f30ea 100644
@@ -393,6 +393,9 @@ static int ismt_access(struct i2c_adapter *adap, u16 addr,
 
Quoted 7 lines

drivers/i2c/busses/i2c-ismt.c static int ismt_access(struct i2c_adapter *adap, u16 addr, · line 397

Quoted 4 lines
drivers/i2c/busses/i2c-ismt.c +2 -0
 	desc = &priv->hw[priv->head];
 
+	/* Initialize the DMA buffer */
+	memset(priv->dma_buffer, 0, (I2C_SMBUS_BLOCK_MAX+1));

sizeof()?

Agreed.
Neil

Quoted 7 lines
Quoted 7 lines
drivers/i2c/busses/i2c-ismt.c +1 -0
+
 	/* Initialize the descriptor */
 	memset(desc, 0, sizeof(struct ismt_desc));
 	desc->tgtaddr_rw = ISMT_DESC_ADDR_RW(addr, read_write);
Signature · 1 line
1.7.7.6
#3 lore raw
Quoted 17 lines · Neil Horman
Quoted 16 lines · Wolfram Sang
Quoted 1 line · James Ralston

This patch adds code to Initialize the DMA buffer to compensate for possible hardware data corruption.

Take care of the line width here.

Quoted 11 lines
---
 drivers/i2c/busses/i2c-ismt.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
drivers/i2c/busses/i2c-ismt.c +0 -0
index 8ed79a0..d3f30ea 100644
@@ -393,6 +393,9 @@ static int ismt_access(struct i2c_adapter *adap, u16 addr,
 
Quoted 8 lines
Quoted 7 lines

drivers/i2c/busses/i2c-ismt.c static int ismt_access(struct i2c_adapter *adap, u16 addr, · line 397

Quoted 4 lines
drivers/i2c/busses/i2c-ismt.c +2 -0
 	desc = &priv->hw[priv->head];
 
+	/* Initialize the DMA buffer */
+	memset(priv->dma_buffer, 0, (I2C_SMBUS_BLOCK_MAX+1));

sizeof()?

Agreed.

Fixed that myself so it can be in my pull-request to Linus today.