Skip to content

Commit

Permalink
cpufreq: s3c24xx: 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>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
Yangtao Li authored and Rafael J. Wysocki committed Nov 29, 2018
1 parent d98ccfc commit 6e218d2
Showing 1 changed file with 6 additions and 40 deletions.
46 changes: 6 additions & 40 deletions drivers/cpufreq/s3c24xx-cpufreq-debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,18 +63,7 @@ static int board_show(struct seq_file *seq, void *p)
return 0;
}

static int fops_board_open(struct inode *inode, struct file *file)
{
return single_open(file, board_show, NULL);
}

static const struct file_operations fops_board = {
.open = fops_board_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
.owner = THIS_MODULE,
};
DEFINE_SHOW_ATTRIBUTE(board);

static int info_show(struct seq_file *seq, void *p)
{
Expand Down Expand Up @@ -105,18 +94,7 @@ static int info_show(struct seq_file *seq, void *p)
return 0;
}

static int fops_info_open(struct inode *inode, struct file *file)
{
return single_open(file, info_show, NULL);
}

static const struct file_operations fops_info = {
.open = fops_info_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
.owner = THIS_MODULE,
};
DEFINE_SHOW_ATTRIBUTE(info);

static int io_show(struct seq_file *seq, void *p)
{
Expand Down Expand Up @@ -162,19 +140,7 @@ static int io_show(struct seq_file *seq, void *p)
return 0;
}

static int fops_io_open(struct inode *inode, struct file *file)
{
return single_open(file, io_show, NULL);
}

static const struct file_operations fops_io = {
.open = fops_io_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
.owner = THIS_MODULE,
};

DEFINE_SHOW_ATTRIBUTE(io);

static int __init s3c_freq_debugfs_init(void)
{
Expand All @@ -185,13 +151,13 @@ static int __init s3c_freq_debugfs_init(void)
}

dbgfs_file_io = debugfs_create_file("io-timing", S_IRUGO, dbgfs_root,
NULL, &fops_io);
NULL, &io_fops);

dbgfs_file_info = debugfs_create_file("info", S_IRUGO, dbgfs_root,
NULL, &fops_info);
NULL, &info_fops);

dbgfs_file_board = debugfs_create_file("board", S_IRUGO, dbgfs_root,
NULL, &fops_board);
NULL, &board_fops);

return 0;
}
Expand Down

0 comments on commit 6e218d2

Please sign in to comment.