浏览代码

drm/i915: Make for_each_sprite() take dev_priv as argument

Implicit usage of local variables in macros isn't exactly the greatest
thing in the world, especially when that variable is the drm device and
we want to move towards a broader use of the i915 device structure.

Let's make for_each_sprite() take dev_priv as its first argument then.

Suggested-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Reviewed-by: Chris Wilson <chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Damien Lespiau 10 年之前
父节点
当前提交
3bdcfc0c2e
共有 2 个文件被更改,包括 7 次插入4 次删除
  1. 4 1
      drivers/gpu/drm/i915/i915_drv.h
  2. 3 3
      drivers/gpu/drm/i915/intel_display.c

+ 4 - 1
drivers/gpu/drm/i915/i915_drv.h

@@ -227,7 +227,10 @@ enum hpd_pin {
 	for ((__p) = 0;							\
 	for ((__p) = 0;							\
 	     (__p) < INTEL_INFO(__dev_priv)->num_sprites[(__pipe)] + 1;	\
 	     (__p) < INTEL_INFO(__dev_priv)->num_sprites[(__pipe)] + 1;	\
 	     (__p)++)
 	     (__p)++)
-#define for_each_sprite(p, s) for ((s) = 0; (s) < INTEL_INFO(dev)->num_sprites[(p)]; (s)++)
+#define for_each_sprite(__dev_priv, __p, __s)				\
+	for ((__s) = 0;							\
+	     (__s) < INTEL_INFO(__dev_priv)->num_sprites[(__p)];	\
+	     (__s)++)
 
 
 #define for_each_crtc(dev, crtc) \
 #define for_each_crtc(dev, crtc) \
 	list_for_each_entry(crtc, &dev->mode_config.crtc_list, head)
 	list_for_each_entry(crtc, &dev->mode_config.crtc_list, head)

+ 3 - 3
drivers/gpu/drm/i915/intel_display.c

@@ -1300,14 +1300,14 @@ static void assert_sprites_disabled(struct drm_i915_private *dev_priv,
 	u32 val;
 	u32 val;
 
 
 	if (INTEL_INFO(dev)->gen >= 9) {
 	if (INTEL_INFO(dev)->gen >= 9) {
-		for_each_sprite(pipe, sprite) {
+		for_each_sprite(dev_priv, pipe, sprite) {
 			val = I915_READ(PLANE_CTL(pipe, sprite));
 			val = I915_READ(PLANE_CTL(pipe, sprite));
 			I915_STATE_WARN(val & PLANE_CTL_ENABLE,
 			I915_STATE_WARN(val & PLANE_CTL_ENABLE,
 			     "plane %d assertion failure, should be off on pipe %c but is still active\n",
 			     "plane %d assertion failure, should be off on pipe %c but is still active\n",
 			     sprite, pipe_name(pipe));
 			     sprite, pipe_name(pipe));
 		}
 		}
 	} else if (IS_VALLEYVIEW(dev)) {
 	} else if (IS_VALLEYVIEW(dev)) {
-		for_each_sprite(pipe, sprite) {
+		for_each_sprite(dev_priv, pipe, sprite) {
 			reg = SPCNTR(pipe, sprite);
 			reg = SPCNTR(pipe, sprite);
 			val = I915_READ(reg);
 			val = I915_READ(reg);
 			I915_STATE_WARN(val & SP_ENABLE,
 			I915_STATE_WARN(val & SP_ENABLE,
@@ -13363,7 +13363,7 @@ void intel_modeset_init(struct drm_device *dev)
 
 
 	for_each_pipe(dev_priv, pipe) {
 	for_each_pipe(dev_priv, pipe) {
 		intel_crtc_init(dev, pipe);
 		intel_crtc_init(dev, pipe);
-		for_each_sprite(pipe, sprite) {
+		for_each_sprite(dev_priv, pipe, sprite) {
 			ret = intel_plane_init(dev, pipe, sprite);
 			ret = intel_plane_init(dev, pipe, sprite);
 			if (ret)
 			if (ret)
 				DRM_DEBUG_KMS("pipe %c sprite %c init failed: %d\n",
 				DRM_DEBUG_KMS("pipe %c sprite %c init failed: %d\n",