diff options
author | Andri Yngvason <andri.yngvason@marel.com> | 2015-03-17 13:03:09 +0000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-04-19 10:10:21 +0200 |
commit | 6e6c9127315087a0535ab0b5e80f174681ed6b61 (patch) | |
tree | 13be9c278c66aa6b0f7faf8b65bf91d067ea4d14 | |
parent | f3e70953e7ad132ec5cad878f58e7348ad152159 (diff) | |
download | lwn-6e6c9127315087a0535ab0b5e80f174681ed6b61.tar.gz lwn-6e6c9127315087a0535ab0b5e80f174681ed6b61.zip |
can: flexcan: fix bus-off error state handling.
commit 258ce80e19211f06c97a562a71308ec21a9ab98f upstream.
Making sure that the bus-off state gets passed to can_change_state().
Signed-off-by: Andri Yngvason <andri.yngvason@marel.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/net/can/flexcan.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c index b1d583ba9674..c699113afc6f 100644 --- a/drivers/net/can/flexcan.c +++ b/drivers/net/can/flexcan.c @@ -593,13 +593,12 @@ static int flexcan_poll_state(struct net_device *dev, u32 reg_esr) rx_state = unlikely(reg_esr & FLEXCAN_ESR_RX_WRN) ? CAN_STATE_ERROR_WARNING : CAN_STATE_ERROR_ACTIVE; new_state = max(tx_state, rx_state); - } else if (unlikely(flt == FLEXCAN_ESR_FLT_CONF_PASSIVE)) { + } else { __flexcan_get_berr_counter(dev, &bec); - new_state = CAN_STATE_ERROR_PASSIVE; + new_state = flt == FLEXCAN_ESR_FLT_CONF_PASSIVE ? + CAN_STATE_ERROR_PASSIVE : CAN_STATE_BUS_OFF; rx_state = bec.rxerr >= bec.txerr ? new_state : 0; tx_state = bec.rxerr <= bec.txerr ? new_state : 0; - } else { - new_state = CAN_STATE_BUS_OFF; } /* state hasn't changed */ |