diff mbox series

[v2,1/3] drm/i915: Reuse the aux_domain cached

Message ID 20181105202552.21051-1-jose.souza@intel.com (mailing list archive)
State New, archived
Headers show
Series [v2,1/3] drm/i915: Reuse the aux_domain cached | expand

Commit Message

Souza, Jose Nov. 5, 2018, 8:25 p.m. UTC
intel_dp_detect() caches the aux_domain in the beginning of the
function as it is used twice, so lets also use it as the aux_domain
don't change in runtime by jumping to the end of function when
retrain the link fails.

v2: jumping to the end of the function instead of just reuse
aux_domain

Cc: Imre Deak <imre.deak@intel.com>
Reviewed-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
---
 drivers/gpu/drm/i915/intel_dp.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

Comments

Imre Deak Nov. 6, 2018, 11:32 a.m. UTC | #1
On Mon, Nov 05, 2018 at 12:25:50PM -0800, José Roberto de Souza wrote:
> intel_dp_detect() caches the aux_domain in the beginning of the
> function as it is used twice, so lets also use it as the aux_domain
> don't change in runtime by jumping to the end of function when
> retrain the link fails.
> 
> v2: jumping to the end of the function instead of just reuse
> aux_domain
> 
> Cc: Imre Deak <imre.deak@intel.com>
> Reviewed-by: Imre Deak <imre.deak@intel.com>
> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_dp.c | 10 +++-------
>  1 file changed, 3 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index 5258c9d654f4..c7814d53f70f 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -5165,13 +5165,9 @@ intel_dp_detect(struct drm_connector *connector,
>  	 * with an IRQ_HPD, so force a link status check.
>  	 */
>  	if (!intel_dp_is_edp(intel_dp)) {
> -		int ret;
> -
> -		ret = intel_dp_retrain_link(encoder, ctx);
> -		if (ret) {
> -			intel_display_power_put(dev_priv,
> -						intel_aux_power_domain(dig_port));
> -			return ret;
> +		if (intel_dp_retrain_link(encoder, ctx)) {
> +			status = connector_status_disconnected;
> +			goto out;

The only way intel_dp_retrain_link() can fail is -EDEADLK, which we
should return then. Not doing that (and calling intel_dp_unset_edid() as
a result) would be anyway an independent change not belonging to this
patch.

Luckily caught by CONFIG_DEBUG_WW_MUTEX_SLOWPATH=y btw.

>  		}
>  	}
>  
> -- 
> 2.19.1
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 5258c9d654f4..c7814d53f70f 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -5165,13 +5165,9 @@  intel_dp_detect(struct drm_connector *connector,
 	 * with an IRQ_HPD, so force a link status check.
 	 */
 	if (!intel_dp_is_edp(intel_dp)) {
-		int ret;
-
-		ret = intel_dp_retrain_link(encoder, ctx);
-		if (ret) {
-			intel_display_power_put(dev_priv,
-						intel_aux_power_domain(dig_port));
-			return ret;
+		if (intel_dp_retrain_link(encoder, ctx)) {
+			status = connector_status_disconnected;
+			goto out;
 		}
 	}