Skip to contentSkip to conversation

can: sja1000: Fix error location forwarding

PATCH Applied Alexander Gerasiov 3 participants 5 messages Apr 1, 2016 – Apr 12, 2016 CAN network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 drivers/net/can/sja1000/sja1000.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/can/sja1000/sja1000.c +5 -1
index 8dda3b7..9f10779 100644
@@ -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;
 
+               /* set error type */
                switch (ecc & ECC_MASK) {
                case ECC_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)
                        cf->data[2] |= CAN_ERR_PROT_STUFF;
                        break;
                default:
-                       cf->data[3] = ecc & ECC_SEG;
                        break;
                }
+
+               /* set error location */
+               cf->data[3] = ecc & ECC_SEG;
+
                /* Error occurred during transmission? */
                if ((ecc & ECC_DIR) == 0)
                        cf->data[2] |= CAN_ERR_PROT_TX;
Signature · 11 lines
2.1.4



-- 
Best regards,
 Alexander Gerasiov

 Contacts:
 e-mail: [email protected]  Homepage: http://gerasiov.net  Skype: gerasiov
 PGP fingerprint: 04B5 9D90 DF7C C2AB CD49  BAEA CA87 E9E8 2AAC 33F1
Acked-by on v1 1/1
#1 lore raw

Hello Alexander,

you are right. Thanks for the fix.

Quoted 6 lines · Alexander Gerasiov

According to SJA1000 documentation the location of error is available regardless of an error type. Therefore it should always be forwarded to SocketCAN.

Best regards,
Oliver

Quoted 31 lines
---
 drivers/net/can/sja1000/sja1000.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/can/sja1000/sja1000.c +5 -1
index 8dda3b7..9f10779 100644
@@ -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;
 
+               /* set error type */
                switch (ecc & ECC_MASK) {
                case ECC_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)
                        cf->data[2] |= CAN_ERR_PROT_STUFF;
                        break;
                default:
-                       cf->data[3] = ecc & ECC_SEG;
                        break;
                }
+
+               /* set error location */
+               cf->data[3] = ecc & ECC_SEG;
+
                /* Error occurred during transmission? */
                if ((ecc & ECC_DIR) == 0)
                        cf->data[2] |= CAN_ERR_PROT_TX;
maintainer Applied
#2 lore raw
In reply to Alexander Gerasiov
Quoted 6 lines · Alexander Gerasiov

According to SJA1000 documentation the location of error is available regardless of an error type. Therefore it should always be forwarded to SocketCAN.

Applied to can-next/master. Please use git send-email to send your patches, your mailer converted tabs to spaces.

Tnx,
Marc

Signature · 4 lines
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |
#3 lore raw

Hi Marc,

Quoted 2 lines · Marc Kleine-Budde

Applied to can-next/master. Please use git send-email to send your patches, your mailer converted tabs to spaces.

can you please push the can[-next] changes so that they become visible.

Tnx,
Oliver

#4 lore raw
Quoted 8 lines · Oliver Hartkopp

Hi Marc,

Quoted 2 lines · Marc Kleine-Budde

Applied to can-next/master. Please use git send-email to send your patches, your mailer converted tabs to spaces.

can you please push the can[-next] changes so that they become visible.

Done. All pending changes are on can-next/testing.

Marc

Signature · 4 lines
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |