diff options
author | Marc Kleine-Budde <mkl@pengutronix.de> | 2021-10-23 00:27:13 +0200 |
---|---|---|
committer | Marc Kleine-Budde <mkl@pengutronix.de> | 2022-01-08 20:17:42 +0100 |
commit | 3044a4f271d278858321675d367b37bcafca186c (patch) | |
tree | ea1071796c9622ef568b12058de6b308032b918b /drivers/net/can/spi/mcp251xfd/mcp251xfd.h | |
parent | 55bc37c85587d0c53a666a685a49752e28a31396 (diff) |
can: mcp251xfd: introduce and make use of mcp251xfd_is_fd_mode()
This patch replaces the open coded check, if the chip's FIFOs are
configured for CAN-FD mode, by the newly introduced function
mcp251xfd_is_fd_mode().
Link: https://lore.kernel.org/all/20220105154300.1258636-14-mkl@pengutronix.de
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'drivers/net/can/spi/mcp251xfd/mcp251xfd.h')
-rw-r--r-- | drivers/net/can/spi/mcp251xfd/mcp251xfd.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/net/can/spi/mcp251xfd/mcp251xfd.h b/drivers/net/can/spi/mcp251xfd/mcp251xfd.h index 597786a85621..f551c900803e 100644 --- a/drivers/net/can/spi/mcp251xfd/mcp251xfd.h +++ b/drivers/net/can/spi/mcp251xfd/mcp251xfd.h @@ -626,6 +626,12 @@ MCP251XFD_IS(2517); MCP251XFD_IS(2518); MCP251XFD_IS(251X); +static inline bool mcp251xfd_is_fd_mode(const struct mcp251xfd_priv *priv) +{ + /* listen-only mode works like FD mode */ + return priv->can.ctrlmode & (CAN_CTRLMODE_LISTENONLY | CAN_CTRLMODE_FD); +} + static inline u8 mcp251xfd_first_byte_set(u32 mask) { return (mask & 0x0000ffff) ? |