Merge branch 'work.file' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull vfs 'struct file' related updates from Al Viro: "A bit more of 'this fget() would be better off as fdget()' whack-a-mole + a couple of ->f_count-related cleanups" * 'work.file' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: media: switch to fdget() drm_syncobj: switch to fdget() amdgpu: switch to fdget() don't open-code file_count() fs: drop unused fput_atomic definition
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user