[Intel-gfx] [PATCH 3/7] drm/i915: use variable arguments for the macros that call _PICK
Rodrigo Vivi
rodrigo.vivi at gmail.com
Wed Jun 14 17:25:29 UTC 2017
On Tue, Jun 13, 2017 at 12:33 PM, Paulo Zanoni <paulo.r.zanoni at intel.com> wrote:
> There's no need to create a new macro every time the number of
> parameters change.
fully agree
>
> Signed-off-by: Paulo Zanoni <paulo.r.zanoni at intel.com>
> ---
> drivers/gpu/drm/i915/i915_reg.h | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
> index 1983b75..1d5a0f8 100644
> --- a/drivers/gpu/drm/i915/i915_reg.h
> +++ b/drivers/gpu/drm/i915/i915_reg.h
> @@ -52,7 +52,7 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)
>
> #define _PIPE(pipe, a, b) ((a) + (pipe)*((b)-(a)))
> #define _MMIO_PIPE(pipe, a, b) _MMIO(_PIPE(pipe, a, b))
> -#define _MMIO_PIPE3(pipe, a, b, c) _MMIO(_PICK(pipe, a, b, c))
> +#define _MMIO_PIPE3(pipe, ...) _MMIO(_PICK(pipe, __VA_ARGS__))
>
> #define _PLANE(plane, a, b) _PIPE(plane, a, b)
> #define _MMIO_PLANE(plane, a, b) _MMIO_PIPE(plane, a, b)
> @@ -62,8 +62,8 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)
>
> #define _PORT(port, a, b) ((a) + (port)*((b)-(a)))
> #define _MMIO_PORT(port, a, b) _MMIO(_PORT(port, a, b))
> -#define _MMIO_PORT3(port, a, b, c) _MMIO(_PICK(port, a, b, c))
> -#define _MMIO_PORT6(port, a, b, c, d, e, f) _MMIO(_PICK(port, a, b, c, d, e, f))
> +#define _MMIO_PORT3(port, ...) _MMIO(_PICK(port, __VA_ARGS__))
> +#define _MMIO_PORT6(port, ...) _MMIO(_PICK(port, __VA_ARGS__))
so, what about unifying MMIO_PORT3 and MMIO_PORT6 at least?
MMIO_PORTS, MMIO_PICK?
> #define _MMIO_PORT6_LN(port, ln, a0, a1, b, c, d, e, f) \
> _MMIO(_PICK(port, a0, b, c, d, e, f) + (ln * (a1 - a0)))
>
> @@ -71,7 +71,7 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)
> #define _MMIO_PLL(pll, a, b) _MMIO(_PLL(pll, a, b))
>
> #define _PHY3(phy, ...) _PICK(phy, __VA_ARGS__)
> -#define _MMIO_PHY3(phy, a, b, c) _MMIO(_PHY3(phy, a, b, c))
> +#define _MMIO_PHY3(phy, ...) _MMIO(_PHY3(phy, __VA_ARGS__))
>
> #define _MASKED_FIELD(mask, value) ({ \
> if (__builtin_constant_p(mask)) \
> --
> 2.9.4
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
More information about the Intel-gfx
mailing list