Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp4409801pxb; Tue, 2 Mar 2021 14:44:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJyPAAXbR9rwfQDkuecar0tSXaxm7PppwaYev5A3rhmk/GANR8cxWsyb01BuNiHvIKxeIZwO X-Received: by 2002:a17:907:962a:: with SMTP id gb42mr22463990ejc.206.1614725091902; Tue, 02 Mar 2021 14:44:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614725091; cv=none; d=google.com; s=arc-20160816; b=g6asHM6HQ4nqEushvw5c7VVlOio3umUzPSw3wa75tClS171QQbnrbPL5dCwP3IIpx7 vF/o9UBJKUJiszyPbOShTqCcbcE6jbZYggJIeNk6i/8QufITZKnj+FdXpSUEYJ94q017 oAZ5HZIWyGt/VgqKQSYZKOQWjLqZjS3EvV+x/U9KzN3p5BZhaiRCCA2YzXZRkEOZKoEd 9pyRcYvhlg8QoL9uALLEN41BeA6Vf2Qx+dPxWsOC0m8b+cRI8SPfmEpglS7BSwU8EqJr fPEWiAm7AYZoYEZxA0gtF+uN2nkzzRZSRSHVX3jxB6h1jaHCJPs+GE2McjL9lWuncZCM mrVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:importance:content-transfer-encoding :mime-version:subject:references:in-reply-to:message-id:cc:to:from :date:dkim-signature; bh=C0Y4sFONm5SoSXiJY4aW33P4LBjyO5IeaOw3cbk+ueA=; b=mDWUGT2BXMNOUzNk3Lqd57V2c2mISqZj1YjufKSa/BkF+RV3rRB9lUmJXw8ol+OMJX KQVCc0NNeWKxFs97aVHOmUhbLRvAGswA357nI2Z4OQU0MQmI/FKPGjSmGMKB4+oTUbBI FmvKOEx2s2ap0+82uBZ8d0nfZPU02Y0P/L5jSf+inpkqJSCaHA2jpX0aSAImmBcb8Rsq esKCeEgO4Xj/4eS8plb4D9mmoXmI8dhD9mu4xICANr63saXzYF78pWnh03c7eOc+INng +7q28ni4YXy85aW+++gV/xLDdInVGJyA0dGJa81u3rxeMPhwvofqeNY57RWv77pRjj0S Zk2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@libero.it header.s=s2021 header.b=TEOGE+yO; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=libero.it Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k5si13855067ejo.356.2021.03.02.14.44.29; Tue, 02 Mar 2021 14:44:51 -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; dkim=pass header.i=@libero.it header.s=s2021 header.b=TEOGE+yO; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=libero.it Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349637AbhCBK7e (ORCPT + 99 others); Tue, 2 Mar 2021 05:59:34 -0500 Received: from smtp-34-i2.italiaonline.it ([213.209.12.34]:49517 "EHLO libero.it" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1383213AbhCBKvw (ORCPT ); Tue, 2 Mar 2021 05:51:52 -0500 Received: from oxapps-10-055.iol.local ([10.101.8.65]) by smtp-34.iol.local with ESMTPA id H2c8l94sm5WrZH2c8l4zHI; Tue, 02 Mar 2021 11:50:53 +0100 x-libjamoibt: 1601 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=libero.it; s=s2021; t=1614682253; bh=C0Y4sFONm5SoSXiJY4aW33P4LBjyO5IeaOw3cbk+ueA=; h=From; b=TEOGE+yOsT2CVAVfBpT55ktP1Xt651fAY6ar2GbaDm7U/NUrpOsXk7aCYUIPjqRcp akYr+SmiXwSksRBJDhFC2hi1uxvziAA8XoniQtmhHzbqMIHQ/qOwArUjSfeS1zFu3o Nx2RwlYtv/19BWc8aEmntRDSyAu+MHSYhdLJOi92j7F7BIYiXkyOI3bCSn87qOwLRS M5RMklT6+BlO3c4mj2oLpkXMgw7wz7HW6yg//blJSA0GqZHNfiPYuxLpumcbPeR0ti xAxIsIHn0bD/ZQksrrx9+X01qO+9oi3fzctkrUxUum5gO8+qjPU8HKjsUP5wmKziEx U/hBlH/Kyr9gQ== X-CNFS-Analysis: v=2.4 cv=W4/96Tak c=1 sm=1 tr=0 ts=603e188d cx=a_exe a=Xcto81xy1FNFSyA6Xjc/hA==:117 a=C-c6dMTymFoA:10 a=IkcTkHD0fZMA:10 a=vesc6bHxzc4A:10 a=bGNZPXyTAAAA:8 a=bAF_0_vCazFOC95qmekA:9 a=XoIhxgry9z_zYQRl:21 a=C3h1kYaqPfvzLjQo:21 a=QEXdDO2ut3YA:10 a=yL4RfsBhuEsimFDS2qtJ:22 Date: Tue, 2 Mar 2021 11:50:52 +0100 (CET) From: Dario Binacchi To: Marc Kleine-Budde Cc: linux-kernel@vger.kernel.org, Federico Vaga , Alexander Stein , "David S. Miller" , Jakub Kicinski , Oliver Hartkopp , Vincent Mailhol , Wolfgang Grandegger , YueHaibing , Zhang Qilong , linux-can@vger.kernel.org, netdev@vger.kernel.org Message-ID: <1154674280.137227.1614682252245@mail1.libero.it> In-Reply-To: <20210301194550.6zqmxzcwvzlgjzcj@pengutronix.de> References: <20210228103856.4089-1-dariobin@libero.it> <20210228103856.4089-6-dariobin@libero.it> <20210301113805.jylhc373sip7zmed@pengutronix.de> <1037673059.602534.1614619302914@mail1.libero.it> <20210301194550.6zqmxzcwvzlgjzcj@pengutronix.de> Subject: Re: [PATCH v3 5/6] can: c_can: prepare to up the message objects number MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Priority: 3 Importance: Normal X-Mailer: Open-Xchange Mailer v7.10.3-Rev27 X-Originating-IP: 185.33.57.41 X-Originating-Client: open-xchange-appsuite x-libjamsun: DN0WFxwHZZBmmj1Vh68r9MQebC1YSHja x-libjamv: IMPIRE54ZRQ= X-CMAE-Envelope: MS4xfKQeFdU7BSumWpmVQBKsGr4VpPRiCP/7k7PB9FLsRuqIaDY7Ona0hmUU6N/B5DIVWQvMQD8StjtZFr4F9LfVtSx2JHIkXb4XhnQE1/ixDLmB9cPB2aNH AjFs+/CkfS9ycR41Jq47Hao3dAG4VGpMfmC0SjmnozacTl23KKcZErms0ztaK/6ddui3KIoDOXy+K+SjyqVLMiCgPPtpITMqepbuOw599+VQ9pJFnU6GBel7 MgFOf7pbgHUfiuTL4z/QpKYlJ/Zzrf1nDFfzBCRMEhvRVs1sXsjQHpevXITwSWtkwZAiVGON/1HIHa16rDRB7C0i575W86ivbCiI5x/A7e6xbKGBE8Lb2HLJ pFQxNe6/7QpT9aJJZJKISLy7tQQAx29RHjgZe+gFVo+59YRc4OstqEQHGVrRzPi966awYxNu29OQjQLeobMbQLsLyuohOqK81peK2219k4NS9mQ4YUit0ePN 2DD/i+JPOCJAab6MUDkXMmdAHCy0jt+CfUm5jkiSYMqWy7sNJmMdHwKs795cyLaIZAUQhDc+gDpbiwSlRTl345kkgcYWXcycUxNSNQkb8VgdY8m84WsH7m/u 9ePeV1wr0m0DY8XacuidtJynv7Ptiz2p2hGEUDf1mfVnJw== Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Marc, > Il 01/03/2021 20:45 Marc Kleine-Budde ha scritto: > > > On 01.03.2021 18:21:42, Dario Binacchi wrote: > > > > @@ -730,7 +728,7 @@ static void c_can_do_tx(struct net_device *dev) > > > > while ((idx = ffs(pend))) { > > > > idx--; > > > > pend &= ~(1 << idx); > > > > - obj = idx + C_CAN_MSG_OBJ_TX_FIRST; > > > > + obj = idx + priv->msg_obj_tx_first; > > > > c_can_inval_tx_object(dev, IF_TX, obj); > > > > can_get_echo_skb(dev, idx, NULL); > > > > bytes += 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); > > > > > > > > - if (clr & (1 << (C_CAN_MSG_OBJ_TX_NUM - 1))) > > > > + if (clr & (1 << (priv->msg_obj_tx_num - 1))) > > > > > > Do we need 1UL here, too? > > > > Do you agree if I use the BIT macro ? > > No, please use GENMASK(priv->msg_obj_tx_num, 0) here. > In case of 64 message objects, msg_obj_tx_num = 32, and 1 << (priv->msg_obj_tx_num - 1) = 0x80000000. GENMASK(priv->msg_obj_tx_num, 0) = 0. BIT(priv->msg_obj_tx_num - 1) = 0x80000000. Thanks and regards, Dario > regrads, > Marc > > -- > 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 |