Skip to content

Commit

Permalink
dma-buf: Change to use DEFINE_SHOW_ATTRIBUTE macro
Browse files Browse the repository at this point in the history
Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.

Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20181130161101.3413-1-tiny.windzz@gmail.com
  • Loading branch information
Yangtao Li authored and Daniel Vetter committed Dec 24, 2018
1 parent 70bce99 commit 2674305
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 24 deletions.
12 changes: 1 addition & 11 deletions drivers/dma-buf/dma-buf.c
Original file line number Diff line number Diff line change
Expand Up @@ -1093,17 +1093,7 @@ static int dma_buf_debug_show(struct seq_file *s, void *unused)
return 0;
}

static int dma_buf_debug_open(struct inode *inode, struct file *file)
{
return single_open(file, dma_buf_debug_show, NULL);
}

static const struct file_operations dma_buf_debug_fops = {
.open = dma_buf_debug_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
DEFINE_SHOW_ATTRIBUTE(dma_buf_debug);

static struct dentry *dma_buf_debugfs_dir;

Expand Down
16 changes: 3 additions & 13 deletions drivers/dma-buf/sync_debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ static void sync_print_sync_file(struct seq_file *s,
}
}

static int sync_debugfs_show(struct seq_file *s, void *unused)
static int sync_info_debugfs_show(struct seq_file *s, void *unused)
{
struct list_head *pos;

Expand Down Expand Up @@ -178,17 +178,7 @@ static int sync_debugfs_show(struct seq_file *s, void *unused)
return 0;
}

static int sync_info_debugfs_open(struct inode *inode, struct file *file)
{
return single_open(file, sync_debugfs_show, inode->i_private);
}

static const struct file_operations sync_info_debugfs_fops = {
.open = sync_info_debugfs_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
DEFINE_SHOW_ATTRIBUTE(sync_info_debugfs);

static __init int sync_debugfs_init(void)
{
Expand Down Expand Up @@ -218,7 +208,7 @@ void sync_dump(void)
};
int i;

sync_debugfs_show(&s, NULL);
sync_info_debugfs_show(&s, NULL);

for (i = 0; i < s.count; i += DUMP_CHUNK) {
if ((s.count - i) > DUMP_CHUNK) {
Expand Down

0 comments on commit 2674305

Please sign in to comment.