drivers: can: remove CAN_BUS_UNKNOWN CAN controller state
The CAN_BUS_UNKNOWN CAN controller state is only used to indicate that the current CAN controller state could not be read. Remove it and change the signature of the can_get_state() API function to return an integer indicating success or failure. Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
This commit is contained in:
parent
b2190fd703
commit
2aed5a1237
15 changed files with 155 additions and 114 deletions
|
@ -406,6 +406,7 @@ void CO_CANverifyErrors(CO_CANmodule_t *CANmodule)
|
|||
enum can_state state;
|
||||
uint8_t rx_overflows;
|
||||
uint32_t errors;
|
||||
int err;
|
||||
|
||||
/*
|
||||
* TODO: Zephyr lacks an API for reading the rx mailbox
|
||||
|
@ -413,7 +414,11 @@ void CO_CANverifyErrors(CO_CANmodule_t *CANmodule)
|
|||
*/
|
||||
rx_overflows = 0;
|
||||
|
||||
state = can_get_state(CANmodule->dev, &err_cnt);
|
||||
err = can_get_state(CANmodule->dev, &state, &err_cnt);
|
||||
if (err != 0) {
|
||||
LOG_ERR("failed to get CAN controller state (err %d)", err);
|
||||
return;
|
||||
}
|
||||
|
||||
errors = ((uint32_t)err_cnt.tx_err_cnt << 16) |
|
||||
((uint32_t)err_cnt.rx_err_cnt << 8) |
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue