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:
quoted
+ 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"); \
quoted
+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