Skip to content

Commit 6e218d2

Browse files
TinyWindzzrafaeljw
authored andcommitted
cpufreq: s3c24xx: Change to use DEFINE_SHOW_ATTRIBUTE macro
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>
1 parent d98ccfc commit 6e218d2

File tree

1 file changed

+6
-40
lines changed

1 file changed

+6
-40
lines changed

drivers/cpufreq/s3c24xx-cpufreq-debugfs.c

Lines changed: 6 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -63,18 +63,7 @@ static int board_show(struct seq_file *seq, void *p)
6363
return 0;
6464
}
6565

66-
static int fops_board_open(struct inode *inode, struct file *file)
67-
{
68-
return single_open(file, board_show, NULL);
69-
}
70-
71-
static const struct file_operations fops_board = {
72-
.open = fops_board_open,
73-
.read = seq_read,
74-
.llseek = seq_lseek,
75-
.release = single_release,
76-
.owner = THIS_MODULE,
77-
};
66+
DEFINE_SHOW_ATTRIBUTE(board);
7867

7968
static int info_show(struct seq_file *seq, void *p)
8069
{
@@ -105,18 +94,7 @@ static int info_show(struct seq_file *seq, void *p)
10594
return 0;
10695
}
10796

108-
static int fops_info_open(struct inode *inode, struct file *file)
109-
{
110-
return single_open(file, info_show, NULL);
111-
}
112-
113-
static const struct file_operations fops_info = {
114-
.open = fops_info_open,
115-
.read = seq_read,
116-
.llseek = seq_lseek,
117-
.release = single_release,
118-
.owner = THIS_MODULE,
119-
};
97+
DEFINE_SHOW_ATTRIBUTE(info);
12098

12199
static int io_show(struct seq_file *seq, void *p)
122100
{
@@ -162,19 +140,7 @@ static int io_show(struct seq_file *seq, void *p)
162140
return 0;
163141
}
164142

165-
static int fops_io_open(struct inode *inode, struct file *file)
166-
{
167-
return single_open(file, io_show, NULL);
168-
}
169-
170-
static const struct file_operations fops_io = {
171-
.open = fops_io_open,
172-
.read = seq_read,
173-
.llseek = seq_lseek,
174-
.release = single_release,
175-
.owner = THIS_MODULE,
176-
};
177-
143+
DEFINE_SHOW_ATTRIBUTE(io);
178144

179145
static int __init s3c_freq_debugfs_init(void)
180146
{
@@ -185,13 +151,13 @@ static int __init s3c_freq_debugfs_init(void)
185151
}
186152

187153
dbgfs_file_io = debugfs_create_file("io-timing", S_IRUGO, dbgfs_root,
188-
NULL, &fops_io);
154+
NULL, &io_fops);
189155

190156
dbgfs_file_info = debugfs_create_file("info", S_IRUGO, dbgfs_root,
191-
NULL, &fops_info);
157+
NULL, &info_fops);
192158

193159
dbgfs_file_board = debugfs_create_file("board", S_IRUGO, dbgfs_root,
194-
NULL, &fops_board);
160+
NULL, &board_fops);
195161

196162
return 0;
197163
}

0 commit comments

Comments
 (0)