[PATCH] drm/amdgpu: use error code EOPNOTSUPP instead of ENOTSUPPT
Lazar, Lijo
lijo.lazar at amd.com
Fri Sep 15 08:16:04 UTC 2023
On 9/15/2023 5:36 AM, Yang Wang wrote:
> WARNING: ENOTSUPP is not a SUSV4 error code, prefer EOPNOTSUPP
>
> $ find drivers/gpu/drm/amd -type f \
> -exec sed -i 's/\-ENOTSUPP/\-EOPNOTSUPP/g' {} \;
>
> Signed-off-by: Yang Wang <kevinyang.wang at amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 6 +++---
> drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 2 +-
> drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 2 +-
> drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 2 +-
> drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 2 +-
> .../gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c | 6 +++---
> .../amd/pm/swsmu/smu11/sienna_cichlid_ppt.c | 4 ++--
> .../drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c | 18 +++++++++---------
> .../drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c | 18 +++++++++---------
> drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c | 4 ++--
> 10 files changed, 32 insertions(+), 32 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index e055e06d020c..a7f0b6ccd137 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -1268,7 +1268,7 @@ int amdgpu_device_resize_fb_bar(struct amdgpu_device *adev)
> r = pci_resize_resource(adev->pdev, 0, rbar_size);
> if (r == -ENOSPC)
> DRM_INFO("Not enough PCI address space for a large BAR.");
> - else if (r && r != -ENOTSUPP)
> + else if (r && r != -EOPNOTSUPP)
pci_resize_resource returns -ENOTSUPP.
> DRM_ERROR("Problem resizing BAR0 (%d).", r);
>
> pci_assign_unassigned_bus_resources(adev->pdev->bus);
> @@ -5747,7 +5747,7 @@ int amdgpu_device_baco_enter(struct drm_device *dev)
> struct amdgpu_ras *ras = amdgpu_ras_get_context(adev);
>
> if (!amdgpu_device_supports_baco(dev))
> - return -ENOTSUPP;
> + return -EOPNOTSUPP;
>
> if (ras && adev->ras_enabled &&
> adev->nbio.funcs->enable_doorbell_interrupt)
> @@ -5763,7 +5763,7 @@ int amdgpu_device_baco_exit(struct drm_device *dev)
> int ret = 0;
>
> if (!amdgpu_device_supports_baco(dev))
> - return -ENOTSUPP;
> + return -EOPNOTSUPP;
>
> ret = amdgpu_dpm_baco_exit(adev);
> if (ret)
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> index e3471293846f..ffd7035603cd 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> @@ -2126,7 +2126,7 @@ static int amdgpu_pci_probe(struct pci_dev *pdev,
> ((flags & AMD_ASIC_MASK) == CHIP_RAVEN)) {
> dev_info(&pdev->dev,
> "SME is not compatible with RAVEN\n");
> - return -ENOTSUPP;
> + return -EOPNOTSUPP;
Since pci base considers this as a valid one, I think it's ok to retain
-ENOTSUPP.
For few external ones like *_od_edit_dpm_table, need to be cautious as
the user apps may be checking against older error code.
Thanks,
Lijo
> }
>
> #ifdef CONFIG_DRM_AMDGPU_SI
> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
> index 42fc0cc13fdd..e31b7f9fcddc 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
> @@ -867,7 +867,7 @@ static int gfx_v11_0_get_gfx_shadow_info(struct amdgpu_device *adev,
> return 0;
> } else {
> memset(shadow_info, 0, sizeof(struct amdgpu_gfx_shadow_info));
> - return -ENOTSUPP;
> + return -EOPNOTSUPP;
> }
> }
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
> index 65d2b9ae16bb..120b815a3f27 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
> @@ -262,7 +262,7 @@ static int set_queue_properties_from_user(struct queue_properties *q_properties,
> else if (args->queue_type == KFD_IOC_QUEUE_TYPE_SDMA_XGMI)
> q_properties->type = KFD_QUEUE_TYPE_SDMA_XGMI;
> else
> - return -ENOTSUPP;
> + return -EOPNOTSUPP;
>
> if (args->queue_type == KFD_IOC_QUEUE_TYPE_COMPUTE_AQL)
> q_properties->format = KFD_QUEUE_FORMAT_AQL;
> diff --git a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
> index e6f1620acdd4..2c88dbe2d718 100644
> --- a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
> +++ b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
> @@ -147,7 +147,7 @@ int smu_get_dpm_freq_range(struct smu_context *smu,
> uint32_t *min,
> uint32_t *max)
> {
> - int ret = -ENOTSUPP;
> + int ret = -EOPNOTSUPP;
>
> if (!min && !max)
> return -EINVAL;
> diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c
> index 650482cedd1f..f48ec6c62307 100644
> --- a/drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c
> +++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c
> @@ -2591,7 +2591,7 @@ static int navi10_od_edit_dpm_table(struct smu_context *smu, enum PP_OD_DPM_TABL
> case PP_OD_EDIT_SCLK_VDDC_TABLE:
> if (!navi10_od_feature_is_supported(od_settings, SMU_11_0_ODCAP_GFXCLK_LIMITS)) {
> dev_warn(smu->adev->dev, "GFXCLK_LIMITS not supported!\n");
> - return -ENOTSUPP;
> + return -EOPNOTSUPP;
> }
> if (!table_context->overdrive_table) {
> dev_err(smu->adev->dev, "Overdrive is not initialized\n");
> @@ -2637,7 +2637,7 @@ static int navi10_od_edit_dpm_table(struct smu_context *smu, enum PP_OD_DPM_TABL
> case PP_OD_EDIT_MCLK_VDDC_TABLE:
> if (!navi10_od_feature_is_supported(od_settings, SMU_11_0_ODCAP_UCLK_MAX)) {
> dev_warn(smu->adev->dev, "UCLK_MAX not supported!\n");
> - return -ENOTSUPP;
> + return -EOPNOTSUPP;
> }
> if (size < 2) {
> dev_info(smu->adev->dev, "invalid number of parameters: %d\n", size);
> @@ -2680,7 +2680,7 @@ static int navi10_od_edit_dpm_table(struct smu_context *smu, enum PP_OD_DPM_TABL
> case PP_OD_EDIT_VDDC_CURVE:
> if (!navi10_od_feature_is_supported(od_settings, SMU_11_0_ODCAP_GFXCLK_CURVE)) {
> dev_warn(smu->adev->dev, "GFXCLK_CURVE not supported!\n");
> - return -ENOTSUPP;
> + return -EOPNOTSUPP;
> }
> if (size < 3) {
> dev_info(smu->adev->dev, "invalid number of parameters: %d\n", size);
> diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c
> index 164c2264027d..828e6676e713 100644
> --- a/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c
> +++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c
> @@ -2256,7 +2256,7 @@ static int sienna_cichlid_od_edit_dpm_table(struct smu_context *smu,
> if (!sienna_cichlid_is_od_feature_supported(od_settings,
> SMU_11_0_7_ODCAP_GFXCLK_LIMITS)) {
> dev_warn(smu->adev->dev, "GFXCLK_LIMITS not supported!\n");
> - return -ENOTSUPP;
> + return -EOPNOTSUPP;
> }
>
> for (i = 0; i < size; i += 2) {
> @@ -2306,7 +2306,7 @@ static int sienna_cichlid_od_edit_dpm_table(struct smu_context *smu,
> case PP_OD_EDIT_MCLK_VDDC_TABLE:
> if (!sienna_cichlid_is_od_feature_supported(od_settings, SMU_11_0_7_ODCAP_UCLK_LIMITS)) {
> dev_warn(smu->adev->dev, "UCLK_LIMITS not supported!\n");
> - return -ENOTSUPP;
> + return -EOPNOTSUPP;
> }
>
> for (i = 0; i < size; i += 2) {
> diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c
> index a3cbe15c3123..a928ed20884c 100644
> --- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c
> +++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c
> @@ -1529,7 +1529,7 @@ static int smu_v13_0_0_od_edit_dpm_table(struct smu_context *smu,
> case PP_OD_EDIT_SCLK_VDDC_TABLE:
> if (!smu_v13_0_0_is_od_feature_supported(smu, PP_OD_FEATURE_GFXCLK_BIT)) {
> dev_warn(adev->dev, "GFXCLK_LIMITS setting not supported!\n");
> - return -ENOTSUPP;
> + return -EOPNOTSUPP;
> }
>
> for (i = 0; i < size; i += 2) {
> @@ -1590,7 +1590,7 @@ static int smu_v13_0_0_od_edit_dpm_table(struct smu_context *smu,
> case PP_OD_EDIT_MCLK_VDDC_TABLE:
> if (!smu_v13_0_0_is_od_feature_supported(smu, PP_OD_FEATURE_UCLK_BIT)) {
> dev_warn(adev->dev, "UCLK_LIMITS setting not supported!\n");
> - return -ENOTSUPP;
> + return -EOPNOTSUPP;
> }
>
> for (i = 0; i < size; i += 2) {
> @@ -1651,7 +1651,7 @@ static int smu_v13_0_0_od_edit_dpm_table(struct smu_context *smu,
> case PP_OD_EDIT_VDDGFX_OFFSET:
> if (!smu_v13_0_0_is_od_feature_supported(smu, PP_OD_FEATURE_GFX_VF_CURVE_BIT)) {
> dev_warn(adev->dev, "Gfx offset setting not supported!\n");
> - return -ENOTSUPP;
> + return -EOPNOTSUPP;
> }
>
> smu_v13_0_0_get_od_setting_limits(smu,
> @@ -1673,7 +1673,7 @@ static int smu_v13_0_0_od_edit_dpm_table(struct smu_context *smu,
> case PP_OD_EDIT_FAN_CURVE:
> if (!smu_v13_0_0_is_od_feature_supported(smu, PP_OD_FEATURE_FAN_CURVE_BIT)) {
> dev_warn(adev->dev, "Fan curve setting not supported!\n");
> - return -ENOTSUPP;
> + return -EOPNOTSUPP;
> }
>
> if (input[0] >= NUM_OD_FAN_MAX_POINTS - 1 ||
> @@ -1711,7 +1711,7 @@ static int smu_v13_0_0_od_edit_dpm_table(struct smu_context *smu,
> case PP_OD_EDIT_ACOUSTIC_LIMIT:
> if (!smu_v13_0_0_is_od_feature_supported(smu, PP_OD_FEATURE_FAN_CURVE_BIT)) {
> dev_warn(adev->dev, "Fan curve setting not supported!\n");
> - return -ENOTSUPP;
> + return -EOPNOTSUPP;
> }
>
> smu_v13_0_0_get_od_setting_limits(smu,
> @@ -1733,7 +1733,7 @@ static int smu_v13_0_0_od_edit_dpm_table(struct smu_context *smu,
> case PP_OD_EDIT_ACOUSTIC_TARGET:
> if (!smu_v13_0_0_is_od_feature_supported(smu, PP_OD_FEATURE_FAN_CURVE_BIT)) {
> dev_warn(adev->dev, "Fan curve setting not supported!\n");
> - return -ENOTSUPP;
> + return -EOPNOTSUPP;
> }
>
> smu_v13_0_0_get_od_setting_limits(smu,
> @@ -1755,7 +1755,7 @@ static int smu_v13_0_0_od_edit_dpm_table(struct smu_context *smu,
> case PP_OD_EDIT_FAN_TARGET_TEMPERATURE:
> if (!smu_v13_0_0_is_od_feature_supported(smu, PP_OD_FEATURE_FAN_CURVE_BIT)) {
> dev_warn(adev->dev, "Fan curve setting not supported!\n");
> - return -ENOTSUPP;
> + return -EOPNOTSUPP;
> }
>
> smu_v13_0_0_get_od_setting_limits(smu,
> @@ -1777,7 +1777,7 @@ static int smu_v13_0_0_od_edit_dpm_table(struct smu_context *smu,
> case PP_OD_EDIT_FAN_MINIMUM_PWM:
> if (!smu_v13_0_0_is_od_feature_supported(smu, PP_OD_FEATURE_FAN_CURVE_BIT)) {
> dev_warn(adev->dev, "Fan curve setting not supported!\n");
> - return -ENOTSUPP;
> + return -EOPNOTSUPP;
> }
>
> smu_v13_0_0_get_od_setting_limits(smu,
> @@ -2356,7 +2356,7 @@ static int smu_v13_0_0_get_power_profile_mode(struct smu_context *smu,
> workload_type = smu_cmn_to_asic_specific_index(smu,
> CMN2ASIC_MAPPING_WORKLOAD,
> i);
> - if (workload_type == -ENOTSUPP)
> + if (workload_type == -EOPNOTSUPP)
> continue;
> else if (workload_type < 0)
> return -EINVAL;
> diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c
> index 430ad1b05ba3..f85e0ef60fea 100644
> --- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c
> +++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c
> @@ -1515,7 +1515,7 @@ static int smu_v13_0_7_od_edit_dpm_table(struct smu_context *smu,
> case PP_OD_EDIT_SCLK_VDDC_TABLE:
> if (!smu_v13_0_7_is_od_feature_supported(smu, PP_OD_FEATURE_GFXCLK_BIT)) {
> dev_warn(adev->dev, "GFXCLK_LIMITS setting not supported!\n");
> - return -ENOTSUPP;
> + return -EOPNOTSUPP;
> }
>
> for (i = 0; i < size; i += 2) {
> @@ -1576,7 +1576,7 @@ static int smu_v13_0_7_od_edit_dpm_table(struct smu_context *smu,
> case PP_OD_EDIT_MCLK_VDDC_TABLE:
> if (!smu_v13_0_7_is_od_feature_supported(smu, PP_OD_FEATURE_UCLK_BIT)) {
> dev_warn(adev->dev, "UCLK_LIMITS setting not supported!\n");
> - return -ENOTSUPP;
> + return -EOPNOTSUPP;
> }
>
> for (i = 0; i < size; i += 2) {
> @@ -1637,7 +1637,7 @@ static int smu_v13_0_7_od_edit_dpm_table(struct smu_context *smu,
> case PP_OD_EDIT_VDDGFX_OFFSET:
> if (!smu_v13_0_7_is_od_feature_supported(smu, PP_OD_FEATURE_GFX_VF_CURVE_BIT)) {
> dev_warn(adev->dev, "Gfx offset setting not supported!\n");
> - return -ENOTSUPP;
> + return -EOPNOTSUPP;
> }
>
> smu_v13_0_7_get_od_setting_limits(smu,
> @@ -1659,7 +1659,7 @@ static int smu_v13_0_7_od_edit_dpm_table(struct smu_context *smu,
> case PP_OD_EDIT_FAN_CURVE:
> if (!smu_v13_0_7_is_od_feature_supported(smu, PP_OD_FEATURE_FAN_CURVE_BIT)) {
> dev_warn(adev->dev, "Fan curve setting not supported!\n");
> - return -ENOTSUPP;
> + return -EOPNOTSUPP;
> }
>
> if (input[0] >= NUM_OD_FAN_MAX_POINTS - 1 ||
> @@ -1697,7 +1697,7 @@ static int smu_v13_0_7_od_edit_dpm_table(struct smu_context *smu,
> case PP_OD_EDIT_ACOUSTIC_LIMIT:
> if (!smu_v13_0_7_is_od_feature_supported(smu, PP_OD_FEATURE_FAN_CURVE_BIT)) {
> dev_warn(adev->dev, "Fan curve setting not supported!\n");
> - return -ENOTSUPP;
> + return -EOPNOTSUPP;
> }
>
> smu_v13_0_7_get_od_setting_limits(smu,
> @@ -1719,7 +1719,7 @@ static int smu_v13_0_7_od_edit_dpm_table(struct smu_context *smu,
> case PP_OD_EDIT_ACOUSTIC_TARGET:
> if (!smu_v13_0_7_is_od_feature_supported(smu, PP_OD_FEATURE_FAN_CURVE_BIT)) {
> dev_warn(adev->dev, "Fan curve setting not supported!\n");
> - return -ENOTSUPP;
> + return -EOPNOTSUPP;
> }
>
> smu_v13_0_7_get_od_setting_limits(smu,
> @@ -1741,7 +1741,7 @@ static int smu_v13_0_7_od_edit_dpm_table(struct smu_context *smu,
> case PP_OD_EDIT_FAN_TARGET_TEMPERATURE:
> if (!smu_v13_0_7_is_od_feature_supported(smu, PP_OD_FEATURE_FAN_CURVE_BIT)) {
> dev_warn(adev->dev, "Fan curve setting not supported!\n");
> - return -ENOTSUPP;
> + return -EOPNOTSUPP;
> }
>
> smu_v13_0_7_get_od_setting_limits(smu,
> @@ -1763,7 +1763,7 @@ static int smu_v13_0_7_od_edit_dpm_table(struct smu_context *smu,
> case PP_OD_EDIT_FAN_MINIMUM_PWM:
> if (!smu_v13_0_7_is_od_feature_supported(smu, PP_OD_FEATURE_FAN_CURVE_BIT)) {
> dev_warn(adev->dev, "Fan curve setting not supported!\n");
> - return -ENOTSUPP;
> + return -EOPNOTSUPP;
> }
>
> smu_v13_0_7_get_od_setting_limits(smu,
> @@ -2310,7 +2310,7 @@ static int smu_v13_0_7_get_power_profile_mode(struct smu_context *smu, char *buf
> workload_type = smu_cmn_to_asic_specific_index(smu,
> CMN2ASIC_MAPPING_WORKLOAD,
> i);
> - if (workload_type == -ENOTSUPP)
> + if (workload_type == -EOPNOTSUPP)
> continue;
> else if (workload_type < 0) {
> result = -EINVAL;
> diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c b/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c
> index b3682807cec2..f81ffe7ce7bb 100644
> --- a/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c
> +++ b/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c
> @@ -50,7 +50,7 @@ static const char * const __smu_message_names[] = {
> #define smu_cmn_call_asic_func(intf, smu, args...) \
> ((smu)->ppt_funcs ? ((smu)->ppt_funcs->intf ? \
> (smu)->ppt_funcs->intf(smu, ##args) : \
> - -ENOTSUPP) : \
> + -EOPNOTSUPP) : \
> -EINVAL)
>
> static const char *smu_get_message_name(struct smu_context *smu,
> @@ -492,7 +492,7 @@ int smu_cmn_to_asic_specific_index(struct smu_context *smu,
>
> mapping = smu->workload_map[index];
> if (!mapping.valid_mapping)
> - return -ENOTSUPP;
> + return -EOPNOTSUPP;
>
> return mapping.map_to;
>
More information about the amd-gfx
mailing list