Commit bb393dc5 authored by Pankaj Bharadiya's avatar Pankaj Bharadiya Committed by Jani Nikula

drm/i915/display/hdcp: 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/20200220165507.16823-7-pankaj.laxminarayan.bharadiya@intel.com
parent eb020ca3
...@@ -872,7 +872,8 @@ static int intel_hdcp_check_link(struct intel_connector *connector) ...@@ -872,7 +872,8 @@ static int intel_hdcp_check_link(struct intel_connector *connector)
goto out; goto out;
} }
if (WARN_ON(!intel_hdcp_in_use(dev_priv, cpu_transcoder, port))) { if (drm_WARN_ON(&dev_priv->drm,
!intel_hdcp_in_use(dev_priv, cpu_transcoder, port))) {
drm_err(&dev_priv->drm, drm_err(&dev_priv->drm,
"%s:%d HDCP link stopped encryption,%x\n", "%s:%d HDCP link stopped encryption,%x\n",
connector->base.name, connector->base.base.id, connector->base.name, connector->base.base.id,
...@@ -1561,8 +1562,9 @@ static int hdcp2_enable_encryption(struct intel_connector *connector) ...@@ -1561,8 +1562,9 @@ static int hdcp2_enable_encryption(struct intel_connector *connector)
enum transcoder cpu_transcoder = hdcp->cpu_transcoder; enum transcoder cpu_transcoder = hdcp->cpu_transcoder;
int ret; int ret;
WARN_ON(intel_de_read(dev_priv, HDCP2_STATUS(dev_priv, cpu_transcoder, port)) & drm_WARN_ON(&dev_priv->drm,
LINK_ENCRYPTION_STATUS); intel_de_read(dev_priv, HDCP2_STATUS(dev_priv, cpu_transcoder, port)) &
LINK_ENCRYPTION_STATUS);
if (hdcp->shim->toggle_signalling) { if (hdcp->shim->toggle_signalling) {
ret = hdcp->shim->toggle_signalling(intel_dig_port, true); ret = hdcp->shim->toggle_signalling(intel_dig_port, true);
if (ret) { if (ret) {
...@@ -1599,8 +1601,8 @@ static int hdcp2_disable_encryption(struct intel_connector *connector) ...@@ -1599,8 +1601,8 @@ static int hdcp2_disable_encryption(struct intel_connector *connector)
enum transcoder cpu_transcoder = hdcp->cpu_transcoder; enum transcoder cpu_transcoder = hdcp->cpu_transcoder;
int ret; int ret;
WARN_ON(!(intel_de_read(dev_priv, HDCP2_STATUS(dev_priv, cpu_transcoder, port)) & drm_WARN_ON(&dev_priv->drm, !(intel_de_read(dev_priv, HDCP2_STATUS(dev_priv, cpu_transcoder, port)) &
LINK_ENCRYPTION_STATUS)); LINK_ENCRYPTION_STATUS));
intel_de_write(dev_priv, HDCP2_CTL(dev_priv, cpu_transcoder, port), intel_de_write(dev_priv, HDCP2_CTL(dev_priv, cpu_transcoder, port),
intel_de_read(dev_priv, HDCP2_CTL(dev_priv, cpu_transcoder, port)) & ~CTL_LINK_ENCRYPTION_REQ); intel_de_read(dev_priv, HDCP2_CTL(dev_priv, cpu_transcoder, port)) & ~CTL_LINK_ENCRYPTION_REQ);
...@@ -1720,7 +1722,8 @@ static int intel_hdcp2_check_link(struct intel_connector *connector) ...@@ -1720,7 +1722,8 @@ static int intel_hdcp2_check_link(struct intel_connector *connector)
goto out; goto out;
} }
if (WARN_ON(!intel_hdcp2_in_use(dev_priv, cpu_transcoder, port))) { if (drm_WARN_ON(&dev_priv->drm,
!intel_hdcp2_in_use(dev_priv, cpu_transcoder, port))) {
drm_err(&dev_priv->drm, drm_err(&dev_priv->drm,
"HDCP2.2 link stopped the encryption, %x\n", "HDCP2.2 link stopped the encryption, %x\n",
intel_de_read(dev_priv, HDCP2_STATUS(dev_priv, cpu_transcoder, port))); intel_de_read(dev_priv, HDCP2_STATUS(dev_priv, cpu_transcoder, port)));
...@@ -1916,7 +1919,7 @@ void intel_hdcp_component_init(struct drm_i915_private *dev_priv) ...@@ -1916,7 +1919,7 @@ void intel_hdcp_component_init(struct drm_i915_private *dev_priv)
return; return;
mutex_lock(&dev_priv->hdcp_comp_mutex); mutex_lock(&dev_priv->hdcp_comp_mutex);
WARN_ON(dev_priv->hdcp_comp_added); drm_WARN_ON(&dev_priv->drm, dev_priv->hdcp_comp_added);
dev_priv->hdcp_comp_added = true; dev_priv->hdcp_comp_added = true;
mutex_unlock(&dev_priv->hdcp_comp_mutex); mutex_unlock(&dev_priv->hdcp_comp_mutex);
...@@ -1990,7 +1993,8 @@ int intel_hdcp_enable(struct intel_connector *connector, ...@@ -1990,7 +1993,8 @@ int intel_hdcp_enable(struct intel_connector *connector,
return -ENOENT; return -ENOENT;
mutex_lock(&hdcp->mutex); mutex_lock(&hdcp->mutex);
WARN_ON(hdcp->value == DRM_MODE_CONTENT_PROTECTION_ENABLED); drm_WARN_ON(&dev_priv->drm,
hdcp->value == DRM_MODE_CONTENT_PROTECTION_ENABLED);
hdcp->content_type = content_type; hdcp->content_type = content_type;
if (INTEL_GEN(dev_priv) >= 12) { if (INTEL_GEN(dev_priv) >= 12) {
......
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