Skip to content

Commit

Permalink
PM / sleep: convert to DEFINE_SHOW_ATTRIBUTE
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: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
Yangtao Li authored and Rafael J. Wysocki committed Dec 12, 2018
1 parent 40e020c commit 943a10f
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions kernel/power/main.c
Original file line number Diff line number Diff line change
@@ -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;
}

0 comments on commit 943a10f

Please sign in to comment.