Commit 9a3b466b authored by Pankaj Bharadiya's avatar Pankaj Bharadiya Committed by Jani Nikula

drm/i915/display/audio: Make WARN* drm specific where drm_priv ptr is available

drm specific WARN* calls include device information in the
backtrace, so we know what device the warnings originate from.

Covert all the calls of WARN* with device specific drm_WARN*
variants in functions where drm_i915_private struct pointer is readily
available.

The conversion was done automatically with below coccinelle semantic
patch. checkpatch errors/warnings are fixed manually.

@rule1@
identifier func, T;
@@
func(...) {
...
struct drm_i915_private *T = ...;
<+...
(
-WARN(
+drm_WARN(&T->drm,
...)
|
-WARN_ON(
+drm_WARN_ON(&T->drm,
...)
|
-WARN_ONCE(
+drm_WARN_ONCE(&T->drm,
...)
|
-WARN_ON_ONCE(
+drm_WARN_ON_ONCE(&T->drm,
...)
)
...+>
}

@rule2@
identifier func, T;
@@
func(struct drm_i915_private *T,...) {
<+...
(
-WARN(
+drm_WARN(&T->drm,
...)
|
-WARN_ON(
+drm_WARN_ON(&T->drm,
...)
|
-WARN_ONCE(
+drm_WARN_ONCE(&T->drm,
...)
|
-WARN_ON_ONCE(
+drm_WARN_ON_ONCE(&T->drm,
...)
)
...+>
}
Signed-off-by: default avatarPankaj Bharadiya <pankaj.laxminarayan.bharadiya@intel.com>
Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200128181603.27767-3-pankaj.laxminarayan.bharadiya@intel.com
parent 3dbe5e11
...@@ -572,7 +572,7 @@ static void ilk_audio_codec_disable(struct intel_encoder *encoder, ...@@ -572,7 +572,7 @@ static void ilk_audio_codec_disable(struct intel_encoder *encoder,
encoder->base.base.id, encoder->base.name, encoder->base.base.id, encoder->base.name,
pipe_name(pipe)); pipe_name(pipe));
if (WARN_ON(port == PORT_A)) if (drm_WARN_ON(&dev_priv->drm, port == PORT_A))
return; return;
if (HAS_PCH_IBX(dev_priv)) { if (HAS_PCH_IBX(dev_priv)) {
...@@ -623,7 +623,7 @@ static void ilk_audio_codec_enable(struct intel_encoder *encoder, ...@@ -623,7 +623,7 @@ static void ilk_audio_codec_enable(struct intel_encoder *encoder,
encoder->base.base.id, encoder->base.name, encoder->base.base.id, encoder->base.name,
pipe_name(pipe), drm_eld_size(eld)); pipe_name(pipe), drm_eld_size(eld));
if (WARN_ON(port == PORT_A)) if (drm_WARN_ON(&dev_priv->drm, port == PORT_A))
return; return;
/* /*
...@@ -847,7 +847,7 @@ static void glk_force_audio_cdclk(struct drm_i915_private *dev_priv, ...@@ -847,7 +847,7 @@ static void glk_force_audio_cdclk(struct drm_i915_private *dev_priv,
drm_modeset_acquire_init(&ctx, 0); drm_modeset_acquire_init(&ctx, 0);
state = drm_atomic_state_alloc(&dev_priv->drm); state = drm_atomic_state_alloc(&dev_priv->drm);
if (WARN_ON(!state)) if (drm_WARN_ON(&dev_priv->drm, !state))
return; return;
state->acquire_ctx = &ctx; state->acquire_ctx = &ctx;
...@@ -860,7 +860,7 @@ static void glk_force_audio_cdclk(struct drm_i915_private *dev_priv, ...@@ -860,7 +860,7 @@ static void glk_force_audio_cdclk(struct drm_i915_private *dev_priv,
goto retry; goto retry;
} }
WARN_ON(ret); drm_WARN_ON(&dev_priv->drm, ret);
drm_atomic_state_put(state); drm_atomic_state_put(state);
...@@ -948,7 +948,7 @@ static int i915_audio_component_get_cdclk_freq(struct device *kdev) ...@@ -948,7 +948,7 @@ static int i915_audio_component_get_cdclk_freq(struct device *kdev)
{ {
struct drm_i915_private *dev_priv = kdev_to_i915(kdev); struct drm_i915_private *dev_priv = kdev_to_i915(kdev);
if (WARN_ON_ONCE(!HAS_DDI(dev_priv))) if (drm_WARN_ON_ONCE(&dev_priv->drm, !HAS_DDI(dev_priv)))
return -ENODEV; return -ENODEV;
return dev_priv->cdclk.hw.cdclk; return dev_priv->cdclk.hw.cdclk;
...@@ -971,7 +971,8 @@ static struct intel_encoder *get_saved_enc(struct drm_i915_private *dev_priv, ...@@ -971,7 +971,8 @@ static struct intel_encoder *get_saved_enc(struct drm_i915_private *dev_priv,
/* MST */ /* MST */
if (pipe >= 0) { if (pipe >= 0) {
if (WARN_ON(pipe >= ARRAY_SIZE(dev_priv->av_enc_map))) if (drm_WARN_ON(&dev_priv->drm,
pipe >= ARRAY_SIZE(dev_priv->av_enc_map)))
return NULL; return NULL;
encoder = dev_priv->av_enc_map[pipe]; encoder = dev_priv->av_enc_map[pipe];
...@@ -1090,10 +1091,12 @@ static int i915_audio_component_bind(struct device *i915_kdev, ...@@ -1090,10 +1091,12 @@ static int i915_audio_component_bind(struct device *i915_kdev,
struct drm_i915_private *dev_priv = kdev_to_i915(i915_kdev); struct drm_i915_private *dev_priv = kdev_to_i915(i915_kdev);
int i; int i;
if (WARN_ON(acomp->base.ops || acomp->base.dev)) if (drm_WARN_ON(&dev_priv->drm, acomp->base.ops || acomp->base.dev))
return -EEXIST; return -EEXIST;
if (WARN_ON(!device_link_add(hda_kdev, i915_kdev, DL_FLAG_STATELESS))) if (drm_WARN_ON(&dev_priv->drm,
!device_link_add(hda_kdev, i915_kdev,
DL_FLAG_STATELESS)))
return -ENOMEM; return -ENOMEM;
drm_modeset_lock_all(&dev_priv->drm); drm_modeset_lock_all(&dev_priv->drm);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment