[PATCH] drm/amdgpu: Use ternary operator in `vcn_v1_0_start()`

Alex Deucher alexdeucher at gmail.com
Tue Mar 15 16:03:13 UTC 2022


Applied.  Thanks!

Alex

On Tue, Mar 15, 2022 at 8:49 AM James Zhu <jamesz at amd.com> wrote:
>
> This patch is Reviewed-by: James Zhu <James.Zhu at amd.com>
>
> On 2022-03-15 5:29 a.m., Paul Menzel wrote:
> > Remove the boilerplate of declaring a variable and using an if else
> > statement by using the ternary operator.
> >
> > Signed-off-by: Paul Menzel <pmenzel at molgen.mpg.de>
> > ---
> >   drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c | 9 ++-------
> >   1 file changed, 2 insertions(+), 7 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c b/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c
> > index 3799226defc0..78ad85fdc769 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c
> > @@ -1095,13 +1095,8 @@ static int vcn_v1_0_start_dpg_mode(struct amdgpu_device *adev)
> >
> >   static int vcn_v1_0_start(struct amdgpu_device *adev)
> >   {
> > -     int r;
> > -
> > -     if (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG)
> > -             r = vcn_v1_0_start_dpg_mode(adev);
> > -     else
> > -             r = vcn_v1_0_start_spg_mode(adev);
> > -     return r;
> > +     return (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG) ?
> > +             vcn_v1_0_start_dpg_mode(adev) : vcn_v1_0_start_spg_mode(adev);
> >   }
> >
> >   /**


More information about the amd-gfx mailing list