intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/i915: Reword warning for missing cases
@ 2018-03-13  0:03 Lucas De Marchi
  2018-03-13  0:17 ` Chris Wilson
                   ` (7 more replies)
  0 siblings, 8 replies; 17+ messages in thread
From: Lucas De Marchi @ 2018-03-13  0:03 UTC (permalink / raw)
  To: intel-gfx; +Cc: Daniel Vetter, Lucas De Marchi

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

^ permalink raw reply related	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2018-03-27 17:37 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-13  0:03 [PATCH] drm/i915: Reword warning for missing cases Lucas De Marchi
2018-03-13  0:17 ` 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

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).