Message ID | 20180920164924.225847-8-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 |
On Thu, Sep 20, 2018 at 12:49:24PM -0400, Bruce Wang wrote: > Remove unneeded checks from _dpu_plane_get_aspace. The function > no longer needs to return anything so it is changed to void. > > Signed-off-by: Bruce Wang <bzwang@chromium.org> > --- > drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 25 ++++------------------- > 1 file changed, 4 insertions(+), 21 deletions(-) > > diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c > index f9e65acdf87e..59f019685658 100644 > --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c > +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c > @@ -434,23 +434,14 @@ static void _dpu_plane_set_qos_remap(struct drm_plane *plane) > /** > * _dpu_plane_get_aspace: gets the address space > */ > -static int _dpu_plane_get_aspace( > +static void _dpu_plane_get_aspace( > struct dpu_plane *pdpu, > struct dpu_plane_state *pstate, > struct msm_gem_address_space **aspace) > { > - struct dpu_kms *kms; > - > - if (!pdpu || !pstate || !aspace) { > - DPU_ERROR("invalid parameters\n"); > - return -EINVAL; > - } > - > - kms = _dpu_plane_get_kms(&pdpu->base); > + struct dpu_kms *kms = _dpu_plane_get_kms(&pdpu->base); > > *aspace = kms->base.aspace; I think we could make this better by one of two ways. 1- Just use aspace = _dpu_plane_get_kms(&pdpu->base)->base.aspace; at the callsites. 2- Make the return value struct msm_gem_address_space * and return the value from the function. Sean > - > - return 0; > } > > static inline void _dpu_plane_set_scanout(struct drm_plane *plane, > @@ -471,11 +462,7 @@ static inline void _dpu_plane_set_scanout(struct drm_plane *plane, > > pdpu = to_dpu_plane(plane); > > - ret = _dpu_plane_get_aspace(pdpu, pstate, &aspace); > - if (ret) { > - DPU_ERROR_PLANE(pdpu, "Failed to get aspace %d\n", ret); > - return; > - } > + _dpu_plane_get_aspace(pdpu, pstate, &aspace); > > ret = dpu_format_populate_layout(aspace, fb, &pipe_cfg->layout); > if (ret == -EAGAIN) > @@ -836,11 +823,7 @@ static int dpu_plane_prepare_fb(struct drm_plane *plane, > > DPU_DEBUG_PLANE(pdpu, "FB[%u]\n", fb->base.id); > > - ret = _dpu_plane_get_aspace(pdpu, pstate, &aspace); > - if (ret) { > - DPU_ERROR_PLANE(pdpu, "Failed to get aspace\n"); > - return ret; > - } > + _dpu_plane_get_aspace(pdpu, pstate, &aspace); > > /* cache aspace */ > pstate->aspace = aspace; > -- > 2.19.0.444.g18242da7ef-goog > > _______________________________________________ > Freedreno mailing list > Freedreno@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/freedreno
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c index f9e65acdf87e..59f019685658 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c @@ -434,23 +434,14 @@ static void _dpu_plane_set_qos_remap(struct drm_plane *plane) /** * _dpu_plane_get_aspace: gets the address space */ -static int _dpu_plane_get_aspace( +static void _dpu_plane_get_aspace( struct dpu_plane *pdpu, struct dpu_plane_state *pstate, struct msm_gem_address_space **aspace) { - struct dpu_kms *kms; - - if (!pdpu || !pstate || !aspace) { - DPU_ERROR("invalid parameters\n"); - return -EINVAL; - } - - kms = _dpu_plane_get_kms(&pdpu->base); + struct dpu_kms *kms = _dpu_plane_get_kms(&pdpu->base); *aspace = kms->base.aspace; - - return 0; } static inline void _dpu_plane_set_scanout(struct drm_plane *plane, @@ -471,11 +462,7 @@ static inline void _dpu_plane_set_scanout(struct drm_plane *plane, pdpu = to_dpu_plane(plane); - ret = _dpu_plane_get_aspace(pdpu, pstate, &aspace); - if (ret) { - DPU_ERROR_PLANE(pdpu, "Failed to get aspace %d\n", ret); - return; - } + _dpu_plane_get_aspace(pdpu, pstate, &aspace); ret = dpu_format_populate_layout(aspace, fb, &pipe_cfg->layout); if (ret == -EAGAIN) @@ -836,11 +823,7 @@ static int dpu_plane_prepare_fb(struct drm_plane *plane, DPU_DEBUG_PLANE(pdpu, "FB[%u]\n", fb->base.id); - ret = _dpu_plane_get_aspace(pdpu, pstate, &aspace); - if (ret) { - DPU_ERROR_PLANE(pdpu, "Failed to get aspace\n"); - return ret; - } + _dpu_plane_get_aspace(pdpu, pstate, &aspace); /* cache aspace */ pstate->aspace = aspace;
Remove unneeded checks from _dpu_plane_get_aspace. The function no longer needs to return anything so it is changed to void. Signed-off-by: Bruce Wang <bzwang@chromium.org> --- drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 25 ++++------------------- 1 file changed, 4 insertions(+), 21 deletions(-)