Skip to content

Commit

Permalink
gpu: host1x: Use DEFINE_SHOW_ATTRIBUTE to simplify debugfs code
Browse files Browse the repository at this point in the history
Use DEFINE_SHOW_ATTRIBUTE helper macro to simplify the debugfs code for
the status and status_all entries. No functional change.

Signed-off-by: Liu Shixin <liushixin2@huawei.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
  • Loading branch information
Liu Shixin authored and Thierry Reding committed Nov 25, 2022
1 parent de383d8 commit a624bd9
Showing 1 changed file with 3 additions and 25 deletions.
28 changes: 3 additions & 25 deletions drivers/gpu/host1x/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ static void show_all(struct host1x *m, struct output *o, bool show_fifo)
}
}

static int host1x_debug_show_all(struct seq_file *s, void *unused)
static int host1x_debug_all_show(struct seq_file *s, void *unused)
{
struct output o = {
.fn = write_to_seqfile,
Expand All @@ -151,6 +151,7 @@ static int host1x_debug_show_all(struct seq_file *s, void *unused)

return 0;
}
DEFINE_SHOW_ATTRIBUTE(host1x_debug_all);

static int host1x_debug_show(struct seq_file *s, void *unused)
{
Expand All @@ -163,30 +164,7 @@ static int host1x_debug_show(struct seq_file *s, void *unused)

return 0;
}

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

static const struct file_operations host1x_debug_all_fops = {
.open = host1x_debug_open_all,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};

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

static const struct file_operations host1x_debug_fops = {
.open = host1x_debug_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
DEFINE_SHOW_ATTRIBUTE(host1x_debug);

static void host1x_debugfs_init(struct host1x *host1x)
{
Expand Down

0 comments on commit a624bd9

Please sign in to comment.