diff mbox series

[v2,3/6] drm/i915: Cancel the Link check before disable

Message ID 1540806351-7137-4-git-send-email-ramalingam.c@intel.com (mailing list archive)
State New, archived
Headers show
Series Implement HDCP2.2: PART-I | expand

Commit Message

Ramalingam C Oct. 29, 2018, 9:45 a.m. UTC
To avoid the execution of link integrity check when the HDCP is
already disabled, cancel the delayed work for link integrity check
before disabling the HDCP.

Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
---
 drivers/gpu/drm/i915/intel_hdcp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Daniel Vetter Oct. 29, 2018, 3:18 p.m. UTC | #1
On Mon, Oct 29, 2018 at 03:15:48PM +0530, Ramalingam C wrote:
> To avoid the execution of link integrity check when the HDCP is
> already disabled, cancel the delayed work for link integrity check
> before disabling the HDCP.
> 
> Signed-off-by: Ramalingam C <ramalingam.c@intel.com>

This is racy. As an exercise, please lay out the scenario of what exactly
happens where. I'll drop this patch from the series.
-Daniel

> ---
>  drivers/gpu/drm/i915/intel_hdcp.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_hdcp.c b/drivers/gpu/drm/i915/intel_hdcp.c
> index 1bf487f94254..d13e4af9ac05 100644
> --- a/drivers/gpu/drm/i915/intel_hdcp.c
> +++ b/drivers/gpu/drm/i915/intel_hdcp.c
> @@ -821,6 +821,7 @@ int intel_hdcp_disable(struct intel_connector *connector)
>  	if (!hdcp->shim)
>  		return -ENOENT;
>  
> +	cancel_delayed_work_sync(&hdcp->check_work);
>  	mutex_lock(&hdcp->mutex);
>  
>  	if (hdcp->value != DRM_MODE_CONTENT_PROTECTION_UNDESIRED) {
> @@ -829,7 +830,6 @@ int intel_hdcp_disable(struct intel_connector *connector)
>  	}
>  
>  	mutex_unlock(&hdcp->mutex);
> -	cancel_delayed_work_sync(&hdcp->check_work);
>  	return ret;
>  }
>  
> -- 
> 2.7.4
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/intel_hdcp.c b/drivers/gpu/drm/i915/intel_hdcp.c
index 1bf487f94254..d13e4af9ac05 100644
--- a/drivers/gpu/drm/i915/intel_hdcp.c
+++ b/drivers/gpu/drm/i915/intel_hdcp.c
@@ -821,6 +821,7 @@  int intel_hdcp_disable(struct intel_connector *connector)
 	if (!hdcp->shim)
 		return -ENOENT;
 
+	cancel_delayed_work_sync(&hdcp->check_work);
 	mutex_lock(&hdcp->mutex);
 
 	if (hdcp->value != DRM_MODE_CONTENT_PROTECTION_UNDESIRED) {
@@ -829,7 +830,6 @@  int intel_hdcp_disable(struct intel_connector *connector)
 	}
 
 	mutex_unlock(&hdcp->mutex);
-	cancel_delayed_work_sync(&hdcp->check_work);
 	return ret;
 }