Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp918357pxb; Wed, 3 Mar 2021 21:01:46 -0800 (PST) X-Google-Smtp-Source: ABdhPJzReaD98hvNIRdbYiMLT8tgv2xcQshxozjKZ5xeV/9CVqvD68INEaya45M0ZAcTPxWA3xpD X-Received: by 2002:a05:6402:4309:: with SMTP id m9mr434220edc.25.1614834105986; Wed, 03 Mar 2021 21:01:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614834105; cv=none; d=google.com; s=arc-20160816; b=cDd74/TsmTApYhv9pQddcYhJza3SWBEQEuaJWjNz7NGTTmSrIRqNpL4uyauMAimhTO 3ic2+ulh5H/NfAxdhwoKJ0usa+9DdPzSAi2mE7xd2+CH7Ij+2+UTYrVyPviy3ei+QX2m ZLDfBO3gJJRRp7jB/N1k8KNHl+RIrk69NgDomrPCkPeZ5J/3J2ffH2N4noqh1mppawIy PGQAEhxhEAa4Y3zToYUKvEQue0nH+sREGR4JwbbGOX419HiJ1e5C2XzjV2g+dmYQk8fs 4XKCSxBiFFDdus7/qyqREhFJkYbB68+OKE+13ET7O3odi0ZI/KZq8DVasue0O1sfcJNU yj9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=VPocDek9jHsteYMTvckQdskCMrW6AfTgWMkUgYo5ZaA=; b=pD2org1d8S3AUXvTX2xKH/BGrh6r0TRsxTcYVZf23e6Dpg/MiRwfi8qFiLiN02yO5v ScFCpfjzw5QFFnVlkWKsbGaHfZnrbl2d5aRpwm+u1f0xBIISZf9czJPHLxQG7wrInZbv Ihn60prRf1yafqNQF7F1WZu2Uqtl5WeuE8U6XLzcAOGhajEN780A70MGWpPIBPfJyloq plH5Aixe9E1fRgnNWQE5KjlGn9Bzpeyoj8hxRuPtLFVySV3zA1Uk5Td8lyWXvMy4Lt1U R90rgvyH9IZgBPW2BeV49gI/Lf8C/RwUfGFKRNrrfzQDSpnZRbAmanc3uJZVHfrQQrg9 dMQA== 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 p17si10727734edy.508.2021.03.03.21.01.23; Wed, 03 Mar 2021 21:01:45 -0800 (PST) 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 S1443823AbhCBCg5 (ORCPT + 99 others); Mon, 1 Mar 2021 21:36:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242159AbhCATwp (ORCPT ); Mon, 1 Mar 2021 14:52:45 -0500 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F3DC9C0617A7 for ; Mon, 1 Mar 2021 11:49:27 -0800 (PST) Received: from gallifrey.ext.pengutronix.de ([2001:67c:670:201:5054:ff:fe8d:eefb] helo=bjornoya.blackshift.org) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lGoXg-0000JO-D9; Mon, 01 Mar 2021 20:49:20 +0100 Received: from pengutronix.de (unknown [IPv6:2a03:f580:87bc:d400:bdf1:58e9:8113:f2a1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: mkl-all@blackshift.org) by smtp.blackshift.org (Postfix) with ESMTPSA id 2555D5EBC2D; Mon, 1 Mar 2021 19:46:54 +0000 (UTC) Date: Mon, 1 Mar 2021 20:46:53 +0100 From: Marc Kleine-Budde To: Dario Binacchi Cc: linux-kernel@vger.kernel.org, Federico Vaga , Oliver Hartkopp , Vincent Mailhol , YueHaibing , Zhang Qilong , linux-can@vger.kernel.org, netdev@vger.kernel.org Subject: Re: [PATCH v3 5/6] can: c_can: prepare to up the message objects number Message-ID: <20210301194653.egjnrysvfmqusd45@pengutronix.de> References: <20210228103856.4089-1-dariobin@libero.it> <20210228103856.4089-6-dariobin@libero.it> <20210301113805.jylhc373sip7zmed@pengutronix.de> <20210301130845.3s45ujmhkazscm6x@pengutronix.de> <198393892.577352.1614619471062@mail1.libero.it> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="df4yjeailgg3kxvn" Content-Disposition: inline In-Reply-To: <198393892.577352.1614619471062@mail1.libero.it> X-SA-Exim-Connect-IP: 2001:67c:670:201:5054:ff:fe8d:eefb X-SA-Exim-Mail-From: mkl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --df4yjeailgg3kxvn Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 01.03.2021 18:24:31, Dario Binacchi wrote: > Hi Marc, >=20 > > Il 01/03/2021 14:08 Marc Kleine-Budde ha scritto: > >=20 > > =20 > > On 01.03.2021 12:38:05, Marc Kleine-Budde wrote: > > > On 28.02.2021 11:38:54, Dario Binacchi wrote: > > > [...] > > >=20 > > > > @@ -730,7 +728,7 @@ static void c_can_do_tx(struct net_device *dev) > > > > while ((idx =3D ffs(pend))) { > > > > idx--; > > > > pend &=3D ~(1 << idx); > > > > - obj =3D idx + C_CAN_MSG_OBJ_TX_FIRST; > > > > + obj =3D idx + priv->msg_obj_tx_first; > > > > c_can_inval_tx_object(dev, IF_TX, obj); > > > > can_get_echo_skb(dev, idx, NULL); > > > > bytes +=3D priv->dlc[idx]; > > > > @@ -740,7 +738,7 @@ static void c_can_do_tx(struct net_device *dev) > > > > /* Clear the bits in the tx_active mask */ > > > > atomic_sub(clr, &priv->tx_active); > > > > =20 > > > > - if (clr & (1 << (C_CAN_MSG_OBJ_TX_NUM - 1))) > > > > + if (clr & (1 << (priv->msg_obj_tx_num - 1))) > > >=20 > > > Do we need 1UL here, too? > >=20 > > There are several more "1 <<" in the driver. As the right side of the > > sift operation can be up to 32, I think you should replace all "1 <<" > > with "1UL <<". >=20 > Do you agree if I use the BIT macro for all these shift operations? No, only use BIT(), where you want to set a single bit, use GENMASK() for masks. regards, Marc --=20 Pengutronix e.K. | Marc Kleine-Budde | Embedded Linux | https://www.pengutronix.de | Vertretung West/Dortmund | Phone: +49-231-2826-924 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | --df4yjeailgg3kxvn Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEK3kIWJt9yTYMP3ehqclaivrt76kFAmA9RKsACgkQqclaivrt 76k8bwgAseV6n0GjZF7s/1Dg64W063rxRs/X0o6rdNGyZyEgx6gl5hLuF/Z3bCMf 7mw4mPC0Ub4TEH14CdDb23LW2xXDPyyDgUcE00T2Qmp4GQZACqYJQinvUS7mF6Uv T1fHr6ynyjfu1XSkLWespNXbG3rDbbd/78FiT9P3frbCkA4AJR2bUvODbX6fiHNW u3KvKUtRx5aJEmHHBRhT95JIRRP4DRPOfs9C8c+S9HtwYPX4+OT8lWde2roUWUPw Il8VkTofjEWe6W+bUkAcTa44/fxAoilok3EPtrEuaaDIFrt2o/uERqM3hgZR/xM6 jY8jIasV+bRLv5XbJbKQCCfzzxoQRQ== =M5u4 -----END PGP SIGNATURE----- --df4yjeailgg3kxvn--