diff mbox series

[v2,5/7] drm/msm/dpu: Change _dpu_crtc_vblank_enable_no_lock to void

Message ID 20180920164924.225847-6-bzwang@chromium.org (mailing list archive)
State Not Applicable, archived
Delegated to: Andy Gross
Headers show
Series drm/msm/dpu: Clean up dpu code | expand

Commit Message

Bruce Wang Sept. 20, 2018, 4:49 p.m. UTC
Removes redundant tests for _dpu_crtc_vblank_enable_no_lock.
Function return type is now void and all function calls have
been changed accordingly.

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

Comments

Sean Paul Sept. 21, 2018, 3:51 p.m. UTC | #1
On Thu, Sep 20, 2018 at 12:49:22PM -0400, Bruce Wang wrote:
> Removes redundant tests for _dpu_crtc_vblank_enable_no_lock.
> Function return type is now void and all function calls have
> been changed accordingly.
> 
> Signed-off-by: Bruce Wang <bzwang@chromium.org>

Still

Reviewed-by: Sean Paul <seanpaul@chromium.org>


> ---
>  drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 42 ++++--------------------
>  1 file changed, 7 insertions(+), 35 deletions(-)
> 
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> index 648d77c41c3e..0a2d52847655 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> @@ -782,24 +782,14 @@ void dpu_crtc_commit_kickoff(struct drm_crtc *crtc)
>   * _dpu_crtc_vblank_enable_no_lock - update power resource and vblank request
>   * @dpu_crtc: Pointer to dpu crtc structure
>   * @enable: Whether to enable/disable vblanks
> - *
> - * @Return: error code
>   */
> -static int _dpu_crtc_vblank_enable_no_lock(
> +static void _dpu_crtc_vblank_enable_no_lock(
>  		struct dpu_crtc *dpu_crtc, bool enable)
>  {
> -	struct drm_device *dev;
> -	struct drm_crtc *crtc;
> +	struct drm_crtc *crtc = &dpu_crtc->base;
> +	struct drm_device *dev = crtc->dev;
>  	struct drm_encoder *enc;
>  
> -	if (!dpu_crtc) {
> -		DPU_ERROR("invalid crtc\n");
> -		return -EINVAL;
> -	}
> -
> -	crtc = &dpu_crtc->base;
> -	dev = crtc->dev;
> -
>  	if (enable) {
>  		/* drop lock since power crtc cb may try to re-acquire lock */
>  		mutex_unlock(&dpu_crtc->crtc_lock);
> @@ -834,8 +824,6 @@ static int _dpu_crtc_vblank_enable_no_lock(
>  		_dpu_crtc_power_enable(dpu_crtc, false);
>  		mutex_lock(&dpu_crtc->crtc_lock);
>  	}
> -
> -	return 0;
>  }
>  
>  /**
> @@ -846,7 +834,6 @@ static int _dpu_crtc_vblank_enable_no_lock(
>  static void _dpu_crtc_set_suspend(struct drm_crtc *crtc, bool enable)
>  {
>  	struct dpu_crtc *dpu_crtc = to_dpu_crtc(crtc);
> -	int ret = 0;
>  
>  	DRM_DEBUG_KMS("crtc%d suspend = %d\n", crtc->base.id, enable);
>  
> @@ -861,10 +848,7 @@ static void _dpu_crtc_set_suspend(struct drm_crtc *crtc, bool enable)
>  		DPU_DEBUG("crtc%d suspend already set to %d, ignoring update\n",
>  				crtc->base.id, enable);
>  	else if (dpu_crtc->enabled && dpu_crtc->vblank_requested) {
> -		ret = _dpu_crtc_vblank_enable_no_lock(dpu_crtc, !enable);
> -		if (ret)
> -			DPU_ERROR("%s vblank enable failed: %d\n",
> -					dpu_crtc->name, ret);
> +		_dpu_crtc_vblank_enable_no_lock(dpu_crtc, !enable);
>  	}
>  
>  	dpu_crtc->suspend = enable;
> @@ -965,7 +949,6 @@ static void dpu_crtc_disable(struct drm_crtc *crtc)
>  	struct drm_display_mode *mode;
>  	struct drm_encoder *encoder;
>  	struct msm_drm_private *priv;
> -	int ret;
>  	unsigned long flags;
>  
>  	if (!crtc || !crtc->dev || !crtc->dev->dev_private || !crtc->state) {
> @@ -996,10 +979,7 @@ static void dpu_crtc_disable(struct drm_crtc *crtc)
>  	trace_dpu_crtc_disable(DRMID(crtc), false, dpu_crtc);
>  	if (dpu_crtc->enabled && !dpu_crtc->suspend &&
>  			dpu_crtc->vblank_requested) {
> -		ret = _dpu_crtc_vblank_enable_no_lock(dpu_crtc, false);
> -		if (ret)
> -			DPU_ERROR("%s vblank enable failed: %d\n",
> -					dpu_crtc->name, ret);
> +		_dpu_crtc_vblank_enable_no_lock(dpu_crtc, false);
>  	}
>  	dpu_crtc->enabled = false;
>  
> @@ -1045,7 +1025,6 @@ static void dpu_crtc_enable(struct drm_crtc *crtc,
>  	struct dpu_crtc *dpu_crtc;
>  	struct drm_encoder *encoder;
>  	struct msm_drm_private *priv;
> -	int ret;
>  
>  	if (!crtc || !crtc->dev || !crtc->dev->dev_private) {
>  		DPU_ERROR("invalid crtc\n");
> @@ -1067,10 +1046,7 @@ static void dpu_crtc_enable(struct drm_crtc *crtc,
>  	trace_dpu_crtc_enable(DRMID(crtc), true, dpu_crtc);
>  	if (!dpu_crtc->enabled && !dpu_crtc->suspend &&
>  			dpu_crtc->vblank_requested) {
> -		ret = _dpu_crtc_vblank_enable_no_lock(dpu_crtc, true);
> -		if (ret)
> -			DPU_ERROR("%s vblank enable failed: %d\n",
> -					dpu_crtc->name, ret);
> +		_dpu_crtc_vblank_enable_no_lock(dpu_crtc, true);
>  	}
>  	dpu_crtc->enabled = true;
>  
> @@ -1325,7 +1301,6 @@ static int dpu_crtc_atomic_check(struct drm_crtc *crtc,
>  int dpu_crtc_vblank(struct drm_crtc *crtc, bool en)
>  {
>  	struct dpu_crtc *dpu_crtc;
> -	int ret;
>  
>  	if (!crtc) {
>  		DPU_ERROR("invalid crtc\n");
> @@ -1336,10 +1311,7 @@ int dpu_crtc_vblank(struct drm_crtc *crtc, bool en)
>  	mutex_lock(&dpu_crtc->crtc_lock);
>  	trace_dpu_crtc_vblank(DRMID(&dpu_crtc->base), en, dpu_crtc);
>  	if (dpu_crtc->enabled && !dpu_crtc->suspend) {
> -		ret = _dpu_crtc_vblank_enable_no_lock(dpu_crtc, en);
> -		if (ret)
> -			DPU_ERROR("%s vblank enable failed: %d\n",
> -					dpu_crtc->name, ret);
> +		_dpu_crtc_vblank_enable_no_lock(dpu_crtc, en);
>  	}
>  	dpu_crtc->vblank_requested = en;
>  	mutex_unlock(&dpu_crtc->crtc_lock);
> -- 
> 2.19.0.444.g18242da7ef-goog
> 
> _______________________________________________
> Freedreno mailing list
> Freedreno@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/freedreno
diff mbox series

Patch

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
index 648d77c41c3e..0a2d52847655 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
@@ -782,24 +782,14 @@  void dpu_crtc_commit_kickoff(struct drm_crtc *crtc)
  * _dpu_crtc_vblank_enable_no_lock - update power resource and vblank request
  * @dpu_crtc: Pointer to dpu crtc structure
  * @enable: Whether to enable/disable vblanks
- *
- * @Return: error code
  */
-static int _dpu_crtc_vblank_enable_no_lock(
+static void _dpu_crtc_vblank_enable_no_lock(
 		struct dpu_crtc *dpu_crtc, bool enable)
 {
-	struct drm_device *dev;
-	struct drm_crtc *crtc;
+	struct drm_crtc *crtc = &dpu_crtc->base;
+	struct drm_device *dev = crtc->dev;
 	struct drm_encoder *enc;
 
-	if (!dpu_crtc) {
-		DPU_ERROR("invalid crtc\n");
-		return -EINVAL;
-	}
-
-	crtc = &dpu_crtc->base;
-	dev = crtc->dev;
-
 	if (enable) {
 		/* drop lock since power crtc cb may try to re-acquire lock */
 		mutex_unlock(&dpu_crtc->crtc_lock);
@@ -834,8 +824,6 @@  static int _dpu_crtc_vblank_enable_no_lock(
 		_dpu_crtc_power_enable(dpu_crtc, false);
 		mutex_lock(&dpu_crtc->crtc_lock);
 	}
-
-	return 0;
 }
 
 /**
@@ -846,7 +834,6 @@  static int _dpu_crtc_vblank_enable_no_lock(
 static void _dpu_crtc_set_suspend(struct drm_crtc *crtc, bool enable)
 {
 	struct dpu_crtc *dpu_crtc = to_dpu_crtc(crtc);
-	int ret = 0;
 
 	DRM_DEBUG_KMS("crtc%d suspend = %d\n", crtc->base.id, enable);
 
@@ -861,10 +848,7 @@  static void _dpu_crtc_set_suspend(struct drm_crtc *crtc, bool enable)
 		DPU_DEBUG("crtc%d suspend already set to %d, ignoring update\n",
 				crtc->base.id, enable);
 	else if (dpu_crtc->enabled && dpu_crtc->vblank_requested) {
-		ret = _dpu_crtc_vblank_enable_no_lock(dpu_crtc, !enable);
-		if (ret)
-			DPU_ERROR("%s vblank enable failed: %d\n",
-					dpu_crtc->name, ret);
+		_dpu_crtc_vblank_enable_no_lock(dpu_crtc, !enable);
 	}
 
 	dpu_crtc->suspend = enable;
@@ -965,7 +949,6 @@  static void dpu_crtc_disable(struct drm_crtc *crtc)
 	struct drm_display_mode *mode;
 	struct drm_encoder *encoder;
 	struct msm_drm_private *priv;
-	int ret;
 	unsigned long flags;
 
 	if (!crtc || !crtc->dev || !crtc->dev->dev_private || !crtc->state) {
@@ -996,10 +979,7 @@  static void dpu_crtc_disable(struct drm_crtc *crtc)
 	trace_dpu_crtc_disable(DRMID(crtc), false, dpu_crtc);
 	if (dpu_crtc->enabled && !dpu_crtc->suspend &&
 			dpu_crtc->vblank_requested) {
-		ret = _dpu_crtc_vblank_enable_no_lock(dpu_crtc, false);
-		if (ret)
-			DPU_ERROR("%s vblank enable failed: %d\n",
-					dpu_crtc->name, ret);
+		_dpu_crtc_vblank_enable_no_lock(dpu_crtc, false);
 	}
 	dpu_crtc->enabled = false;
 
@@ -1045,7 +1025,6 @@  static void dpu_crtc_enable(struct drm_crtc *crtc,
 	struct dpu_crtc *dpu_crtc;
 	struct drm_encoder *encoder;
 	struct msm_drm_private *priv;
-	int ret;
 
 	if (!crtc || !crtc->dev || !crtc->dev->dev_private) {
 		DPU_ERROR("invalid crtc\n");
@@ -1067,10 +1046,7 @@  static void dpu_crtc_enable(struct drm_crtc *crtc,
 	trace_dpu_crtc_enable(DRMID(crtc), true, dpu_crtc);
 	if (!dpu_crtc->enabled && !dpu_crtc->suspend &&
 			dpu_crtc->vblank_requested) {
-		ret = _dpu_crtc_vblank_enable_no_lock(dpu_crtc, true);
-		if (ret)
-			DPU_ERROR("%s vblank enable failed: %d\n",
-					dpu_crtc->name, ret);
+		_dpu_crtc_vblank_enable_no_lock(dpu_crtc, true);
 	}
 	dpu_crtc->enabled = true;
 
@@ -1325,7 +1301,6 @@  static int dpu_crtc_atomic_check(struct drm_crtc *crtc,
 int dpu_crtc_vblank(struct drm_crtc *crtc, bool en)
 {
 	struct dpu_crtc *dpu_crtc;
-	int ret;
 
 	if (!crtc) {
 		DPU_ERROR("invalid crtc\n");
@@ -1336,10 +1311,7 @@  int dpu_crtc_vblank(struct drm_crtc *crtc, bool en)
 	mutex_lock(&dpu_crtc->crtc_lock);
 	trace_dpu_crtc_vblank(DRMID(&dpu_crtc->base), en, dpu_crtc);
 	if (dpu_crtc->enabled && !dpu_crtc->suspend) {
-		ret = _dpu_crtc_vblank_enable_no_lock(dpu_crtc, en);
-		if (ret)
-			DPU_ERROR("%s vblank enable failed: %d\n",
-					dpu_crtc->name, ret);
+		_dpu_crtc_vblank_enable_no_lock(dpu_crtc, en);
 	}
 	dpu_crtc->vblank_requested = en;
 	mutex_unlock(&dpu_crtc->crtc_lock);