summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/i915/i915_drv.h
diff options
context:
space:
mode:
authorDamien Lespiau <damien.lespiau@intel.com>2014-03-31 11:24:08 +0100
committerDaniel Vetter <daniel.vetter@ffwll.ch>2014-04-01 22:58:23 +0200
commitaf76ae447d44bd60ec49988b1f28480c14fa79e5 (patch)
tree98d66914827e15816708aae4df7dced79792d125 /drivers/gpu/drm/i915/i915_drv.h
parentadb4bd123353772000aa687c2b88d5bc84c296e8 (diff)
downloadlwn-af76ae447d44bd60ec49988b1f28480c14fa79e5.tar.gz
lwn-af76ae447d44bd60ec49988b1f28480c14fa79e5.zip
drm/i915: Use a macro to express the range of valid gens for reg_read
The reg_read whitelist has a gen bitmask to code the gens we're allowing the register to be read on. Until now, it was a literal, but we can be a bit more expressive. To ease the review, a small test program: $ cat bit-range.c #include <stdio.h> #include <stdint.h> #define U32_C(x) x ## U #define GENMASK(h, l) (((U32_C(1) << ((h) - (l) + 1)) - 1) << (l)) #define GEN_RANGE(l, h) GENMASK(h, l) int main(int argc, char **argv) { printf("0x%08x\n", GEN_RANGE(1, 1)); printf("0x%08x\n", GEN_RANGE(1, 2)); printf("0x%08x\n", GEN_RANGE(4, 4)); printf("0x%08x\n", GEN_RANGE(4, 5)); printf("0x%08x\n", GEN_RANGE(1, 31)); printf("0x%08x\n", GEN_RANGE(4, 8)); return 0; } $ ./bit-range 0x00000002 0x00000006 0x00000010 0x00000030 0xfffffffe 0x000001f0 Signed-off-by: Damien Lespiau <damien.lespiau@intel.com> Reviewed-by: Jani Nikula <jani.nikula@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/i915/i915_drv.h')
0 files changed, 0 insertions, 0 deletions