[Freedreno] [PATCH v3 4/7] drm/msm/dpu: Change _dpu_crtc_power_enable to void

Bruce Wang bzwang at chromium.org
Mon Sep 24 16:22:25 UTC 2018


All checks for _dpu_crtc_power_enable are not true, so the function
can never return an error code. All calls of the function have also
been changed so that they don't expect a return value.

v3: Separated _dpu_crtc_power_enable into _dpu_crtc_power_enable and
_dpu_crtc_power_disable for clarity.

Signed-off-by: Bruce Wang <bzwang at chromium.org>
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 44 ++++++------------------
 1 file changed, 11 insertions(+), 33 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
index e31e70f5dbac..cb71e2a2e02e 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
@@ -60,37 +60,19 @@ static inline struct dpu_kms *_dpu_crtc_get_kms(struct drm_crtc *crtc)
 	return to_dpu_kms(priv->kms);
 }
 
-static inline int _dpu_crtc_power_enable(struct dpu_crtc *dpu_crtc, bool enable)
-{
-	struct drm_crtc *crtc;
-	struct msm_drm_private *priv;
-	struct dpu_kms *dpu_kms;
-
-	if (!dpu_crtc) {
-		DPU_ERROR("invalid dpu crtc\n");
-		return -EINVAL;
-	}
-
-	crtc = &dpu_crtc->base;
-	if (!crtc->dev || !crtc->dev->dev_private) {
-		DPU_ERROR("invalid drm device\n");
-		return -EINVAL;
-	}
 
-	priv = crtc->dev->dev_private;
-	if (!priv->kms) {
-		DPU_ERROR("invalid kms\n");
-		return -EINVAL;
-	}
+static inline void _dpu_crtc_power_enable(struct dpu_crtc *dpu_crtc)
+{
+	struct dpu_kms *dpu_kms = _dpu_crtc_get_kms(&dpu_crtc->base);
 
-	dpu_kms = to_dpu_kms(priv->kms);
+	pm_runtime_get_sync(&dpu_kms->pdev->dev);
+}
 
-	if (enable)
-		pm_runtime_get_sync(&dpu_kms->pdev->dev);
-	else
-		pm_runtime_put_sync(&dpu_kms->pdev->dev);
+static inline void _dpu_crtc_power_disable(struct dpu_crtc *dpu_crtc)
+{
+	struct dpu_kms *dpu_kms = _dpu_crtc_get_kms(&dpu_crtc->base);
 
-	return 0;
+	pm_runtime_put_sync(&dpu_kms->pdev->dev);
 }
 
 static void dpu_crtc_destroy(struct drm_crtc *crtc)
@@ -823,14 +805,10 @@ static int _dpu_crtc_vblank_enable_no_lock(
 	dev = crtc->dev;
 
 	if (enable) {
-		int ret;
-
 		/* drop lock since power crtc cb may try to re-acquire lock */
 		mutex_unlock(&dpu_crtc->crtc_lock);
-		ret = _dpu_crtc_power_enable(dpu_crtc, true);
+		_dpu_crtc_power_enable(dpu_crtc);
 		mutex_lock(&dpu_crtc->crtc_lock);
-		if (ret)
-			return ret;
 
 		list_for_each_entry(enc, &dev->mode_config.encoder_list, head) {
 			if (enc->crtc != crtc)
@@ -857,7 +835,7 @@ static int _dpu_crtc_vblank_enable_no_lock(
 
 		/* drop lock since power crtc cb may try to re-acquire lock */
 		mutex_unlock(&dpu_crtc->crtc_lock);
-		_dpu_crtc_power_enable(dpu_crtc, false);
+		_dpu_crtc_power_disable(dpu_crtc);
 		mutex_lock(&dpu_crtc->crtc_lock);
 	}
 
-- 
2.19.0.444.g18242da7ef-goog



More information about the Freedreno mailing list