Re: [PATCH net-next 1/8] net: dsa: add tag driver for LAN9645X
From: Jens Emil Schulz Ostergaard
Date: Thu Mar 05 2026 - 08:03:40 EST
On Wed, 2026-03-04 at 16:23 +0100, Andrew Lunn wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>
> Please could you try moving these:
>
> > + BUILD_BUG_ON_MSG((_fld_sz) > 32, "IFH field size wider than 32.");\
> > + BUILD_BUG_ON_MSG((_fld_sz) == 0, "IFH field size of 0."); \
> > + BUILD_BUG_ON_MSG((_fld) + (_fld_sz) > LAN9645X_IFH_BITS, \
> > + "IFH field overflows IFH"); \
>
> > +static inline void lan9645x_ifh_set(u8 *ifh, u32 val, size_t pos, size_t length)
> > +{
> > + size_t end = (pos + length) - 1;
> > + size_t start_u8 = pos >> 3;
> > + size_t end_u8 = end >> 3;
> > + size_t end_rem = end & 0x7;
> > + size_t pos_rem = pos & 0x7;
> > + u8 end_mask, start_mask;
> > + size_t vshift;
> > + u8 *ptr;
>
> here.
>
> You are passing build time constant. The compiler should be able to
> track them through the call, especially since they are inline. So i
> think it should work. Please test it, deliberately break some of the
> #defines and make sure the build fails.
>
> I just think avoiding the macro would be nice, if possible.
>
> Andrew
Ok, I will try this, and see if I can lose the macro. Thank you.
Emil