Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel.vetter@ffwll.ch>
To: Intel Graphics Development <intel-gfx@lists.freedesktop.org>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Subject: [PATCH 2/4] drm/i915: introduce macros to check pipe config properties
Date: Fri, 19 Apr 2013 11:25:34 +0200	[thread overview]
Message-ID: <1366363536-16062-2-git-send-email-daniel.vetter@ffwll.ch> (raw)
In-Reply-To: <1366363536-16062-1-git-send-email-daniel.vetter@ffwll.ch>

This code will get _really_ repetive, and we'll end up with tons more
of this kind. So extract the common patterns.

This should also help when we add a lazy pipe_config compare mode for
fastboot.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/gpu/drm/i915/intel_display.c | 24 +++++++++++-------------
 1 file changed, 11 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 27a9ef6..7216ba5 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -7930,21 +7930,19 @@ static bool
 intel_pipe_config_compare(struct intel_crtc_config *current_config,
 			  struct intel_crtc_config *pipe_config)
 {
-	if (current_config->has_pch_encoder != pipe_config->has_pch_encoder) {
-		DRM_ERROR("mismatch in has_pch_encoder "
-			  "(expected %i, found %i)\n",
-			  current_config->has_pch_encoder,
-			  pipe_config->has_pch_encoder);
-		return false;
+#define PIPE_CONF_CHECK_I(name)	\
+	if (current_config->name != pipe_config->name) { \
+		DRM_ERROR("mismatch in " #name " " \
+			  "(expected %i, found %i)\n", \
+			  current_config->name, \
+			  pipe_config->name); \
+		return false; \
 	}
 
-	if (current_config->fdi_lanes != pipe_config->fdi_lanes) {
-		DRM_ERROR("mismatch in fdi_lanes "
-			  "(expected %i, found %i)\n",
-			  current_config->fdi_lanes,
-			  pipe_config->fdi_lanes);
-		return false;
-	}
+	PIPE_CONF_CHECK_I(has_pch_encoder);
+	PIPE_CONF_CHECK_I(fdi_lanes);
+
+#undef PIPE_CONF_CHECK_I
 
 	return true;
 }
-- 
1.7.11.7

  reply	other threads:[~2013-04-19  9:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-19  9:25 [PATCH 1/4] drm/i915: stop for_each_intel_crtc_masked macro from leaking Daniel Vetter
2013-04-19  9:25 ` Daniel Vetter [this message]
2013-04-19  9:25 ` [PATCH 3/4] drm/i915: hw state readout support for fdi m/n Daniel Vetter
2013-04-19  9:25 ` [PATCH 4/4] drm/i915: hw state readout support for pipe timings Daniel Vetter
2013-04-19 18:15   ` [PATCH] " Daniel Vetter
2013-04-25 14:24     ` Mika Kuoppala
2013-04-29 20:14       ` Daniel Vetter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1366363536-16062-2-git-send-email-daniel.vetter@ffwll.ch \
    --to=daniel.vetter@ffwll.ch \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox