Skip to content

Commit d3df66f

Browse files
author
Luben Tuikov
committed
drm/amdgpu: Remove redundant call to priority_is_valid()
Remove a redundant call to amdgpu_ctx_priority_is_valid() from amdgpu_ctx_priority_permit(), which is called from amdgpu_ctx_init() which is called from amdgpu_ctx_alloc() which is called from amdgpu_ctx_ioctl(), where we've called amdgpu_ctx_priority_is_valid() already first thing in the function. Cc: Alex Deucher <Alexander.Deucher@amd.com> Cc: Christian König <christian.koenig@amd.com> Signed-off-by: Luben Tuikov <luben.tuikov@amd.com> Acked-by: Christian König <christian.koenig@amd.com> Link: https://lore.kernel.org/r/20231018010359.30393-1-luben.tuikov@amd.com
1 parent 3d887d5 commit d3df66f

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ bool amdgpu_ctx_priority_is_valid(int32_t ctx_prio)
5555
return true;
5656
default:
5757
case AMDGPU_CTX_PRIORITY_UNSET:
58+
/* UNSET priority is not valid and we don't carry that
59+
* around, but set it to NORMAL in the only place this
60+
* function is called, amdgpu_ctx_ioctl().
61+
*/
5862
return false;
5963
}
6064
}
@@ -95,9 +99,6 @@ amdgpu_ctx_to_drm_sched_prio(int32_t ctx_prio)
9599
static int amdgpu_ctx_priority_permit(struct drm_file *filp,
96100
int32_t priority)
97101
{
98-
if (!amdgpu_ctx_priority_is_valid(priority))
99-
return -EINVAL;
100-
101102
/* NORMAL and below are accessible by everyone */
102103
if (priority <= AMDGPU_CTX_PRIORITY_NORMAL)
103104
return 0;
@@ -632,8 +633,6 @@ static int amdgpu_ctx_query2(struct amdgpu_device *adev,
632633
return 0;
633634
}
634635

635-
636-
637636
static int amdgpu_ctx_stable_pstate(struct amdgpu_device *adev,
638637
struct amdgpu_fpriv *fpriv, uint32_t id,
639638
bool set, u32 *stable_pstate)
@@ -676,8 +675,10 @@ int amdgpu_ctx_ioctl(struct drm_device *dev, void *data,
676675
id = args->in.ctx_id;
677676
priority = args->in.priority;
678677

679-
/* For backwards compatibility reasons, we need to accept
680-
* ioctls with garbage in the priority field */
678+
/* For backwards compatibility, we need to accept ioctls with garbage
679+
* in the priority field. Garbage values in the priority field, result
680+
* in the priority being set to NORMAL.
681+
*/
681682
if (!amdgpu_ctx_priority_is_valid(priority))
682683
priority = AMDGPU_CTX_PRIORITY_NORMAL;
683684

0 commit comments

Comments
 (0)