mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-05 09:49:58 -04:00
drm/i915/reg: move pick even and pick to reg defs
This is a more logical place for generic helpers. Cc: Lucas De Marchi <lucas.demarchi@intel.com> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Jani Nikula <jani.nikula@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/623327aee73a515300d99c8d65552ca92f3f0721.1668008071.git.jani.nikula@intel.com
This commit is contained in:
@@ -117,21 +117,6 @@
|
||||
|
||||
#define DISPLAY_MMIO_BASE(dev_priv) (INTEL_INFO(dev_priv)->display.mmio_offset)
|
||||
|
||||
/*
|
||||
* Given the first two numbers __a and __b of arbitrarily many evenly spaced
|
||||
* numbers, pick the 0-based __index'th value.
|
||||
*
|
||||
* Always prefer this over _PICK() if the numbers are evenly spaced.
|
||||
*/
|
||||
#define _PICK_EVEN(__index, __a, __b) ((__a) + (__index) * ((__b) - (__a)))
|
||||
|
||||
/*
|
||||
* Given the arbitrary numbers in varargs, pick the 0-based __index'th number.
|
||||
*
|
||||
* Always prefer _PICK_EVEN() over this if the numbers are evenly spaced.
|
||||
*/
|
||||
#define _PICK(__index, ...) (((const u32 []){ __VA_ARGS__ })[__index])
|
||||
|
||||
/*
|
||||
* Named helper wrappers around _PICK_EVEN() and _PICK().
|
||||
*/
|
||||
|
||||
@@ -111,6 +111,21 @@
|
||||
#define _MASKED_BIT_ENABLE(a) ({ typeof(a) _a = (a); _MASKED_FIELD(_a, _a); })
|
||||
#define _MASKED_BIT_DISABLE(a) (_MASKED_FIELD((a), 0))
|
||||
|
||||
/*
|
||||
* Given the first two numbers __a and __b of arbitrarily many evenly spaced
|
||||
* numbers, pick the 0-based __index'th value.
|
||||
*
|
||||
* Always prefer this over _PICK() if the numbers are evenly spaced.
|
||||
*/
|
||||
#define _PICK_EVEN(__index, __a, __b) ((__a) + (__index) * ((__b) - (__a)))
|
||||
|
||||
/*
|
||||
* Given the arbitrary numbers in varargs, pick the 0-based __index'th number.
|
||||
*
|
||||
* Always prefer _PICK_EVEN() over this if the numbers are evenly spaced.
|
||||
*/
|
||||
#define _PICK(__index, ...) (((const u32 []){ __VA_ARGS__ })[__index])
|
||||
|
||||
typedef struct {
|
||||
u32 reg;
|
||||
} i915_reg_t;
|
||||
|
||||
Reference in New Issue
Block a user