intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Lucas De Marchi <lucas.demarchi@intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>,
	Lucas De Marchi <lucas.demarchi@intel.com>
Subject: [PATCH] drm/i915: Reword warning for missing cases
Date: Mon, 12 Mar 2018 17:03:12 -0700	[thread overview]
Message-ID: <20180313000312.24268-1-lucas.demarchi@intel.com> (raw)

In some places we end up converting switch statements to a series of
if/else, particularly when introducing helper functions to handle a
group of cases. It's tempting to either leave a wrong warning (since now
we don't have a switch case anymore) or to convert to WARN(1, ...),
losing what MISSING_CASE() provides: source location and id number.

Fix the message to allow reusing MISSING_CASE() - it may not always be
correct (e.g. if you are not checking an id anymore), but it avoids
useless conversions. A quick grep reveals at least a few users in
drivers/gpu/drm/i915/intel_csr.c and drivers/gpu/drm/i915/intel_ddi.c.

Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
---
 drivers/gpu/drm/i915/i915_utils.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_utils.h b/drivers/gpu/drm/i915/i915_utils.h
index 51dbfe5bb418..8cdc21b92f5f 100644
--- a/drivers/gpu/drm/i915/i915_utils.h
+++ b/drivers/gpu/drm/i915/i915_utils.h
@@ -40,7 +40,7 @@
 #undef WARN_ON_ONCE
 #define WARN_ON_ONCE(x) WARN_ONCE((x), "%s", "WARN_ON_ONCE(" __stringify(x) ")")
 
-#define MISSING_CASE(x) WARN(1, "Missing switch case (%lu) in %s\n", \
+#define MISSING_CASE(x) WARN(1, "Missing case (%lu) in %s\n", \
 			     (long)(x), __func__)
 
 #if GCC_VERSION >= 70000
-- 
2.14.3

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

             reply	other threads:[~2018-03-13  0:03 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-13  0:03 Lucas De Marchi [this message]
2018-03-13  0:17 ` [PATCH] drm/i915: Reword warning for missing cases Chris Wilson
2018-03-13 13:01   ` Ville Syrjälä
2018-03-13 13:06     ` Chris Wilson
2018-03-13 13:23       ` Ville Syrjälä
2018-03-14 21:59         ` Lucas De Marchi
2018-03-19 17:37           ` [PATCH v2] " Lucas De Marchi
2018-03-19 21:41             ` Chris Wilson
2018-03-27 17:37               ` Rodrigo Vivi
2018-03-13  0:39 ` ✓ Fi.CI.BAT: success for " Patchwork
2018-03-13  6:15 ` ✓ Fi.CI.IGT: " Patchwork
2018-03-19 18:36 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Reword warning for missing cases (rev2) Patchwork
2018-03-19 21:55   ` Lucas De Marchi
2018-03-19 18:51 ` ✗ Fi.CI.BAT: failure " Patchwork
2018-03-26 18:23 ` ✗ Fi.CI.CHECKPATCH: warning " Patchwork
2018-03-26 18:40 ` ✓ Fi.CI.BAT: success " Patchwork
2018-03-26 19:57 ` ✓ Fi.CI.IGT: " Patchwork

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=20180313000312.24268-1-lucas.demarchi@intel.com \
    --to=lucas.demarchi@intel.com \
    --cc=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;
as well as URLs for NNTP newsgroup(s).