drm/i915/display/hdcp: Make WARN* drm specific where drm_priv ptr is available
authorPankaj Bharadiya <pankaj.laxminarayan.bharadiya@intel.com>
Thu, 20 Feb 2020 16:55:05 +0000 (22:25 +0530)
committerJani Nikula <jani.nikula@intel.com>
Sun, 23 Feb 2020 16:05:24 +0000 (18:05 +0200)
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: Pankaj Bharadiya <pankaj.laxminarayan.bharadiya@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200220165507.16823-7-pankaj.laxminarayan.bharadiya@intel.com
drivers/gpu/drm/i915/display/intel_hdcp.c

index 30e0a3aa9d57449ab0e7ee3af8962c7bb765810f..229b4e329864c26aa2fbd720281cf1be8941240f 100644 (file)
@@ -872,7 +872,8 @@ static int intel_hdcp_check_link(struct intel_connector *connector)
                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,
                        "%s:%d HDCP link stopped encryption,%x\n",
                        connector->base.name, connector->base.base.id,
@@ -1561,8 +1562,9 @@ static int hdcp2_enable_encryption(struct intel_connector *connector)
        enum transcoder cpu_transcoder = hdcp->cpu_transcoder;
        int ret;
 
-       WARN_ON(intel_de_read(dev_priv, HDCP2_STATUS(dev_priv, cpu_transcoder, port)) &
-               LINK_ENCRYPTION_STATUS);
+       drm_WARN_ON(&dev_priv->drm,
+                   intel_de_read(dev_priv, HDCP2_STATUS(dev_priv, cpu_transcoder, port)) &
+                   LINK_ENCRYPTION_STATUS);
        if (hdcp->shim->toggle_signalling) {
                ret = hdcp->shim->toggle_signalling(intel_dig_port, true);
                if (ret) {
@@ -1599,8 +1601,8 @@ static int hdcp2_disable_encryption(struct intel_connector *connector)
        enum transcoder cpu_transcoder = hdcp->cpu_transcoder;
        int ret;
 
-       WARN_ON(!(intel_de_read(dev_priv, HDCP2_STATUS(dev_priv, cpu_transcoder, port)) &
-                           LINK_ENCRYPTION_STATUS));
+       drm_WARN_ON(&dev_priv->drm, !(intel_de_read(dev_priv, HDCP2_STATUS(dev_priv, cpu_transcoder, port)) &
+                                     LINK_ENCRYPTION_STATUS));
 
        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);
@@ -1720,7 +1722,8 @@ static int intel_hdcp2_check_link(struct intel_connector *connector)
                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,
                        "HDCP2.2 link stopped the encryption, %x\n",
                        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)
                return;
 
        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;
        mutex_unlock(&dev_priv->hdcp_comp_mutex);
@@ -1990,7 +1993,8 @@ int intel_hdcp_enable(struct intel_connector *connector,
                return -ENOENT;
 
        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;
 
        if (INTEL_GEN(dev_priv) >= 12) {