Re: [PATCH v3 2/4] can: rename get_can_dlc() macro with can_get_cc_len()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 29.10.20 17:32, Oliver Hartkopp wrote:
> diff --git a/include/linux/can/dev.h b/include/linux/can/dev.h
> index 41ff31795320..0a51f3c9cfec 100644
> --- a/include/linux/can/dev.h
> +++ b/include/linux/can/dev.h
> @@ -96,17 +96,17 @@ static inline unsigned int can_bit_time(const struct can_bittiming *bt)
>  {
>         return CAN_SYNC_SEG + bt->prop_seg + bt->phase_seg1 + bt->phase_seg2;
>  }
>
>  /*
> - * get_can_dlc(value) - helper macro to cast a given data length code (dlc)
> + * can_get_cc_len(value) - helper macro to cast a given data length code (dlc)
>   * to u8 and ensure the dlc value to be max. 8 bytes.

 * can_get_cc_len(value) - convert a given data length code (dlc) of a
 * Classical CAN frame into a valid data length of max. 8 bytes.

The comment is a leftover. It still mentioned DLC of max. 8 bytes. I
tried to rephrase it to better highlight the nuance.

>   *
>   * To be used in the CAN netdriver receive path to ensure conformance with
>   * ISO 11898-1 Chapter 8.4.2.3 (DLC field)
>   */
> -#define get_can_dlc(i)         (min_t(u8, (i), CAN_MAX_DLC))
> +#define can_get_cc_len(i)      (min_t(u8, (i), CAN_MAX_DLEN))

#define can_get_cc_len(dlc)      (min_t(u8, (dlc), CAN_MAX_DLEN))

It is easier to read and understand if the input is named "dlc", not "i".

>  #define get_canfd_dlc(i)       (min_t(u8, (i), 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,
>                                           struct sk_buff *skb)


Yours sincerely,
Vincent Mailhol



[Index of Archives]     [Automotive Discussions]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [CAN Bus]

  Powered by Linux