Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp554945pxk; Thu, 1 Oct 2020 08:47:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwstRy1be7gUZIyaRjq1X/7B0nf6euzVx0YGLaNFVvVgEj48FHd2p4I4W0luws4eq1QF1sC X-Received: by 2002:a50:d4ce:: with SMTP id e14mr9202074edj.126.1601567261348; Thu, 01 Oct 2020 08:47:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601567261; cv=none; d=google.com; s=arc-20160816; b=fG6nYq2wrmX1iyqqIpHa1GEHf0/7MTnDC4yZrB9eOkdamD/ohcoMinL2vihK7qSCER b8yzegjOHEXUYEtTjBAkcD2FQD3/ZjkwEOgGh47KphdBUtClnCitguwvW56jhyI3I0/L wSZ1MiEUdsNTd29sE87aRcKVT3tyJErdKfUqzeN9xJREXHcfx0pUL5MyeW9IfzOiLyLg G6DzY94u8p/QWkvtzLQ/iFGdzSAJWD8F2evIvi92nug/z2pbT77zRIDcioX/R2n8/RHd a8r5L7VtHT3cI8tGSei/+p0QnueSB7LP7fdTi2Ya95syq0tirMS9YSnSZt5yCIYJo/m+ viUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=/4d0+qgfnvvR5I8UHYWN87SOmeaBTlNs0MmgbBFFTf8=; b=WgkPBeEg5Ime4vZZPb7tLVJP/LfNiZMgCuXlL6e7H3JIEhYx591yN8zahuQGuWMBFh 6uWEktTzFVfjtHflt1RrejEepQZBGQ9XnRTtBBCR+Z20LB+dSd66/F8qdfXBT+u+pmei LB1pLKHMaMKTdINrsoZHM2d4JvPyZXVK9qnqBeg/BAaU02kIg6eZE0K8RRJ4kAz2hRsh Pb04K1TyV2l9nU2FiV9YATRLKfvvd5zGahzSSeMVceYbptMzEXKvm/Oy4l8rVfht9Kw3 7txpuyjiKG57YO3CbeT3lVCtlTBBzzxOX5SwIJ5NQtsunqf3C/9E/iAKKvgo7m6xeF5f x/5A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s26si1454676eds.49.2020.10.01.08.47.16; Thu, 01 Oct 2020 08:47:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732534AbgJAPqJ (ORCPT + 99 others); Thu, 1 Oct 2020 11:46:09 -0400 Received: from smtp08.smtpout.orange.fr ([80.12.242.130]:27260 "EHLO smtp.smtpout.orange.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732360AbgJAPqJ (ORCPT ); Thu, 1 Oct 2020 11:46:09 -0400 Received: from tomoyo.flets-east.jp ([153.230.197.127]) by mwinf5d31 with ME id afls2300W2lQRaH03fm0uA; Thu, 01 Oct 2020 17:46:06 +0200 X-ME-Helo: tomoyo.flets-east.jp X-ME-Auth: bWFpbGhvbC52aW5jZW50QHdhbmFkb28uZnI= X-ME-Date: Thu, 01 Oct 2020 17:46:06 +0200 X-ME-IP: 153.230.197.127 From: Vincent Mailhol To: Marc Kleine-Budde , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-can@vger.kernel.org, Wolfgang Grandegger , "David S . Miller" Cc: Vincent Mailhol , Jakub Kicinski , Oliver Neukum , Greg Kroah-Hartman , Masahiro Yamada , Arunachalam Santhanam Subject: Re: [PATCH v2 2/6] can: dev: add a helper function Date: Fri, 2 Oct 2020 00:45:31 +0900 Message-Id: <20201001154531.3217-1-mailhol.vincent@wanadoo.fr> X-Mailer: git-send-email 2.26.2 In-Reply-To: <1798400d-abc1-e6dd-2d19-41e82ca6e43e@pengutronix.de> References: <20200926175810.278529-1-mailhol.vincent@wanadoo.fr> <20200930144602.10290-3-mailhol.vincent@wanadoo.fr> <1798400d-abc1-e6dd-2d19-41e82ca6e43e@pengutronix.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > > +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,