[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20201001154531.3217-1-mailhol.vincent@wanadoo.fr>
Date: Fri, 2 Oct 2020 00:45:31 +0900
From: Vincent Mailhol <mailhol.vincent@...adoo.fr>
To: Marc Kleine-Budde <mkl@...gutronix.de>,
linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
linux-can@...r.kernel.org, Wolfgang Grandegger <wg@...ndegger.com>,
"David S . Miller" <davem@...emloft.net>
Cc: Vincent Mailhol <mailhol.vincent@...adoo.fr>,
Jakub Kicinski <kuba@...nel.org>,
Oliver Neukum <oneukum@...e.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Masahiro Yamada <masahiroy@...nel.org>,
Arunachalam Santhanam <arunachalam.santhanam@...bosch.com>
Subject: Re: [PATCH v2 2/6] can: dev: add a helper function
> > +static inline int get_can_len(struct sk_buff *skb)
>
> make this return an u8
> make the skb const
>
> > +{
> > + struct canfd_frame *cf =3D (struct canfd_frame *)skb->data;
>
> const
>
> > +
> > + if (can_is_canfd_skb(skb))
> > + return min_t(__u8, cf->len, CANFD_MAX_DLEN);
>
> u8
>
> > + else if (cf->can_id & CAN_RTR_FLAG)
> > + return 0;
> > + else
> > + return min_t(__u8, cf->len, CAN_MAX_DLEN);
>
> u8
Noted. All those changes will be addressed in v3 series.
Thank you.
As a side note, macros get_can_dlc() and get_canfd_dlc of the same
file (include/linux/can/dev.h) also use __u8 instead of u8. Do you
want me to add a patch to change these as below?
/*
* get_can_dlc(value) - helper macro to cast a given data length code (dlc)
- * to __u8 and ensure the dlc value to be max. 8 bytes.
+ * to u8 and ensure the dlc value to be max. 8 bytes.
*
* 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 get_canfd_dlc(i) (min_t(__u8, (i), CANFD_MAX_DLC))
+#define get_can_dlc(i) (min_t(u8, (i), CAN_MAX_DLC))
+#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,
Powered by blists - more mailing lists