diff mbox series

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

Message ID 20180919154415.131292-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. 19, 2018, 3:44 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. 19, 2018, 7:14 p.m. UTC | #1
On Wed, Sep 19, 2018 at 11:44:15AM -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.

Ha! Glad we're on the same page, this will teach me to review sequentially.

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


> 
> 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(-)
> 
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> index f0b52281c46f..8ce24a85e70b 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> @@ -809,24 +809,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);
> @@ -861,8 +851,6 @@ static int _dpu_crtc_vblank_enable_no_lock(
>  		_dpu_crtc_power_enable(dpu_crtc, false);
>  		mutex_lock(&dpu_crtc->crtc_lock);
>  	}
> -
> -	return 0;
>  }
>  
>  /**
> @@ -873,7 +861,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);
>  
> @@ -888,10 +875,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;
> @@ -1000,7 +984,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) {
> @@ -1031,10 +1014,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;
>  
> @@ -1080,7 +1060,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");
> @@ -1102,10 +1081,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;
>  
> @@ -1360,7 +1336,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");
> @@ -1371,10 +1346,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.397.gdd90340f6a-goog
>
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 f0b52281c46f..8ce24a85e70b 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
@@ -809,24 +809,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);
@@ -861,8 +851,6 @@  static int _dpu_crtc_vblank_enable_no_lock(
 		_dpu_crtc_power_enable(dpu_crtc, false);
 		mutex_lock(&dpu_crtc->crtc_lock);
 	}
-
-	return 0;
 }
 
 /**
@@ -873,7 +861,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);
 
@@ -888,10 +875,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;
@@ -1000,7 +984,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) {
@@ -1031,10 +1014,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;
 
@@ -1080,7 +1060,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");
@@ -1102,10 +1081,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;
 
@@ -1360,7 +1336,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");
@@ -1371,10 +1346,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);