]> git.itanic.dy.fi Git - linux-stable/commit
can: dev: add can_state_get_by_berr_counter() to return the CAN state based on the...
authorMarc Kleine-Budde <mkl@pengutronix.de>
Thu, 28 Sep 2023 07:24:28 +0000 (09:24 +0200)
committerMarc Kleine-Budde <mkl@pengutronix.de>
Thu, 5 Oct 2023 19:44:48 +0000 (21:44 +0200)
commit9beebc2b5d0038a65977a7a14909598c64ce070f
treebf196909d99bd5bfc45327af664101263046a7ac
parent2f0382a7590ed65ef6a4336aace0f30814e24dc1
can: dev: add can_state_get_by_berr_counter() to return the CAN state based on the current error counters

Some CAN controllers do not have a register that contains the current
CAN state, but only a register that contains the error counters.

Introduce a new function can_state_get_by_berr_counter() that returns
the current TX and RX state depending on the provided CAN bit error
counters.

Link: https://lore.kernel.org/all/20231005-at91_can-rx_offload-v2-1-9987d53600e0@pengutronix.de
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
drivers/net/can/dev/dev.c
include/linux/can/dev.h