[Intel-gfx] [PATCH 2/5] drm/i915: replace IS_GEN<N> with IS_GEN(..., N)

Ville Syrjälä ville.syrjala at linux.intel.com
Thu Nov 1 13:27:56 UTC 2018


On Thu, Nov 01, 2018 at 01:17:07PM +0200, Jani Nikula wrote:
> On Thu, 01 Nov 2018, Lucas De Marchi <lucas.demarchi at intel.com> wrote:
> > Now that IS_GEN can accept 1 or 2 parameters, replace the use
> > of IS_GEN<N> by passing N as argument. This was generated with:
> 
> Ignoring the naming and all the contentious stuff about using the same
> macro for ranges and single gen, I think there's a useful discussion to
> be had here about defining IS_GEN<N> macros for every new generation
> vs. passing the gen to a macro.
> 
> I do prefer one IS_GEN(i915, N) over N instances of IS_GEN<N>(i915).

#define _IS_GEN(n) \
static inline bool IS_GEN ## n (... i915) { return IS_GEN(i915, n); }

_IS_GEN(2)
_IS_GEN(3)
...

I guess that's not much better apart from making typos harder to make.

-- 
Ville Syrjälä
Intel


More information about the Intel-gfx mailing list