Applied the series.  Thanks!

Alex

On Thu, Sep 4, 2025 at 4:29 AM Liao Yuanhong <liaoyuanh...@vivo.com> wrote:
>
> For ternary operators in the form of "a ? true : false", if 'a' itself
> returns a boolean result, the ternary operator can be omitted. Remove
> redundant ternary operators to clean up the code. Swap variable positions
> on either side of '==' to enhance readability.
>
> Signed-off-by: Liao Yuanhong <liaoyuanh...@vivo.com>
> ---
>  drivers/gpu/drm/amd/pm/powerplay/smumgr/fiji_smumgr.c      | 5 ++---
>  drivers/gpu/drm/amd/pm/powerplay/smumgr/iceland_smumgr.c   | 5 ++---
>  drivers/gpu/drm/amd/pm/powerplay/smumgr/polaris10_smumgr.c | 5 ++---
>  drivers/gpu/drm/amd/pm/powerplay/smumgr/tonga_smumgr.c     | 5 ++---
>  4 files changed, 8 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/pm/powerplay/smumgr/fiji_smumgr.c 
> b/drivers/gpu/drm/amd/pm/powerplay/smumgr/fiji_smumgr.c
> index 5e43ad2b2956..d2dbd90bb427 100644
> --- a/drivers/gpu/drm/amd/pm/powerplay/smumgr/fiji_smumgr.c
> +++ b/drivers/gpu/drm/amd/pm/powerplay/smumgr/fiji_smumgr.c
> @@ -2540,9 +2540,8 @@ static int fiji_initialize_mc_reg_table(struct pp_hwmgr 
> *hwmgr)
>
>  static bool fiji_is_dpm_running(struct pp_hwmgr *hwmgr)
>  {
> -       return (1 == PHM_READ_INDIRECT_FIELD(hwmgr->device,
> -                       CGS_IND_REG__SMC, FEATURE_STATUS, 
> VOLTAGE_CONTROLLER_ON))
> -                       ? true : false;
> +       return PHM_READ_INDIRECT_FIELD(hwmgr->device,
> +                       CGS_IND_REG__SMC, FEATURE_STATUS, 
> VOLTAGE_CONTROLLER_ON) == 1;
>  }
>
>  static int fiji_update_dpm_settings(struct pp_hwmgr *hwmgr,
> diff --git a/drivers/gpu/drm/amd/pm/powerplay/smumgr/iceland_smumgr.c 
> b/drivers/gpu/drm/amd/pm/powerplay/smumgr/iceland_smumgr.c
> index 17d2f5bff4a7..1f50f1e74c48 100644
> --- a/drivers/gpu/drm/amd/pm/powerplay/smumgr/iceland_smumgr.c
> +++ b/drivers/gpu/drm/amd/pm/powerplay/smumgr/iceland_smumgr.c
> @@ -2655,9 +2655,8 @@ static int iceland_initialize_mc_reg_table(struct 
> pp_hwmgr *hwmgr)
>
>  static bool iceland_is_dpm_running(struct pp_hwmgr *hwmgr)
>  {
> -       return (1 == PHM_READ_INDIRECT_FIELD(hwmgr->device,
> -                       CGS_IND_REG__SMC, FEATURE_STATUS, 
> VOLTAGE_CONTROLLER_ON))
> -                       ? true : false;
> +       return PHM_READ_INDIRECT_FIELD(hwmgr->device,
> +                       CGS_IND_REG__SMC, FEATURE_STATUS, 
> VOLTAGE_CONTROLLER_ON) == 1;
>  }
>
>  const struct pp_smumgr_func iceland_smu_funcs = {
> diff --git a/drivers/gpu/drm/amd/pm/powerplay/smumgr/polaris10_smumgr.c 
> b/drivers/gpu/drm/amd/pm/powerplay/smumgr/polaris10_smumgr.c
> index ff6b563ecbf5..bf6d09572cfc 100644
> --- a/drivers/gpu/drm/amd/pm/powerplay/smumgr/polaris10_smumgr.c
> +++ b/drivers/gpu/drm/amd/pm/powerplay/smumgr/polaris10_smumgr.c
> @@ -2578,9 +2578,8 @@ static int polaris10_initialize_mc_reg_table(struct 
> pp_hwmgr *hwmgr)
>
>  static bool polaris10_is_dpm_running(struct pp_hwmgr *hwmgr)
>  {
> -       return (1 == PHM_READ_INDIRECT_FIELD(hwmgr->device,
> -                       CGS_IND_REG__SMC, FEATURE_STATUS, 
> VOLTAGE_CONTROLLER_ON))
> -                       ? true : false;
> +       return PHM_READ_INDIRECT_FIELD(hwmgr->device,
> +                       CGS_IND_REG__SMC, FEATURE_STATUS, 
> VOLTAGE_CONTROLLER_ON) == 1;
>  }
>
>  static int polaris10_update_dpm_settings(struct pp_hwmgr *hwmgr,
> diff --git a/drivers/gpu/drm/amd/pm/powerplay/smumgr/tonga_smumgr.c 
> b/drivers/gpu/drm/amd/pm/powerplay/smumgr/tonga_smumgr.c
> index 6fe6e6abb5d8..2e21f9d066cb 100644
> --- a/drivers/gpu/drm/amd/pm/powerplay/smumgr/tonga_smumgr.c
> +++ b/drivers/gpu/drm/amd/pm/powerplay/smumgr/tonga_smumgr.c
> @@ -3139,9 +3139,8 @@ static int tonga_initialize_mc_reg_table(struct 
> pp_hwmgr *hwmgr)
>
>  static bool tonga_is_dpm_running(struct pp_hwmgr *hwmgr)
>  {
> -       return (1 == PHM_READ_INDIRECT_FIELD(hwmgr->device,
> -                       CGS_IND_REG__SMC, FEATURE_STATUS, 
> VOLTAGE_CONTROLLER_ON))
> -                       ? true : false;
> +       return PHM_READ_INDIRECT_FIELD(hwmgr->device,
> +                       CGS_IND_REG__SMC, FEATURE_STATUS, 
> VOLTAGE_CONTROLLER_ON) == 1;
>  }
>
>  static int tonga_update_dpm_settings(struct pp_hwmgr *hwmgr,
> --
> 2.34.1
>

Reply via email to