Commit 3a47ae20 authored by Pankaj Bharadiya's avatar Pankaj Bharadiya Committed by Jani Nikula

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

Drm specific drm_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 intel_encoder struct pointer is available.

The conversion was done automatically with below coccinelle semantic
patch.

@@
identifier func, T;
@@
func(...) {
...
struct intel_encoder *T = ...;
<...
(
-WARN(
+drm_WARN(T->base.dev,
...)
|
-WARN_ON(
+drm_WARN_ON(T->base.dev,
...)
|
-WARN_ONCE(
+drm_WARN_ONCE(T->base.dev,
...)
|
-WARN_ON_ONCE(
+drm_WARN_ON_ONCE(T->base.dev,
...)
)
...>

}

@@
identifier func, T;
@@
func(struct intel_encoder *T,...) {
<...
(
-WARN(
+drm_WARN(T->base.dev,
...)
|
-WARN_ON(
+drm_WARN_ON(T->base.dev,
...)
|
-WARN_ONCE(
+drm_WARN_ONCE(T->base.dev,
...)
|
-WARN_ON_ONCE(
+drm_WARN_ON_ONCE(T->base.dev,
...)
)
...>

}

command: spatch --sp-file <script> --dir drivers/gpu/drm/i915/display \
					--linux-spacing --in-place
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/20200115034455.17658-5-pankaj.laxminarayan.bharadiya@intel.com
parent 7c7d5b1c
...@@ -1694,7 +1694,8 @@ static void skl_ddi_clock_get(struct intel_encoder *encoder, ...@@ -1694,7 +1694,8 @@ static void skl_ddi_clock_get(struct intel_encoder *encoder,
link_clock = 270000; link_clock = 270000;
break; break;
default: default:
WARN(1, "Unsupported link rate\n"); drm_WARN(encoder->base.dev, 1,
"Unsupported link rate\n");
break; break;
} }
link_clock *= 2; link_clock *= 2;
...@@ -4677,7 +4678,8 @@ intel_ddi_hotplug(struct intel_encoder *encoder, ...@@ -4677,7 +4678,8 @@ intel_ddi_hotplug(struct intel_encoder *encoder,
drm_modeset_drop_locks(&ctx); drm_modeset_drop_locks(&ctx);
drm_modeset_acquire_fini(&ctx); drm_modeset_acquire_fini(&ctx);
WARN(ret, "Acquiring modeset locks failed with %i\n", ret); drm_WARN(encoder->base.dev, ret,
"Acquiring modeset locks failed with %i\n", ret);
/* /*
* Unpowered type-c dongles can take some time to boot and be * Unpowered type-c dongles can take some time to boot and be
......
...@@ -5723,8 +5723,9 @@ intel_get_crtc_new_encoder(const struct intel_atomic_state *state, ...@@ -5723,8 +5723,9 @@ intel_get_crtc_new_encoder(const struct intel_atomic_state *state,
num_encoders++; num_encoders++;
} }
WARN(num_encoders != 1, "%d encoders for pipe %c\n", drm_WARN(encoder->base.dev, num_encoders != 1,
num_encoders, pipe_name(crtc->pipe)); "%d encoders for pipe %c\n",
num_encoders, pipe_name(crtc->pipe));
return encoder; return encoder;
} }
......
...@@ -2209,7 +2209,7 @@ intel_dp_compute_link_config(struct intel_encoder *encoder, ...@@ -2209,7 +2209,7 @@ intel_dp_compute_link_config(struct intel_encoder *encoder,
intel_dp->max_link_rate); intel_dp->max_link_rate);
/* No common link rates between source and sink */ /* No common link rates between source and sink */
WARN_ON(common_len <= 0); drm_WARN_ON(encoder->base.dev, common_len <= 0);
limits.min_clock = 0; limits.min_clock = 0;
limits.max_clock = common_len - 1; limits.max_clock = common_len - 1;
...@@ -5193,7 +5193,8 @@ intel_dp_hotplug(struct intel_encoder *encoder, ...@@ -5193,7 +5193,8 @@ intel_dp_hotplug(struct intel_encoder *encoder,
drm_modeset_drop_locks(&ctx); drm_modeset_drop_locks(&ctx);
drm_modeset_acquire_fini(&ctx); drm_modeset_acquire_fini(&ctx);
WARN(ret, "Acquiring modeset locks failed with %i\n", ret); drm_WARN(encoder->base.dev, ret,
"Acquiring modeset locks failed with %i\n", ret);
/* /*
* Keeping it consistent with intel_ddi_hotplug() and * Keeping it consistent with intel_ddi_hotplug() and
......
...@@ -655,12 +655,12 @@ static void intel_write_infoframe(struct intel_encoder *encoder, ...@@ -655,12 +655,12 @@ static void intel_write_infoframe(struct intel_encoder *encoder,
intel_hdmi_infoframe_enable(type)) == 0) intel_hdmi_infoframe_enable(type)) == 0)
return; return;
if (WARN_ON(frame->any.type != type)) if (drm_WARN_ON(encoder->base.dev, frame->any.type != type))
return; return;
/* see comment above for the reason for this offset */ /* see comment above for the reason for this offset */
len = hdmi_infoframe_pack_only(frame, buffer + 1, sizeof(buffer) - 1); len = hdmi_infoframe_pack_only(frame, buffer + 1, sizeof(buffer) - 1);
if (WARN_ON(len < 0)) if (drm_WARN_ON(encoder->base.dev, len < 0))
return; return;
/* Insert the 'hole' (see big comment above) at position 3 */ /* Insert the 'hole' (see big comment above) at position 3 */
...@@ -734,8 +734,8 @@ intel_hdmi_compute_avi_infoframe(struct intel_encoder *encoder, ...@@ -734,8 +734,8 @@ intel_hdmi_compute_avi_infoframe(struct intel_encoder *encoder,
drm_hdmi_avi_infoframe_colorspace(frame, conn_state); drm_hdmi_avi_infoframe_colorspace(frame, conn_state);
/* nonsense combination */ /* nonsense combination */
WARN_ON(crtc_state->limited_color_range && drm_WARN_ON(encoder->base.dev, crtc_state->limited_color_range &&
crtc_state->output_format != INTEL_OUTPUT_FORMAT_RGB); crtc_state->output_format != INTEL_OUTPUT_FORMAT_RGB);
if (crtc_state->output_format == INTEL_OUTPUT_FORMAT_RGB) { if (crtc_state->output_format == INTEL_OUTPUT_FORMAT_RGB) {
drm_hdmi_avi_infoframe_quant_range(frame, connector, drm_hdmi_avi_infoframe_quant_range(frame, connector,
...@@ -753,7 +753,7 @@ intel_hdmi_compute_avi_infoframe(struct intel_encoder *encoder, ...@@ -753,7 +753,7 @@ intel_hdmi_compute_avi_infoframe(struct intel_encoder *encoder,
/* TODO: handle pixel repetition for YCBCR420 outputs */ /* TODO: handle pixel repetition for YCBCR420 outputs */
ret = hdmi_avi_infoframe_check(frame); ret = hdmi_avi_infoframe_check(frame);
if (WARN_ON(ret)) if (drm_WARN_ON(encoder->base.dev, ret))
return false; return false;
return true; return true;
...@@ -774,13 +774,13 @@ intel_hdmi_compute_spd_infoframe(struct intel_encoder *encoder, ...@@ -774,13 +774,13 @@ intel_hdmi_compute_spd_infoframe(struct intel_encoder *encoder,
intel_hdmi_infoframe_enable(HDMI_INFOFRAME_TYPE_SPD); intel_hdmi_infoframe_enable(HDMI_INFOFRAME_TYPE_SPD);
ret = hdmi_spd_infoframe_init(frame, "Intel", "Integrated gfx"); ret = hdmi_spd_infoframe_init(frame, "Intel", "Integrated gfx");
if (WARN_ON(ret)) if (drm_WARN_ON(encoder->base.dev, ret))
return false; return false;
frame->sdi = HDMI_SPD_SDI_PC; frame->sdi = HDMI_SPD_SDI_PC;
ret = hdmi_spd_infoframe_check(frame); ret = hdmi_spd_infoframe_check(frame);
if (WARN_ON(ret)) if (drm_WARN_ON(encoder->base.dev, ret))
return false; return false;
return true; return true;
...@@ -806,11 +806,11 @@ intel_hdmi_compute_hdmi_infoframe(struct intel_encoder *encoder, ...@@ -806,11 +806,11 @@ intel_hdmi_compute_hdmi_infoframe(struct intel_encoder *encoder,
ret = drm_hdmi_vendor_infoframe_from_display_mode(frame, ret = drm_hdmi_vendor_infoframe_from_display_mode(frame,
conn_state->connector, conn_state->connector,
&crtc_state->hw.adjusted_mode); &crtc_state->hw.adjusted_mode);
if (WARN_ON(ret)) if (drm_WARN_ON(encoder->base.dev, ret))
return false; return false;
ret = hdmi_vendor_infoframe_check(frame); ret = hdmi_vendor_infoframe_check(frame);
if (WARN_ON(ret)) if (drm_WARN_ON(encoder->base.dev, ret))
return false; return false;
return true; return true;
...@@ -1863,7 +1863,7 @@ static void intel_enable_hdmi_audio(struct intel_encoder *encoder, ...@@ -1863,7 +1863,7 @@ static void intel_enable_hdmi_audio(struct intel_encoder *encoder,
{ {
struct intel_crtc *crtc = to_intel_crtc(pipe_config->uapi.crtc); struct intel_crtc *crtc = to_intel_crtc(pipe_config->uapi.crtc);
WARN_ON(!pipe_config->has_hdmi_sink); drm_WARN_ON(encoder->base.dev, !pipe_config->has_hdmi_sink);
DRM_DEBUG_DRIVER("Enabling HDMI audio on pipe %c\n", DRM_DEBUG_DRIVER("Enabling HDMI audio on pipe %c\n",
pipe_name(crtc->pipe)); pipe_name(crtc->pipe));
intel_audio_codec_enable(encoder, pipe_config, conn_state); intel_audio_codec_enable(encoder, pipe_config, conn_state);
......
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