can: remove obsolete get_canfd_dlc() macro
authorOliver Hartkopp <socketcan@hartkopp.net>
Tue, 10 Nov 2020 10:18:47 +0000 (11:18 +0100)
committerMarc Kleine-Budde <mkl@pengutronix.de>
Fri, 20 Nov 2020 08:43:30 +0000 (09:43 +0100)
The macro was always used together with can_dlc2len() which sanitizes the
given dlc value on its own.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
Link: https://lore.kernel.org/r/20201110101852.1973-4-socketcan@hartkopp.net
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
drivers/net/can/flexcan.c
drivers/net/can/peak_canfd/peak_canfd.c
drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c
drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c
drivers/net/can/usb/peak_usb/pcan_usb_fd.c
include/linux/can/dev.h
include/linux/can/dev/peak_canfd.h

index 50ccd18..985569f 100644 (file)
@@ -1000,7 +1000,7 @@ static struct sk_buff *flexcan_mailbox_read(struct can_rx_offload *offload,
                cfd->can_id = (reg_id >> 18) & CAN_SFF_MASK;
 
        if (reg_ctrl & FLEXCAN_MB_CNT_EDL) {
-               cfd->len = can_dlc2len(get_canfd_dlc((reg_ctrl >> 16) & 0xf));
+               cfd->len = can_dlc2len((reg_ctrl >> 16) & 0xf);
 
                if (reg_ctrl & FLEXCAN_MB_CNT_BRS)
                        cfd->flags |= CANFD_BRS;
index 9ea2ade..c6077e0 100644 (file)
@@ -257,7 +257,7 @@ static int pucan_handle_can_rx(struct peak_canfd_priv *priv,
        u8 cf_len;
 
        if (rx_msg_flags & PUCAN_MSG_EXT_DATA_LEN)
-               cf_len = can_dlc2len(get_canfd_dlc(pucan_msg_get_dlc(msg)));
+               cf_len = can_dlc2len(pucan_msg_get_dlc(msg));
        else
                cf_len = can_cc_dlc2len(pucan_msg_get_dlc(msg));
 
index c0a0840..3bac727 100644 (file)
@@ -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(get_canfd_dlc(dlc));
+               cfd->len = can_dlc2len(dlc);
        } else {
                if (hw_rx_obj->flags & MCP251XFD_OBJ_FLAGS_RTR)
                        cfd->can_id |= CAN_RTR_FLAG;
index 493a614..843e2e1 100644 (file)
@@ -1251,7 +1251,7 @@ static void kvaser_usb_hydra_rx_msg_ext(const struct kvaser_usb *dev,
                kvaser_usb_can_rx_over_error(priv->netdev);
 
        if (flags & KVASER_USB_HYDRA_CF_FLAG_FDF) {
-               cf->len = can_dlc2len(get_canfd_dlc(dlc));
+               cf->len = can_dlc2len(dlc);
                if (flags & KVASER_USB_HYDRA_CF_FLAG_BRS)
                        cf->flags |= CANFD_BRS;
                if (flags & KVASER_USB_HYDRA_CF_FLAG_ESI)
index 1f08dd2..1233ef2 100644 (file)
@@ -492,7 +492,7 @@ static int pcan_usb_fd_decode_canmsg(struct pcan_usb_fd_if *usb_if,
                if (rx_msg_flags & PUCAN_MSG_ERROR_STATE_IND)
                        cfd->flags |= CANFD_ESI;
 
-               cfd->len = can_dlc2len(get_canfd_dlc(pucan_msg_get_dlc(rm)));
+               cfd->len = can_dlc2len(pucan_msg_get_dlc(rm));
        } else {
                /* CAN 2.0 frame case */
                skb = alloc_can_skb(netdev, (struct can_frame **)&cfd);
index 9bc84c6..802606e 100644 (file)
@@ -105,7 +105,6 @@ static inline unsigned int can_bit_time(const struct can_bittiming *bt)
  * ISO 11898-1 Chapter 8.4.2.3 (DLC field)
  */
 #define can_cc_dlc2len(dlc)    (min_t(u8, (dlc), CAN_MAX_DLEN))
-#define get_canfd_dlc(dlc)     (min_t(u8, (dlc), CANFD_MAX_DLC))
 
 /* Check for outgoing skbs that have not been created by the CAN subsystem */
 static inline bool can_skb_headroom_valid(struct net_device *dev,
index 5fd627e..f38772f 100644 (file)
@@ -282,7 +282,7 @@ static inline int pucan_msg_get_channel(const struct pucan_rx_msg *msg)
 }
 
 /* return the dlc value from any received message channel_dlc field */
-static inline int pucan_msg_get_dlc(const struct pucan_rx_msg *msg)
+static inline u8 pucan_msg_get_dlc(const struct pucan_rx_msg *msg)
 {
        return msg->channel_dlc >> 4;
 }