@@ -79,9 +79,11 @@
#define _hr_reg_write(ptr, field_type, field_h, field_l, val) \
({ \
+ u32 _val = val; \
_hr_reg_clear(ptr, field_type, field_h, field_l); \
- *((__le32 *)ptr + (field_h) / 32) |= cpu_to_le32(FIELD_PREP( \
- GENMASK((field_h) % 32, (field_l) % 32), val)); \
+ *((__le32 *)ptr + (field_h) / 32) |= cpu_to_le32( \
+ FIELD_PREP(GENMASK((field_h) % 32, (field_l) % 32), \
+ _val & GENMASK((field_h) - (field_l), 0))); \
})
#define hr_reg_write(ptr, field, val) _hr_reg_write(ptr, field, val)