mirror of
https://github.com/edk2-porting/linux-next.git
synced 2025-01-11 07:04:04 +08:00
amdgpu: switch to fdget()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
79ea35bc20
commit
95ce0bce20
@ -53,26 +53,25 @@ static int amdgpu_sched_process_priority_override(struct amdgpu_device *adev,
|
||||
int fd,
|
||||
enum drm_sched_priority priority)
|
||||
{
|
||||
struct file *filp = fget(fd);
|
||||
struct fd f = fdget(fd);
|
||||
struct amdgpu_fpriv *fpriv;
|
||||
struct amdgpu_ctx *ctx;
|
||||
uint32_t id;
|
||||
int r;
|
||||
|
||||
if (!filp)
|
||||
if (!f.file)
|
||||
return -EINVAL;
|
||||
|
||||
r = amdgpu_file_to_fpriv(filp, &fpriv);
|
||||
r = amdgpu_file_to_fpriv(f.file, &fpriv);
|
||||
if (r) {
|
||||
fput(filp);
|
||||
fdput(f);
|
||||
return r;
|
||||
}
|
||||
|
||||
idr_for_each_entry(&fpriv->ctx_mgr.ctx_handles, ctx, id)
|
||||
amdgpu_ctx_priority_override(ctx, priority);
|
||||
|
||||
fput(filp);
|
||||
|
||||
fdput(f);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -81,30 +80,30 @@ static int amdgpu_sched_context_priority_override(struct amdgpu_device *adev,
|
||||
unsigned ctx_id,
|
||||
enum drm_sched_priority priority)
|
||||
{
|
||||
struct file *filp = fget(fd);
|
||||
struct fd f = fdget(fd);
|
||||
struct amdgpu_fpriv *fpriv;
|
||||
struct amdgpu_ctx *ctx;
|
||||
int r;
|
||||
|
||||
if (!filp)
|
||||
if (!f.file)
|
||||
return -EINVAL;
|
||||
|
||||
r = amdgpu_file_to_fpriv(filp, &fpriv);
|
||||
r = amdgpu_file_to_fpriv(f.file, &fpriv);
|
||||
if (r) {
|
||||
fput(filp);
|
||||
fdput(f);
|
||||
return r;
|
||||
}
|
||||
|
||||
ctx = amdgpu_ctx_get(fpriv, ctx_id);
|
||||
|
||||
if (!ctx) {
|
||||
fput(filp);
|
||||
fdput(f);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
amdgpu_ctx_priority_override(ctx, priority);
|
||||
amdgpu_ctx_put(ctx);
|
||||
fput(filp);
|
||||
fdput(f);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user