Re: [PATCH net-next 1/8] net: dsa: add tag driver for LAN9645X

From: Andrew Lunn

Date: Wed Mar 04 2026 - 10:27:55 EST


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