diff options
author | Oliver Hartkopp <socketcan@hartkopp.net> | 2020-11-10 11:18:49 +0100 |
---|---|---|
committer | Marc Kleine-Budde <mkl@pengutronix.de> | 2020-11-20 12:05:14 +0100 |
commit | 3ab4ce0d6fa8c93d41df4a74ec8d2c9198be2109 (patch) | |
tree | 9d05569f468555c916dfde7e19f0eb73ef8e0582 /drivers/net/can/spi | |
parent | can: replace can_dlc as variable/element for payload length (diff) | |
download | linux-3ab4ce0d6fa8c93d41df4a74ec8d2c9198be2109.tar.xz linux-3ab4ce0d6fa8c93d41df4a74ec8d2c9198be2109.zip |
can: rename CAN FD related can_len2dlc and can_dlc2len helpers
The helper functions can_len2dlc and can_dlc2len are only relevant for
CAN FD data length code (DLC) conversion.
To fit the introduced can_cc_dlc2len for Classical CAN we rename:
can_dlc2len -> can_fd_dlc2len to get the payload length from the DLC
can_len2dlc -> can_fd_len2dlc to get the DLC from the payload length
Suggested-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
Link: https://lore.kernel.org/r/20201110101852.1973-6-socketcan@hartkopp.net
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'drivers/net/can/spi')
-rw-r--r-- | drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c b/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c index 3bac7274ee5b..afa8cfc729b5 100644 --- a/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c +++ b/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c @@ -1405,7 +1405,7 @@ mcp251xfd_hw_rx_obj_to_skb(const struct mcp251xfd_priv *priv, cfd->flags |= CANFD_BRS; dlc = FIELD_GET(MCP251XFD_OBJ_FLAGS_DLC, hw_rx_obj->flags); - cfd->len = can_dlc2len(dlc); + cfd->len = can_fd_dlc2len(dlc); } else { if (hw_rx_obj->flags & MCP251XFD_OBJ_FLAGS_RTR) cfd->can_id |= CAN_RTR_FLAG; @@ -2244,7 +2244,7 @@ mcp251xfd_tx_obj_from_skb(const struct mcp251xfd_priv *priv, * harm, only the lower 7 bits will be transferred into the * TEF object. */ - dlc = can_len2dlc(cfd->len); + dlc = can_fd_len2dlc(cfd->len); flags |= FIELD_PREP(MCP251XFD_OBJ_FLAGS_SEQ_MCP2518FD_MASK, seq) | FIELD_PREP(MCP251XFD_OBJ_FLAGS_DLC, dlc); @@ -2273,7 +2273,7 @@ mcp251xfd_tx_obj_from_skb(const struct mcp251xfd_priv *priv, /* Clear data at end of CAN frame */ offset = round_down(cfd->len, sizeof(u32)); - len = round_up(can_dlc2len(dlc), sizeof(u32)) - offset; + len = round_up(can_fd_dlc2len(dlc), sizeof(u32)) - offset; if (MCP251XFD_SANITIZE_CAN && len) memset(hw_tx_obj->data + offset, 0x0, len); memcpy(hw_tx_obj->data, cfd->data, cfd->len); @@ -2281,7 +2281,7 @@ mcp251xfd_tx_obj_from_skb(const struct mcp251xfd_priv *priv, /* Number of bytes to be written into the RAM of the controller */ len = sizeof(hw_tx_obj->id) + sizeof(hw_tx_obj->flags); if (MCP251XFD_SANITIZE_CAN) - len += round_up(can_dlc2len(dlc), sizeof(u32)); + len += round_up(can_fd_dlc2len(dlc), sizeof(u32)); else len += round_up(cfd->len, sizeof(u32)); |