Skip to contentSkip to conversation

can: mcp251x: avoid write to error flag register if it's unnecessary

PATCH In review Ed Spiridonov 2 participants 2 messages Mar 4, 2016 CAN network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 can: mcp251x: avoid write to error flag register if it's unnecessary

Only two bits (RX0OVR and RX1OVR) are writable in EFLG, write is useless if these bits aren't set.

---
 drivers/net/can/spi/mcp251x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/can/spi/mcp251x.c +1 -1
index 575790e..74a7dfe 100644
@@ -843,7 +843,7 @@ static irqreturn_t mcp251x_can_ist(int irq, void *dev_id)
 		if (clear_intf)
 			mcp251x_write_bits(spi, CANINTF, clear_intf, 0x00);
 
-		if (eflag)
+		if (eflag & (EFLG_RX0OVR | EFLG_RX1OVR))
 			mcp251x_write_bits(spi, EFLG, eflag, 0x00);
 
 		/* Update can state */
Signature · 1 line
2.7.0
#1 lore raw
Quoted 3 lines · Ed Spiridonov

Only two bits (RX0OVR and RX1OVR) are writable in EFLG, write is useless if these bits aren't set.

Added to can.

Thanks,
Marc

Signature · 4 lines
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |