Skip to content

Commit

Permalink
can: mcp251x: read-modify-write eflag only when needed
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Sascha Hauer authored and Marc Kleine-Budde committed Oct 18, 2010
1 parent f3a3ed3 commit 7e15de3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/net/can/mcp251x.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 7e15de3

Please sign in to comment.