can: mcp251x: read-modify-write eflag only when needed
authorSascha Hauer <s.hauer@pengutronix.de>
Tue, 28 Sep 2010 08:00:47 +0000 (10:00 +0200)
committerMarc Kleine-Budde <mkl@pengutronix.de>
Mon, 18 Oct 2010 09:19:42 +0000 (11:19 +0200)
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>
drivers/net/can/mcp251x.c

index 9b3466aed06d487db2d8d5a516782a006e0b9061..7e2f951002a5086fa6fb286c2446e088906b3132 100644 (file)
@@ -785,7 +785,8 @@ static irqreturn_t mcp251x_can_ist(int irq, void *dev_id)
 
                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 */
                if (eflag & EFLG_TXBO) {