PM / sleep: convert to DEFINE_SHOW_ATTRIBUTE
Subsystems (2)
PATCH 1/1 PM / sleep: convert to DEFINE_SHOW_ATTRIBUTE
Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.
Signed-off-by Yangtao Li <[email protected]>
--- kernel/power/main.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-)
kernel/power/main.c +2 -13
@@ -318,23 +318,12 @@ static int suspend_stats_show(struct seq_file *s, void *unused)return 0 ; } - -static int suspend_stats_open (struct inode *inode,struct file *file) -{ -return single_open (file, suspend_stats_show,NULL ); -} - -static const struct file_operations suspend_stats_operations = { - .open = suspend_stats_open, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, -}; +DEFINE_SHOW_ATTRIBUTE (suspend_stats);static int __init pm_debugfs_init (void ) {debugfs_create_file ("suspend_stats" ,S_IFREG |S_IRUGO , -NULL ,NULL , &suspend_stats_operations); +NULL ,NULL , &suspend_stats_fops);return 0 ; }
Signature · 1 line
2.17.0
Quoted 3 lines · Yangtao Li
Use
DEFINE_SHOW_ATTRIBUTEmacro to simplify the code.Signed-off-by Yangtao Li <[email protected]>
Acked-by Pavel Machek <[email protected]>
Quoted 34 lines
--- kernel/power/main.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-)kernel/power/main.c +2
-13@@ -318,23 +318,12 @@ static int suspend_stats_show(struct seq_file *s, void *unused)return 0 ; } - -static int suspend_stats_open (struct inode *inode,struct file *file) -{ -return single_open (file, suspend_stats_show,NULL ); -} - -static const struct file_operations suspend_stats_operations = { - .open = suspend_stats_open, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, -}; +DEFINE_SHOW_ATTRIBUTE (suspend_stats);static int __init pm_debugfs_init (void ) {debugfs_create_file ("suspend_stats" ,S_IFREG |S_IRUGO , -NULL ,NULL , &suspend_stats_operations); +NULL ,NULL , &suspend_stats_fops);return 0 ; }
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Rafael J. Wysocki
AppliedQuoted 28 lines · CET Yangtao Li
Use
DEFINE_SHOW_ATTRIBUTEmacro to simplify the code.Signed-off-by Yangtao Li <[email protected]>--- kernel/power/main.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-)kernel/power/main.c +0
-12@@ -318,23 +318,12 @@ static int suspend_stats_show(struct seq_file *s, void *unused)return 0 ; } - -static int suspend_stats_open (struct inode *inode,struct file *file) -{ -return single_open (file, suspend_stats_show,NULL ); -} - -static const struct file_operations suspend_stats_operations = { - .open = suspend_stats_open, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, -};
kernel/power/main.c static int suspend_stats_show(struct seq_file *s, void *unused) · line 329
Quoted 10 lines
kernel/power/main.c +2
-1+DEFINE_SHOW_ATTRIBUTE (suspend_stats);static int __init pm_debugfs_init (void ) {debugfs_create_file ("suspend_stats" ,S_IFREG |S_IRUGO , -NULL ,NULL , &suspend_stats_operations); +NULL ,NULL , &suspend_stats_fops);return 0 ; }
Applied, thanks!