aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2019-04-14 12:49:44 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2019-05-02 02:25:53 -0400
commit95ce0bce20fe67c750c0c26491a8c6819daeab94 (patch)
treef02003085451fc5b35549ed217f6cbc392032624 /drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c
parent79ea35bc20a1b16f2ebd0f70a5a1041a121a2366 (diff)
amdgpu: switch to fdget()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c
index 0767a93e4d91..639297250c21 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c
@@ -53,26 +53,25 @@ static int amdgpu_sched_process_priority_override(struct amdgpu_device *adev,
53 int fd, 53 int fd,
54 enum drm_sched_priority priority) 54 enum drm_sched_priority priority)
55{ 55{
56 struct file *filp = fget(fd); 56 struct fd f = fdget(fd);
57 struct amdgpu_fpriv *fpriv; 57 struct amdgpu_fpriv *fpriv;
58 struct amdgpu_ctx *ctx; 58 struct amdgpu_ctx *ctx;
59 uint32_t id; 59 uint32_t id;
60 int r; 60 int r;
61 61
62 if (!filp) 62 if (!f.file)
63 return -EINVAL; 63 return -EINVAL;
64 64
65 r = amdgpu_file_to_fpriv(filp, &fpriv); 65 r = amdgpu_file_to_fpriv(f.file, &fpriv);
66 if (r) { 66 if (r) {
67 fput(filp); 67 fdput(f);
68 return r; 68 return r;
69 } 69 }
70 70
71 idr_for_each_entry(&fpriv->ctx_mgr.ctx_handles, ctx, id) 71 idr_for_each_entry(&fpriv->ctx_mgr.ctx_handles, ctx, id)
72 amdgpu_ctx_priority_override(ctx, priority); 72 amdgpu_ctx_priority_override(ctx, priority);
73 73
74 fput(filp); 74 fdput(f);
75
76 return 0; 75 return 0;
77} 76}
78 77
@@ -81,30 +80,30 @@ static int amdgpu_sched_context_priority_override(struct amdgpu_device *adev,
81 unsigned ctx_id, 80 unsigned ctx_id,
82 enum drm_sched_priority priority) 81 enum drm_sched_priority priority)
83{ 82{
84 struct file *filp = fget(fd); 83 struct fd f = fdget(fd);
85 struct amdgpu_fpriv *fpriv; 84 struct amdgpu_fpriv *fpriv;
86 struct amdgpu_ctx *ctx; 85 struct amdgpu_ctx *ctx;
87 int r; 86 int r;
88 87
89 if (!filp) 88 if (!f.file)
90 return -EINVAL; 89 return -EINVAL;
91 90
92 r = amdgpu_file_to_fpriv(filp, &fpriv); 91 r = amdgpu_file_to_fpriv(f.file, &fpriv);
93 if (r) { 92 if (r) {
94 fput(filp); 93 fdput(f);
95 return r; 94 return r;
96 } 95 }
97 96
98 ctx = amdgpu_ctx_get(fpriv, ctx_id); 97 ctx = amdgpu_ctx_get(fpriv, ctx_id);
99 98
100 if (!ctx) { 99 if (!ctx) {
101 fput(filp); 100 fdput(f);
102 return -EINVAL; 101 return -EINVAL;
103 } 102 }
104 103
105 amdgpu_ctx_priority_override(ctx, priority); 104 amdgpu_ctx_priority_override(ctx, priority);
106 amdgpu_ctx_put(ctx); 105 amdgpu_ctx_put(ctx);
107 fput(filp); 106 fdput(f);
108 107
109 return 0; 108 return 0;
110} 109}