diff options
author | Xi Wang <xi.wang@gmail.com> | 2011-12-12 02:16:20 -0500 |
---|---|---|
committer | Marc Kleine-Budde <mkl@pengutronix.de> | 2012-02-02 18:25:22 -0500 |
commit | 44b0052c5cb4e75389ed3eb9e98c29295a7dadfb (patch) | |
tree | 6ad88cbbf1b75e65f98220e449b62ac1acb387d1 /drivers/net/can/pch_can.c | |
parent | e3f240f460a36b158217944b52a85f304914c1a6 (diff) |
can: pch_can: fix error passive level test
The test (((errc & PCH_REC) >> 8) > 127) would always be false because
the receive error counter ((errc & PCH_REC) >> 8) is at most 127, where
PCH_REC is defined as 0x7f00. To test whether the receive error counter
has reached the error passive level, the RP bit (15) should be used.
Signed-off-by: Xi Wang <xi.wang@gmail.com>
Acked-by: Wolfgang Grandegger <wg@grandegger.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'drivers/net/can/pch_can.c')
-rw-r--r-- | drivers/net/can/pch_can.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/net/can/pch_can.c b/drivers/net/can/pch_can.c index d11fbb2b95ff..6edc25e0dd15 100644 --- a/drivers/net/can/pch_can.c +++ b/drivers/net/can/pch_can.c | |||
@@ -66,6 +66,7 @@ | |||
66 | #define PCH_IF_CREQ_BUSY BIT(15) | 66 | #define PCH_IF_CREQ_BUSY BIT(15) |
67 | 67 | ||
68 | #define PCH_STATUS_INT 0x8000 | 68 | #define PCH_STATUS_INT 0x8000 |
69 | #define PCH_RP 0x00008000 | ||
69 | #define PCH_REC 0x00007f00 | 70 | #define PCH_REC 0x00007f00 |
70 | #define PCH_TEC 0x000000ff | 71 | #define PCH_TEC 0x000000ff |
71 | 72 | ||
@@ -527,7 +528,7 @@ static void pch_can_error(struct net_device *ndev, u32 status) | |||
527 | priv->can.can_stats.error_passive++; | 528 | priv->can.can_stats.error_passive++; |
528 | state = CAN_STATE_ERROR_PASSIVE; | 529 | state = CAN_STATE_ERROR_PASSIVE; |
529 | cf->can_id |= CAN_ERR_CRTL; | 530 | cf->can_id |= CAN_ERR_CRTL; |
530 | if (((errc & PCH_REC) >> 8) > 127) | 531 | if (errc & PCH_RP) |
531 | cf->data[1] |= CAN_ERR_CRTL_RX_PASSIVE; | 532 | cf->data[1] |= CAN_ERR_CRTL_RX_PASSIVE; |
532 | if ((errc & PCH_TEC) > 127) | 533 | if ((errc & PCH_TEC) > 127) |
533 | cf->data[1] |= CAN_ERR_CRTL_TX_PASSIVE; | 534 | cf->data[1] |= CAN_ERR_CRTL_TX_PASSIVE; |