Browse Source

can: mcp251x: read-modify-write eflag only when needed

Use read-modify-write instead of a simple write to change the register
contents, to close existing the race window between the original manual
read and write.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Acked-by: Wolfgang Grandegger <wg@grandegger.com>
Sascha Hauer 14 years ago
parent
commit
7e15de3a73
1 changed files with 2 additions and 1 deletions
  1. 2 1
      drivers/net/can/mcp251x.c

+ 2 - 1
drivers/net/can/mcp251x.c

@@ -785,7 +785,8 @@ static irqreturn_t mcp251x_can_ist(int irq, void *dev_id)
 
 
 		mcp251x_write_bits(spi, CANINTF, intf, 0x00);
 		mcp251x_write_bits(spi, CANINTF, intf, 0x00);
 
 
-		mcp251x_write_reg(spi, EFLG, 0x00);
+		if (eflag)
+			mcp251x_write_bits(spi, EFLG, eflag, 0x00);
 
 
 		/* Update can state */
 		/* Update can state */
 		if (eflag & EFLG_TXBO) {
 		if (eflag & EFLG_TXBO) {