提交 3e51a335 编写于 作者: A Alexander Gerasiov 提交者: Marc Kleine-Budde

can: sja1000: Fix error location forwarding

According to SJA1000 documentation the location of error is available
regardless of an error type. Therefore it should always be forwarded to
SocketCAN.
Signed-off-by: NNikita Edward Baruzdin <nebaruzdin@lvk.cs.msu.su>
Signed-off-by: NAlexander GQ Gerasiov <gq@cs.msu.su>
Acked-by: NOliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: NMarc Kleine-Budde <mkl@pengutronix.de>
上级 908578e7
...@@ -438,6 +438,7 @@ static int sja1000_err(struct net_device *dev, uint8_t isrc, uint8_t status) ...@@ -438,6 +438,7 @@ static int sja1000_err(struct net_device *dev, uint8_t isrc, uint8_t status)
cf->can_id |= CAN_ERR_PROT | CAN_ERR_BUSERROR; cf->can_id |= CAN_ERR_PROT | CAN_ERR_BUSERROR;
/* set error type */
switch (ecc & ECC_MASK) { switch (ecc & ECC_MASK) {
case ECC_BIT: case ECC_BIT:
cf->data[2] |= CAN_ERR_PROT_BIT; cf->data[2] |= CAN_ERR_PROT_BIT;
...@@ -449,9 +450,12 @@ static int sja1000_err(struct net_device *dev, uint8_t isrc, uint8_t status) ...@@ -449,9 +450,12 @@ static int sja1000_err(struct net_device *dev, uint8_t isrc, uint8_t status)
cf->data[2] |= CAN_ERR_PROT_STUFF; cf->data[2] |= CAN_ERR_PROT_STUFF;
break; break;
default: default:
cf->data[3] = ecc & ECC_SEG;
break; break;
} }
/* set error location */
cf->data[3] = ecc & ECC_SEG;
/* Error occurred during transmission? */ /* Error occurred during transmission? */
if ((ecc & ECC_DIR) == 0) if ((ecc & ECC_DIR) == 0)
cf->data[2] |= CAN_ERR_PROT_TX; cf->data[2] |= CAN_ERR_PROT_TX;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册