Subject: Re: [PATCH 3/4] net: can: ifi: Fix RX and TX ID mask

From: Oliver Hartkopp <[email-masked]>
Date: Wed, 2 Mar 2016 07:10:10 +0100

Hi Marek,

On 03/01/2016 10:23 PM, Marek Vasut wrote:
> On 03/01/2016 06:49 PM, Oliver Hartkopp wrote:

>>> -#define IFI_CANFD_RXFIFO_ID_ID_STD_MASK		0x3ff
>>> +#define IFI_CANFD_RXFIFO_ID_ID_STD_MASK		0x7ff
>>>  #define IFI_CANFD_RXFIFO_ID_ID_XTD_MASK		0x1fffffff
>>
>> You should use the CAN_SFF_MASK and CAN_EFF_MASK in your code instead of
>> defining you private IFI_CANFD_RXFIFO_ID_ID_?TD_MASK definitions.
>>
>> You won't have trapped into this problem then :-)
> 
> These are register bitfield definitions, so should I really ?
> 
> My OCD kicks in and tells me it'd be odd and inconsistent with the rest
> of the bitfields, but if you prefer it that way, I'll just send an
> updated patch.
> 

Your bit mask is masking the CAN ID out of a given variable.
That's what CAN_SFF_MASK and CAN_EFF_MASK is made for.

So at least it should be:

#define IFI_CANFD_RXFIFO_ID_ID_STD_MASK		CAN_SFF_MASK
#define IFI_CANFD_RXFIFO_ID_ID_XTD_MASK		CAN_EFF_MASK

Btw. These defines are _never_ referenced in ifi_canfd.c so they should be
removed anyway.

Regards,
Oliver