From: Marc Kleine-Budde <mkl@pengutronix.de>
To: Dario Binacchi <dariobin@libero.it>
Cc: linux-kernel@vger.kernel.org,
Federico Vaga <federico.vaga@gmail.com>,
Oliver Hartkopp <socketcan@hartkopp.net>,
Vincent Mailhol <mailhol.vincent@wanadoo.fr>,
YueHaibing <yuehaibing@huawei.com>,
Zhang Qilong <zhangqilong3@huawei.com>,
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
Date: Mon, 1 Mar 2021 20:46:53 +0100 [thread overview]
Message-ID: <20210301194653.egjnrysvfmqusd45@pengutronix.de> (raw)
In-Reply-To: <198393892.577352.1614619471062@mail1.libero.it>
[-- Attachment #1: Type: text/plain, Size: 1645 bytes --]
On 01.03.2021 18:24:31, Dario Binacchi wrote:
> Hi Marc,
>
> > Il 01/03/2021 14:08 Marc Kleine-Budde <mkl@pengutronix.de> ha scritto:
> >
> >
> > On 01.03.2021 12:38:05, Marc Kleine-Budde wrote:
> > > On 28.02.2021 11:38:54, 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?
> >
> > 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 <<".
>
> 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
--
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 |
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2021-03-01 20:00 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-28 10:38 [PATCH v3 0/6] can: c_can: add support to 64 message objects Dario Binacchi
2021-02-28 10:38 ` [PATCH v3 1/6] can: c_can: remove unused code Dario Binacchi
2021-02-28 10:38 ` [PATCH v3 2/6] can: c_can: fix indentation Dario Binacchi
2021-02-28 10:38 ` [PATCH v3 3/6] can: c_can: fix control interface used by c_can_do_tx Dario Binacchi
2021-03-02 18:44 ` Kurt Van Dijck
2021-03-03 7:22 ` Dario Binacchi
2021-02-28 10:38 ` [PATCH v3 4/6] can: c_can: use 32-bit write to set arbitration register Dario Binacchi
2021-02-28 10:38 ` [PATCH v3 5/6] can: c_can: prepare to up the message objects number Dario Binacchi
2021-03-01 11:38 ` Marc Kleine-Budde
2021-03-01 13:08 ` Marc Kleine-Budde
2021-03-01 16:54 ` Marc Kleine-Budde
2021-03-01 17:24 ` Dario Binacchi
2021-03-01 19:46 ` Marc Kleine-Budde [this message]
2021-03-01 17:21 ` Dario Binacchi
2021-03-01 19:45 ` Marc Kleine-Budde
2021-03-02 10:50 ` Dario Binacchi
2021-03-02 10:56 ` Marc Kleine-Budde
2021-03-02 18:49 ` Kurt Van Dijck
2021-03-03 8:23 ` Dario Binacchi
2021-03-03 9:00 ` Marc Kleine-Budde
2021-03-03 10:31 ` Dario Binacchi
2021-03-03 10:36 ` Marc Kleine-Budde
2021-02-28 10:38 ` [PATCH v3 6/6] can: c_can: add support to 64 message objects Dario Binacchi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210301194653.egjnrysvfmqusd45@pengutronix.de \
--to=mkl@pengutronix.de \
--cc=dariobin@libero.it \
--cc=federico.vaga@gmail.com \
--cc=linux-can@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mailhol.vincent@wanadoo.fr \
--cc=netdev@vger.kernel.org \
--cc=socketcan@hartkopp.net \
--cc=yuehaibing@huawei.com \
--cc=zhangqilong3@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).