[PATCH 0/6] drm/amdgpu: Remove redundant ternary operators

Liao Yuanhong posted 6 patches 4 weeks, 1 day ago
drivers/gpu/drm/amd/amdgpu/amdgpu_cper.c | 2 +-
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c   | 3 +--
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c   | 3 +--
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c   | 3 +--
drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c   | 3 +--
drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c   | 3 +--
drivers/gpu/drm/amd/amdgpu/ih_v6_0.c     | 3 +--
drivers/gpu/drm/amd/amdgpu/ih_v6_1.c     | 3 +--
drivers/gpu/drm/amd/amdgpu/ih_v7_0.c     | 3 +--
drivers/gpu/drm/amd/amdgpu/jpeg_v4_0_5.c | 2 +-
drivers/gpu/drm/amd/amdgpu/jpeg_v5_0_0.c | 2 +-
drivers/gpu/drm/amd/amdgpu/jpeg_v5_0_1.c | 2 +-
drivers/gpu/drm/amd/amdgpu/vcn_v4_0_5.c  | 2 +-
drivers/gpu/drm/amd/amdgpu/vcn_v5_0_0.c  | 2 +-
14 files changed, 14 insertions(+), 22 deletions(-)
[PATCH 0/6] drm/amdgpu: Remove redundant ternary operators
Posted by Liao Yuanhong 4 weeks, 1 day ago
For ternary operators in the form of "a ? true : false" or
"a ? false : true", if 'a' itself returns a boolean result, the ternary
operator can be omitted. Remove redundant ternary operators to clean up the
code.

Liao Yuanhong (6):
  drm/amdgpu/amdgpu_cper: Remove redundant ternary operators
  drm/amdgpu/gfx: Remove redundant ternary operators
  drm/amdgpu/gmc: Remove redundant ternary operators
  drm/amdgpu/ih: Remove redundant ternary operators
  drm/amdgpu/jpeg: Remove redundant ternary operators
  drm/amdgpu/vcn: Remove redundant ternary operators

 drivers/gpu/drm/amd/amdgpu/amdgpu_cper.c | 2 +-
 drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c   | 3 +--
 drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c   | 3 +--
 drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c   | 3 +--
 drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c   | 3 +--
 drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c   | 3 +--
 drivers/gpu/drm/amd/amdgpu/ih_v6_0.c     | 3 +--
 drivers/gpu/drm/amd/amdgpu/ih_v6_1.c     | 3 +--
 drivers/gpu/drm/amd/amdgpu/ih_v7_0.c     | 3 +--
 drivers/gpu/drm/amd/amdgpu/jpeg_v4_0_5.c | 2 +-
 drivers/gpu/drm/amd/amdgpu/jpeg_v5_0_0.c | 2 +-
 drivers/gpu/drm/amd/amdgpu/jpeg_v5_0_1.c | 2 +-
 drivers/gpu/drm/amd/amdgpu/vcn_v4_0_5.c  | 2 +-
 drivers/gpu/drm/amd/amdgpu/vcn_v5_0_0.c  | 2 +-
 14 files changed, 14 insertions(+), 22 deletions(-)

-- 
2.34.1
Re: [PATCH 0/6] drm/amdgpu: Remove redundant ternary operators
Posted by Christian König 4 weeks, 1 day ago
Reviewed-by: Christian König <christian.koenig@amd.com> for the entire series.

On 03.09.25 14:03, Liao Yuanhong wrote:
> For ternary operators in the form of "a ? true : false" or
> "a ? false : true", if 'a' itself returns a boolean result, the ternary
> operator can be omitted. Remove redundant ternary operators to clean up the
> code.
> 
> Liao Yuanhong (6):
>   drm/amdgpu/amdgpu_cper: Remove redundant ternary operators
>   drm/amdgpu/gfx: Remove redundant ternary operators
>   drm/amdgpu/gmc: Remove redundant ternary operators
>   drm/amdgpu/ih: Remove redundant ternary operators
>   drm/amdgpu/jpeg: Remove redundant ternary operators
>   drm/amdgpu/vcn: Remove redundant ternary operators
> 
>  drivers/gpu/drm/amd/amdgpu/amdgpu_cper.c | 2 +-
>  drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c   | 3 +--
>  drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c   | 3 +--
>  drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c   | 3 +--
>  drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c   | 3 +--
>  drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c   | 3 +--
>  drivers/gpu/drm/amd/amdgpu/ih_v6_0.c     | 3 +--
>  drivers/gpu/drm/amd/amdgpu/ih_v6_1.c     | 3 +--
>  drivers/gpu/drm/amd/amdgpu/ih_v7_0.c     | 3 +--
>  drivers/gpu/drm/amd/amdgpu/jpeg_v4_0_5.c | 2 +-
>  drivers/gpu/drm/amd/amdgpu/jpeg_v5_0_0.c | 2 +-
>  drivers/gpu/drm/amd/amdgpu/jpeg_v5_0_1.c | 2 +-
>  drivers/gpu/drm/amd/amdgpu/vcn_v4_0_5.c  | 2 +-
>  drivers/gpu/drm/amd/amdgpu/vcn_v5_0_0.c  | 2 +-
>  14 files changed, 14 insertions(+), 22 deletions(-)
> 

Re: [PATCH 0/6] drm/amdgpu: Remove redundant ternary operators
Posted by Alex Deucher 4 weeks, 1 day ago
Applied.  Thanks!

Alex

On Wed, Sep 3, 2025 at 8:49 AM Christian König <christian.koenig@amd.com> wrote:
>
> Reviewed-by: Christian König <christian.koenig@amd.com> for the entire series.
>
> On 03.09.25 14:03, Liao Yuanhong wrote:
> > For ternary operators in the form of "a ? true : false" or
> > "a ? false : true", if 'a' itself returns a boolean result, the ternary
> > operator can be omitted. Remove redundant ternary operators to clean up the
> > code.
> >
> > Liao Yuanhong (6):
> >   drm/amdgpu/amdgpu_cper: Remove redundant ternary operators
> >   drm/amdgpu/gfx: Remove redundant ternary operators
> >   drm/amdgpu/gmc: Remove redundant ternary operators
> >   drm/amdgpu/ih: Remove redundant ternary operators
> >   drm/amdgpu/jpeg: Remove redundant ternary operators
> >   drm/amdgpu/vcn: Remove redundant ternary operators
> >
> >  drivers/gpu/drm/amd/amdgpu/amdgpu_cper.c | 2 +-
> >  drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c   | 3 +--
> >  drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c   | 3 +--
> >  drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c   | 3 +--
> >  drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c   | 3 +--
> >  drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c   | 3 +--
> >  drivers/gpu/drm/amd/amdgpu/ih_v6_0.c     | 3 +--
> >  drivers/gpu/drm/amd/amdgpu/ih_v6_1.c     | 3 +--
> >  drivers/gpu/drm/amd/amdgpu/ih_v7_0.c     | 3 +--
> >  drivers/gpu/drm/amd/amdgpu/jpeg_v4_0_5.c | 2 +-
> >  drivers/gpu/drm/amd/amdgpu/jpeg_v5_0_0.c | 2 +-
> >  drivers/gpu/drm/amd/amdgpu/jpeg_v5_0_1.c | 2 +-
> >  drivers/gpu/drm/amd/amdgpu/vcn_v4_0_5.c  | 2 +-
> >  drivers/gpu/drm/amd/amdgpu/vcn_v5_0_0.c  | 2 +-
> >  14 files changed, 14 insertions(+), 22 deletions(-)
> >
>