Re: [PATCH 02/16] drm/amd/powerplay: drop unused APIs and unnecessary checks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jun 4, 2020 at 12:46 AM Evan Quan <evan.quan@xxxxxxx> wrote:
>
> Minor code cleanups.
>
> Change-Id: I6d240241e78cae17288c1d49dbae6ab1796b1128
> Signed-off-by: Evan Quan <evan.quan@xxxxxxx>

Reviewed-by: Alex Deucher <alexander.deucher@xxxxxxx>

> ---
>  drivers/gpu/drm/amd/powerplay/amdgpu_smu.c    | 74 ++++---------------
>  .../gpu/drm/amd/powerplay/inc/amdgpu_smu.h    |  2 -
>  2 files changed, 16 insertions(+), 60 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
> index b2c1ad95edf7..bd0fe71dffde 100644
> --- a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
> +++ b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
> @@ -720,30 +720,6 @@ int smu_feature_is_supported(struct smu_context *smu, enum smu_feature_mask mask
>         return ret;
>  }
>
> -int smu_feature_set_supported(struct smu_context *smu,
> -                             enum smu_feature_mask mask,
> -                             bool enable)
> -{
> -       struct smu_feature *feature = &smu->smu_feature;
> -       int feature_id;
> -       int ret = 0;
> -
> -       feature_id = smu_feature_get_index(smu, mask);
> -       if (feature_id < 0)
> -               return -EINVAL;
> -
> -       WARN_ON(feature_id > feature->feature_num);
> -
> -       mutex_lock(&feature->mutex);
> -       if (enable)
> -               test_and_set_bit(feature_id, feature->supported);
> -       else
> -               test_and_clear_bit(feature_id, feature->supported);
> -       mutex_unlock(&feature->mutex);
> -
> -       return ret;
> -}
> -
>  static int smu_set_funcs(struct amdgpu_device *adev)
>  {
>         struct smu_context *smu = &adev->smu;
> @@ -823,22 +799,10 @@ int smu_get_atom_data_table(struct smu_context *smu, uint32_t table,
>         return 0;
>  }
>
> -static int smu_initialize_pptable(struct smu_context *smu)
> -{
> -       /* TODO */
> -       return 0;
> -}
> -
>  static int smu_smc_table_sw_init(struct smu_context *smu)
>  {
>         int ret;
>
> -       ret = smu_initialize_pptable(smu);
> -       if (ret) {
> -               pr_err("Failed to init smu_initialize_pptable!\n");
> -               return ret;
> -       }
> -
>         /**
>          * Create smu_table structure, and init smc tables such as
>          * TABLE_PPTABLE, TABLE_WATERMARKS, TABLE_SMU_METRICS, and etc.
> @@ -1137,19 +1101,16 @@ static int smu_smc_table_hw_init(struct smu_context *smu,
>                 return ret;
>         }
>
> -       if (smu->ppt_funcs->set_power_source) {
> -               /*
> -                * For Navi1X, manually switch it to AC mode as PMFW
> -                * may boot it with DC mode.
> -                */
> -               if (adev->pm.ac_power)
> -                       ret = smu_set_power_source(smu, SMU_POWER_SOURCE_AC);
> -               else
> -                       ret = smu_set_power_source(smu, SMU_POWER_SOURCE_DC);
> -               if (ret) {
> -                       pr_err("Failed to switch to %s mode!\n", adev->pm.ac_power ? "AC" : "DC");
> -                       return ret;
> -               }
> +       /*
> +        * For Navi1X, manually switch it to AC mode as PMFW
> +        * may boot it with DC mode.
> +        */
> +       ret = smu_set_power_source(smu,
> +                                  adev->pm.ac_power ? SMU_POWER_SOURCE_AC :
> +                                  SMU_POWER_SOURCE_DC);
> +       if (ret) {
> +               pr_err("Failed to switch to %s mode!\n", adev->pm.ac_power ? "AC" : "DC");
> +               return ret;
>         }
>
>         ret = smu_notify_display_change(smu);
> @@ -2138,15 +2099,12 @@ int smu_set_ac_dc(struct smu_context *smu)
>                 return 0;
>
>         mutex_lock(&smu->mutex);
> -       if (smu->ppt_funcs->set_power_source) {
> -               if (smu->adev->pm.ac_power)
> -                       ret = smu_set_power_source(smu, SMU_POWER_SOURCE_AC);
> -               else
> -                       ret = smu_set_power_source(smu, SMU_POWER_SOURCE_DC);
> -               if (ret)
> -                       pr_err("Failed to switch to %s mode!\n",
> -                              smu->adev->pm.ac_power ? "AC" : "DC");
> -       }
> +       ret = smu_set_power_source(smu,
> +                                  smu->adev->pm.ac_power ? SMU_POWER_SOURCE_AC :
> +                                  SMU_POWER_SOURCE_DC);
> +       if (ret)
> +               pr_err("Failed to switch to %s mode!\n",
> +                      smu->adev->pm.ac_power ? "AC" : "DC");
>         mutex_unlock(&smu->mutex);
>
>         return ret;
> diff --git a/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h b/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h
> index 13fc5773ba45..210432187ceb 100644
> --- a/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h
> +++ b/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h
> @@ -670,8 +670,6 @@ extern int smu_feature_set_enabled(struct smu_context *smu,
>                                    enum smu_feature_mask mask, bool enable);
>  extern int smu_feature_is_supported(struct smu_context *smu,
>                                     enum smu_feature_mask mask);
> -extern int smu_feature_set_supported(struct smu_context *smu,
> -                                    enum smu_feature_mask mask, bool enable);
>
>  int smu_update_table(struct smu_context *smu, enum smu_table_id table_index, int argument,
>                      void *table_data, bool drv2smu);
> --
> 2.27.0
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@xxxxxxxxxxxxxxxxxxxxx
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/amd-gfx



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux