aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Russell <[email protected]>2022-03-25 10:11:36 -0400
committerAlex Deucher <[email protected]>2022-03-31 23:05:54 -0400
commit60044748f2c816aad2b5f95c46774ce0aaccf4ca (patch)
tree9d2f4b43d6db1454012d558a79d557799c19c8fd
parent8fde0248a32d29228520b876b8b27d0c44133734 (diff)
drm/amdgpu: Use switch case for unique_id
To ease readability, use switch to set unique_id as supported for the supported IP_VERSIONs, and set it to unsupported by default for all other ASICs. This makes it easier to add IP_VERSIONs later on, and makes it obvious that it is not supported by default, instead of the current logic that assumes that it is supported unless it is not one of the specified IP_VERSIONs. v2: Rebase onto previous IP_VERSION change Signed-off-by: Kent Russell <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Reviewed-by: Kevin Wang <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
-rw-r--r--drivers/gpu/drm/amd/pm/amdgpu_pm.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/gpu/drm/amd/pm/amdgpu_pm.c b/drivers/gpu/drm/amd/pm/amdgpu_pm.c
index 9ce597ded31d..4151db2678fb 100644
--- a/drivers/gpu/drm/amd/pm/amdgpu_pm.c
+++ b/drivers/gpu/drm/amd/pm/amdgpu_pm.c
@@ -1988,11 +1988,16 @@ static int default_attr_update(struct amdgpu_device *adev, struct amdgpu_device_
if (adev->flags & AMD_IS_APU)
*states = ATTR_STATE_UNSUPPORTED;
} else if (DEVICE_ATTR_IS(unique_id)) {
- if (gc_ver != IP_VERSION(9, 0, 1) &&
- gc_ver != IP_VERSION(9, 4, 0) &&
- gc_ver != IP_VERSION(9, 4, 1) &&
- gc_ver != IP_VERSION(9, 4, 2))
+ switch (gc_ver) {
+ case IP_VERSION(9, 0, 1):
+ case IP_VERSION(9, 4, 0):
+ case IP_VERSION(9, 4, 1):
+ case IP_VERSION(9, 4, 2):
+ *states = ATTR_STATE_SUPPORTED;
+ break;
+ default:
*states = ATTR_STATE_UNSUPPORTED;
+ }
} else if (DEVICE_ATTR_IS(pp_features)) {
if (adev->flags & AMD_IS_APU || gc_ver < IP_VERSION(9, 0, 0))
*states = ATTR_STATE_UNSUPPORTED;