From 7e2804aae1288643f3d3d5c018feefc98c098509 Mon Sep 17 00:00:00 2001 From: Anssi Hannula Date: Wed, 8 Feb 2017 13:32:43 +0200 Subject: can: xilinx_can: only report warning and passive states on state changes The xilinx_can driver currently increments error-warning and error-passive statistics on every error interrupt regardless of whether the interface was already in the same state. Similarly, the error frame sent on error interrupts is always sent with CAN_ERR_CRTL_(RX|TX)_(PASSIVE|WARNING) bit set. To make the error-warning and error-passive statistics more useful, add a check to only set the error state when the state has actually been changed. Tested with the integrated CAN on Zynq-7000 SoC. Signed-off-by: Anssi Hannula Signed-off-by: Marc Kleine-Budde --- drivers/net/can/xilinx_can.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers/net/can/xilinx_can.c') diff --git a/drivers/net/can/xilinx_can.c b/drivers/net/can/xilinx_can.c index 545f69476866..32e49acd4ebd 100644 --- a/drivers/net/can/xilinx_can.c +++ b/drivers/net/can/xilinx_can.c @@ -703,7 +703,8 @@ static void xcan_err_interrupt(struct net_device *ndev, u32 isr) } else { enum can_state new_state = xcan_current_error_state(ndev); - xcan_set_error_state(ndev, new_state, skb ? cf : NULL); + if (new_state != priv->can.state) + xcan_set_error_state(ndev, new_state, skb ? cf : NULL); } /* Check for Arbitration lost interrupt */ -- cgit v1.2.3