summaryrefslogtreecommitdiffstats
path: root/drivers/net/can/flexcan.c
diff options
context:
space:
mode:
authorAndri Yngvason <andri.yngvason@marel.com>2015-03-17 13:03:09 +0000
committerMarc Kleine-Budde <mkl@pengutronix.de>2015-03-22 18:14:51 +0100
commit258ce80e19211f06c97a562a71308ec21a9ab98f (patch)
tree944c0cbfb97263f3f6c7b906b2d175565e4398dc /drivers/net/can/flexcan.c
parent0f251e45c7cbb1a494b5600485ea8ff64f664b3f (diff)
downloadlinux-258ce80e19211f06c97a562a71308ec21a9ab98f.tar.bz2
can: flexcan: fix bus-off error state handling.
Making sure that the bus-off state gets passed to can_change_state(). Signed-off-by: Andri Yngvason <andri.yngvason@marel.com> Cc: linux-stable <stable@vger.kernel.org> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'drivers/net/can/flexcan.c')
-rw-r--r--drivers/net/can/flexcan.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
index 80c46ad4cee4..ee944ae6bb96 100644
--- a/drivers/net/can/flexcan.c
+++ b/drivers/net/can/flexcan.c
@@ -592,13 +592,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 */