Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ec0b11a3 authored by Steve Cohen's avatar Steve Cohen Committed by Gerrit - the friendly Code Review server
Browse files

drm/msm/sde: make sure all locks are acquired during lastclose



Ensure that we actually acquired all locks before proceeding to
disable modes and revert custom properties back to their default
values.  This patch adds the typical grab locks and backoff dance
to avoid lock contention.

Change-Id: Iaaea9fd75a79be8978d048f93d61ea0f7d4f8a4d
Signed-off-by: default avatarSteve Cohen <cohens@codeaurora.org>
parent 4e80278d
Loading
Loading
Loading
Loading
+25 −9
Original line number Diff line number Diff line
@@ -990,7 +990,7 @@ static void msm_lastclose(struct drm_device *dev)
	struct msm_drm_private *priv = dev->dev_private;
	struct msm_kms *kms = priv->kms;
	struct drm_modeset_acquire_ctx ctx;
	int i;
	int i, rc;

	/*
	 * clean up vblank disable immediately as this is the last close.
@@ -1008,16 +1008,32 @@ static void msm_lastclose(struct drm_device *dev)

	if (priv->fbdev) {
		drm_fb_helper_restore_fbdev_mode_unlocked(priv->fbdev);
	} else {
		return;
	}

	drm_modeset_acquire_init(&ctx, 0);
		drm_modeset_lock_all_ctx(dev, &ctx);
		msm_disable_all_modes(dev, &ctx);
retry:
	rc = drm_modeset_lock_all_ctx(dev, &ctx);
	if (rc)
		goto fail;

	rc = msm_disable_all_modes(dev, &ctx);
	if (rc)
		goto fail;

	if (kms && kms->funcs && kms->funcs->lastclose)
		kms->funcs->lastclose(kms, &ctx);

fail:
	if (rc == -EDEADLK) {
		drm_modeset_backoff(&ctx);
		goto retry;
	} else if (rc) {
		pr_err("last close failed: %d\n", rc);
	}
	drm_modeset_drop_locks(&ctx);
	drm_modeset_acquire_fini(&ctx);
}
}

static irqreturn_t msm_irq(int irq, void *arg)
{