Skip to content

Commit

Permalink
sync_file: get rid of internal reference count.
Browse files Browse the repository at this point in the history
sync_file uses the reference count of the file, the internal
kref was never getting moved past 1.

We can reintroduce this if we decide we need it later.

[airlied: fix buildbot warnings]

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Acked-by: Sumit Semwal <sumit.semwal@linaro.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170413014144.637-2-airlied@gmail.com
  • Loading branch information
Dave Airlie authored and Gustavo Padovan committed Apr 18, 2017
1 parent 2e38178 commit d8f2eba
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
13 changes: 2 additions & 11 deletions drivers/dma-buf/sync_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ static struct sync_file *sync_file_alloc(void)
if (IS_ERR(sync_file->file))
goto err;

kref_init(&sync_file->kref);

init_waitqueue_head(&sync_file->wq);

INIT_LIST_HEAD(&sync_file->cb.node);
Expand Down Expand Up @@ -277,22 +275,15 @@ static struct sync_file *sync_file_merge(const char *name, struct sync_file *a,

}

static void sync_file_free(struct kref *kref)
static int sync_file_release(struct inode *inode, struct file *file)
{
struct sync_file *sync_file = container_of(kref, struct sync_file,
kref);
struct sync_file *sync_file = file->private_data;

if (test_bit(POLL_ENABLED, &sync_file->fence->flags))
dma_fence_remove_callback(sync_file->fence, &sync_file->cb);
dma_fence_put(sync_file->fence);
kfree(sync_file);
}

static int sync_file_release(struct inode *inode, struct file *file)
{
struct sync_file *sync_file = file->private_data;

kref_put(&sync_file->kref, sync_file_free);
return 0;
}

Expand Down
3 changes: 0 additions & 3 deletions include/linux/sync_file.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#define _LINUX_SYNC_FILE_H

#include <linux/types.h>
#include <linux/kref.h>
#include <linux/ktime.h>
#include <linux/list.h>
#include <linux/spinlock.h>
Expand All @@ -24,7 +23,6 @@
/**
* struct sync_file - sync file to export to the userspace
* @file: file representing this fence
* @kref: reference count on fence.
* @name: name of sync_file. Useful for debugging
* @sync_file_list: membership in global file list
* @wq: wait queue for fence signaling
Expand All @@ -33,7 +31,6 @@
*/
struct sync_file {
struct file *file;
struct kref kref;
char name[32];
#ifdef CONFIG_DEBUG_FS
struct list_head sync_file_list;
Expand Down

0 comments on commit d8f2eba

Please sign in to comment.