diff mbox series

[v2,6/7] drm/msm/dpu: Make dpu_plane_danger_signal_ctrl void

Message ID 20180920164924.225847-7-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
Removed all impossible checks from the function, which eliminates
the need for a return value. This function is also never used
outside of dpu_plane.c, so the function is made static.

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

Comments

Jordan Crouse Sept. 20, 2018, 5:38 p.m. UTC | #1
On Thu, Sep 20, 2018 at 12:49:23PM -0400, Bruce Wang wrote:
> Removed all impossible checks from the function, which eliminates
> the need for a return value. This function is also never used
> outside of dpu_plane.c, so the function is made static.
> 
> Signed-off-by: Bruce Wang <bzwang@chromium.org>
> ---
>  drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 27 +++++------------------
>  1 file changed, 5 insertions(+), 22 deletions(-)
> 
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
> index 9a5d5afa53f2..f9e65acdf87e 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
> @@ -363,35 +363,18 @@ static void _dpu_plane_set_qos_ctrl(struct drm_plane *plane,
>  			&pdpu->pipe_qos_cfg);
>  }
>  
> -int dpu_plane_danger_signal_ctrl(struct drm_plane *plane, bool enable)
> +static void dpu_plane_danger_signal_ctrl(struct drm_plane *plane, bool enable)
>  {
> -	struct dpu_plane *pdpu;
> -	struct msm_drm_private *priv;
> -	struct dpu_kms *dpu_kms;
> -
> -	if (!plane || !plane->dev) {
> -		DPU_ERROR("invalid arguments\n");
> -		return -EINVAL;
> -	}
> -
> -	priv = plane->dev->dev_private;
> -	if (!priv || !priv->kms) {
> -		DPU_ERROR("invalid KMS reference\n");
> -		return -EINVAL;
> -	}
> -
> -	dpu_kms = to_dpu_kms(priv->kms);
> -	pdpu = to_dpu_plane(plane);
> +	struct dpu_plane *pdpu = to_dpu_plane(plane);
> +	struct msm_drm_private *priv = plane->dev->dev_private;
> +	struct dpu_kms *dpu_kms = to_dpu_kms(priv->kms);

I think _dpu_plane_get_kms() can be used here.

>  	if (!pdpu->is_rt_pipe)
> -		goto end;
> +		return;
>  
>  	pm_runtime_get_sync(&dpu_kms->pdev->dev);
>  	_dpu_plane_set_qos_ctrl(plane, enable, DPU_PLANE_QOS_PANIC_CTRL);
>  	pm_runtime_put_sync(&dpu_kms->pdev->dev);
> -
> -end:
> -	return 0;
>  }
>  
>  /**
> -- 
> 2.19.0.444.g18242da7ef-goog
> 
> _______________________________________________
> Freedreno mailing list
> Freedreno@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/freedreno
Sean Paul Sept. 21, 2018, 3:52 p.m. UTC | #2
On Thu, Sep 20, 2018 at 11:38:54AM -0600, Jordan Crouse wrote:
> On Thu, Sep 20, 2018 at 12:49:23PM -0400, Bruce Wang wrote:
> > Removed all impossible checks from the function, which eliminates
> > the need for a return value. This function is also never used
> > outside of dpu_plane.c, so the function is made static.
> > 
> > Signed-off-by: Bruce Wang <bzwang@chromium.org>
> > ---
> >  drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 27 +++++------------------
> >  1 file changed, 5 insertions(+), 22 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
> > index 9a5d5afa53f2..f9e65acdf87e 100644
> > --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
> > +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
> > @@ -363,35 +363,18 @@ static void _dpu_plane_set_qos_ctrl(struct drm_plane *plane,
> >  			&pdpu->pipe_qos_cfg);
> >  }
> >  
> > -int dpu_plane_danger_signal_ctrl(struct drm_plane *plane, bool enable)
> > +static void dpu_plane_danger_signal_ctrl(struct drm_plane *plane, bool enable)
> >  {
> > -	struct dpu_plane *pdpu;
> > -	struct msm_drm_private *priv;
> > -	struct dpu_kms *dpu_kms;
> > -
> > -	if (!plane || !plane->dev) {
> > -		DPU_ERROR("invalid arguments\n");
> > -		return -EINVAL;
> > -	}
> > -
> > -	priv = plane->dev->dev_private;
> > -	if (!priv || !priv->kms) {
> > -		DPU_ERROR("invalid KMS reference\n");
> > -		return -EINVAL;
> > -	}
> > -
> > -	dpu_kms = to_dpu_kms(priv->kms);
> > -	pdpu = to_dpu_plane(plane);
> > +	struct dpu_plane *pdpu = to_dpu_plane(plane);
> > +	struct msm_drm_private *priv = plane->dev->dev_private;
> > +	struct dpu_kms *dpu_kms = to_dpu_kms(priv->kms);
> 
> I think _dpu_plane_get_kms() can be used here.

Nice catch on the _dpu_blah_get_kms() funcs :-). With that change

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


> 
> >  	if (!pdpu->is_rt_pipe)
> > -		goto end;
> > +		return;
> >  
> >  	pm_runtime_get_sync(&dpu_kms->pdev->dev);
> >  	_dpu_plane_set_qos_ctrl(plane, enable, DPU_PLANE_QOS_PANIC_CTRL);
> >  	pm_runtime_put_sync(&dpu_kms->pdev->dev);
> > -
> > -end:
> > -	return 0;
> >  }
> >  
> >  /**
> > -- 
> > 2.19.0.444.g18242da7ef-goog
> > 
> > _______________________________________________
> > Freedreno mailing list
> > Freedreno@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/freedreno
> 
> -- 
> The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
> a Linux Foundation Collaborative Project
> _______________________________________________
> 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_plane.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
index 9a5d5afa53f2..f9e65acdf87e 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
@@ -363,35 +363,18 @@  static void _dpu_plane_set_qos_ctrl(struct drm_plane *plane,
 			&pdpu->pipe_qos_cfg);
 }
 
-int dpu_plane_danger_signal_ctrl(struct drm_plane *plane, bool enable)
+static void dpu_plane_danger_signal_ctrl(struct drm_plane *plane, bool enable)
 {
-	struct dpu_plane *pdpu;
-	struct msm_drm_private *priv;
-	struct dpu_kms *dpu_kms;
-
-	if (!plane || !plane->dev) {
-		DPU_ERROR("invalid arguments\n");
-		return -EINVAL;
-	}
-
-	priv = plane->dev->dev_private;
-	if (!priv || !priv->kms) {
-		DPU_ERROR("invalid KMS reference\n");
-		return -EINVAL;
-	}
-
-	dpu_kms = to_dpu_kms(priv->kms);
-	pdpu = to_dpu_plane(plane);
+	struct dpu_plane *pdpu = to_dpu_plane(plane);
+	struct msm_drm_private *priv = plane->dev->dev_private;
+	struct dpu_kms *dpu_kms = to_dpu_kms(priv->kms);
 
 	if (!pdpu->is_rt_pipe)
-		goto end;
+		return;
 
 	pm_runtime_get_sync(&dpu_kms->pdev->dev);
 	_dpu_plane_set_qos_ctrl(plane, enable, DPU_PLANE_QOS_PANIC_CTRL);
 	pm_runtime_put_sync(&dpu_kms->pdev->dev);
-
-end:
-	return 0;
 }
 
 /**