Re: [PATCH v3 5/6] can: c_can: prepare to up the message objects number

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 01.03.2021 18:24:31, Dario Binacchi wrote:
> Hi Marc,
> 
> > Il 01/03/2021 14:08 Marc Kleine-Budde <mkl@xxxxxxxxxxxxxx> 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: signature.asc
Description: PGP signature


[Index of Archives]     [Automotive Discussions]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [CAN Bus]

  Powered by Linux