[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3e02f656-573d-8615-60c7-7c62af615a10@pengutronix.de>
Date: Tue, 2 Mar 2021 11:56:32 +0100
From: Marc Kleine-Budde <mkl@...gutronix.de>
To: Dario Binacchi <dariobin@...ero.it>
Cc: linux-kernel@...r.kernel.org,
Federico Vaga <federico.vaga@...il.com>,
Alexander Stein <alexander.stein@...tec-electronic.com>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Oliver Hartkopp <socketcan@...tkopp.net>,
Vincent Mailhol <mailhol.vincent@...adoo.fr>,
Wolfgang Grandegger <wg@...ndegger.com>,
YueHaibing <yuehaibing@...wei.com>,
Zhang Qilong <zhangqilong3@...wei.com>,
linux-can@...r.kernel.org, netdev@...r.kernel.org
Subject: Re: [PATCH v3 5/6] can: c_can: prepare to up the message objects
number
On 3/2/21 11:50 AM, Dario Binacchi wrote:
> Hi Marc,
>
>> Il 01/03/2021 20:45 Marc Kleine-Budde <mkl@...gutronix.de> 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.
Doh! I've misread where the -1 is places.
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 |
Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)
Powered by blists - more mailing lists