aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/i915_dma.c
diff options
context:
space:
mode:
authorTvrtko Ursulin <tvrtko.ursulin@intel.com>2016-05-10 10:57:04 +0100
committerTvrtko Ursulin <tvrtko.ursulin@intel.com>2016-05-11 12:27:27 +0100
commitae5702d245c2328f1b4afa4ae7d39792a8064d48 (patch)
treeaf256c3c4d8059deb41a50ace3b231d6ec9c37ef /drivers/gpu/drm/i915/i915_dma.c
parentdrm/i915: Use drm_i915_private as the native pointer for intel_uncore.c (diff)
downloadlinux-dev-ae5702d245c2328f1b4afa4ae7d39792a8064d48.tar.xz
linux-dev-ae5702d245c2328f1b4afa4ae7d39792a8064d48.zip
drm/i915: Make IS_GENx macros work on a mask
If instead of numerical comparison me make these test a bitmask, we enable the compiler to optimize all instances of IS_GENx || IS_GENy. v2: Make bit zero of gen mask mean gen 1. Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'drivers/gpu/drm/i915/i915_dma.c')
-rw-r--r--drivers/gpu/drm/i915/i915_dma.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index b55fef3679d9..81856f126622 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -1073,6 +1073,9 @@ static int i915_driver_init_early(struct drm_i915_private *dev_priv,
memcpy(device_info, info, sizeof(dev_priv->info));
device_info->device_id = dev->pdev->device;
+ BUG_ON(device_info->gen > sizeof(device_info->gen_mask) * BITS_PER_BYTE);
+ device_info->gen_mask = BIT(device_info->gen - 1);
+
spin_lock_init(&dev_priv->irq_lock);
spin_lock_init(&dev_priv->gpu_error.lock);
mutex_init(&dev_priv->backlight_lock);