Skip to content

Commit 943a10f

Browse files
TinyWindzzrafaeljw
authored andcommitted
PM / sleep: convert to DEFINE_SHOW_ATTRIBUTE
Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code. Signed-off-by: Yangtao Li <tiny.windzz@gmail.com> Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 40e020c commit 943a10f

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

kernel/power/main.c

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -318,23 +318,12 @@ static int suspend_stats_show(struct seq_file *s, void *unused)
318318

319319
return 0;
320320
}
321-
322-
static int suspend_stats_open(struct inode *inode, struct file *file)
323-
{
324-
return single_open(file, suspend_stats_show, NULL);
325-
}
326-
327-
static const struct file_operations suspend_stats_operations = {
328-
.open = suspend_stats_open,
329-
.read = seq_read,
330-
.llseek = seq_lseek,
331-
.release = single_release,
332-
};
321+
DEFINE_SHOW_ATTRIBUTE(suspend_stats);
333322

334323
static int __init pm_debugfs_init(void)
335324
{
336325
debugfs_create_file("suspend_stats", S_IFREG | S_IRUGO,
337-
NULL, NULL, &suspend_stats_operations);
326+
NULL, NULL, &suspend_stats_fops);
338327
return 0;
339328
}
340329

0 commit comments

Comments
 (0)