Skip to content

Commit

Permalink
block: aoe: use DEFINE_SHOW_ATTRIBUTE to simplify aoe_debugfs
Browse files Browse the repository at this point in the history
Use DEFINE_SHOW_ATTRIBUTE helper macro to simplify the code.

Signed-off-by: Liu Shixin <liushixin2@huawei.com>
Link: https://lore.kernel.org/r/20220915023424.3198940-1-liushixin2@huawei.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
Liu Shixin authored and axboe committed Sep 22, 2022
1 parent e55e1b4 commit 8ef8599
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions drivers/block/aoe/aoeblk.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ static ssize_t aoedisk_show_payload(struct device *dev,
return sysfs_emit(page, "%lu\n", d->maxbcnt);
}

static int aoedisk_debugfs_show(struct seq_file *s, void *ignored)
static int aoe_debugfs_show(struct seq_file *s, void *ignored)
{
struct aoedev *d;
struct aoetgt **t, **te;
Expand Down Expand Up @@ -151,11 +151,7 @@ static int aoedisk_debugfs_show(struct seq_file *s, void *ignored)

return 0;
}

static int aoe_debugfs_open(struct inode *inode, struct file *file)
{
return single_open(file, aoedisk_debugfs_show, inode->i_private);
}
DEFINE_SHOW_ATTRIBUTE(aoe_debugfs);

static DEVICE_ATTR(state, 0444, aoedisk_show_state, NULL);
static DEVICE_ATTR(mac, 0444, aoedisk_show_mac, NULL);
Expand Down Expand Up @@ -184,13 +180,6 @@ static const struct attribute_group *aoe_attr_groups[] = {
NULL,
};

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

static void
aoedisk_add_debugfs(struct aoedev *d)
{
Expand Down

0 comments on commit 8ef8599

Please sign in to comment.