cpufreq: s3c24xx: Change to use DEFINE_SHOW_ATTRIBUTE macro
Subsystems (2)
PATCH 1/1 cpufreq: s3c24xx: Change to use DEFINE_SHOW_ATTRIBUTE macro
Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.
Signed-off-by Yangtao Li <[email protected]>
--- drivers/cpufreq/s3c24xx-cpufreq-debugfs.c | 46 +++-------------------- 1 file changed, 6 insertions(+), 40 deletions(-)
drivers/cpufreq/s3c24xx-cpufreq-debugfs.c +6 -40
@@ -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) {
@@ -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) {
@@ -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 ) {
@@ -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 ; }
Signature · 1 line
2.17.0
Quoted 79 lines · Yangtao Li
Use
DEFINE_SHOW_ATTRIBUTEmacro to simplify the code.Signed-off-by Yangtao Li <[email protected]>--- drivers/cpufreq/s3c24xx-cpufreq-debugfs.c | 46 +++-------------------- 1 file changed, 6 insertions(+), 40 deletions(-)drivers/cpufreq/s3c24xx-cpufreq-debugfs.c +4
-38@@ -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) {@@ -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) {@@ -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 ) {@@ -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);
drivers/cpufreq/s3c24xx-cpufreq-debugfs.c static int __init s3c_freq_debugfs_init(void) · line 163
Quoted 10 lines
drivers/cpufreq/s3c24xx-cpufreq-debugfs.c +2
-2dbgfs_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 ; }
Acked-by Viresh Kumar <[email protected]>
Signature · 1 line
viresh
Quoted 84 lines · CET Viresh Kumar
Quoted 83 lines · Yangtao Li
Use
DEFINE_SHOW_ATTRIBUTEmacro to simplify the code.Signed-off-by Yangtao Li <[email protected]>--- drivers/cpufreq/s3c24xx-cpufreq-debugfs.c | 46 +++-------------------- 1 file changed, 6 insertions(+), 40 deletions(-)drivers/cpufreq/s3c24xx-cpufreq-debugfs.c +5
-39@@ -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) {@@ -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) {@@ -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 ) {@@ -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);
Quoted 8 lines
drivers/cpufreq/s3c24xx-cpufreq-debugfs.c static int __init s3c_freq_debugfs_init(void) · line 163
Quoted 6 lines
drivers/cpufreq/s3c24xx-cpufreq-debugfs.c +1
-1dbgfs_file_board =debugfs_create_file ("board" ,S_IRUGO , dbgfs_root, -NULL , &fops_board); +NULL , &board_fops);return 0 ; }Acked-by Viresh Kumar <[email protected]>
Patch applied, thanks!