Commit 94da8e5e authored by Ankit Nautiyal's avatar Ankit Nautiyal
Browse files

drm/i915/reg_defs: Add REG_FIELD_MAX wrapper for FIELD_MAX()



Introduce REG_FIELD_MAX macro as local wrapper around FIELD_MAX() to return
the maximum value representable by a bit mask. The value is cast to u32
for consistency with other REG_* macros and assumes the bitfield fits
within 32 bits.

v2: Use __mask as macro argument aligning with other macros. (Ville)

Signed-off-by: default avatarAnkit Nautiyal <ankit.k.nautiyal@intel.com>
Reviewed-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: default avatarAndi Shyti <andi.shyti@linux.intel.com>
Link: https://lore.kernel.org/r/20250924141542.3122126-8-ankit.k.nautiyal@intel.com
parent 4e5c033c
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -174,6 +174,16 @@
 */
#define REG_FIELD_GET8(__mask, __val)   ((u8)FIELD_GET(__mask, __val))

/**
 * REG_FIELD_MAX() - produce the maximum value representable by a field
 * @__mask: shifted mask defining the field's length and position
 *
 * Local wrapper for FIELD_MAX() to return the maximum bit value that can
 * be held in the field specified by @_mask, cast to u32 for consistency
 * with other macros.
 */
#define REG_FIELD_MAX(__mask)	((u32)FIELD_MAX(__mask))

typedef struct {
	u32 reg;
} i915_reg_t;