]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
can: kvaser_usb: Fix state handling upon BUS_ERROR events
authorAhmed S. Darwish <ahmed.darwish@valeo.com>
Mon, 26 Jan 2015 05:25:43 +0000 (07:25 +0200)
committerJiri Slaby <jslaby@suse.cz>
Sun, 8 Feb 2015 19:01:54 +0000 (20:01 +0100)
commita38a9696988b01a496af60ca7494068865bb2217
treed9c6457516d9b21b830a8eb96dda0dc8511ced45
parent3d6365501fe636c82771ee41727f96d0e281a70f
can: kvaser_usb: Fix state handling upon BUS_ERROR events

commit e638642b08c170d2021b706f0b1c4f4ae93d8cbd upstream.

While being in an ERROR_WARNING state, and receiving further
bus error events with error counters still in the ERROR_WARNING
range of 97-127 inclusive, the state handling code erroneously
reverts back to ERROR_ACTIVE.

Per the CAN standard, only revert to ERROR_ACTIVE when the
error counters are less than 96.

Moreover, in certain Kvaser models, the BUS_ERROR flag is
always set along with undefined bits in the M16C status
register. Thus use bitwise operators instead of full equality
for checking that register against bus errors.

Signed-off-by: Ahmed S. Darwish <ahmed.darwish@valeo.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
drivers/net/can/usb/kvaser_usb.c