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:
Henrik Brix Andersen 2022-01-19 10:21:01 +01:00 committed by Carles Cufí
commit 2aed5a1237
15 changed files with 155 additions and 114 deletions

View file

@ -90,13 +90,13 @@ static int can_stm32fd_init(const struct device *dev)
return ret;
}
static enum can_state can_stm32fd_get_state(const struct device *dev,
struct can_bus_err_cnt *err_cnt)
static int can_stm32fd_get_state(const struct device *dev, enum can_state *state,
struct can_bus_err_cnt *err_cnt)
{
const struct can_stm32fd_config *cfg = dev->config;
const struct can_mcan_config *mcan_cfg = &cfg->mcan_cfg;
return can_mcan_get_state(mcan_cfg, err_cnt);
return can_mcan_get_state(mcan_cfg, state, err_cnt);
}
static int can_stm32fd_send(const struct device *dev, const struct zcan_frame *frame,