diff options
author | Christoph Hellwig <hch@lst.de> | 2018-04-13 13:44:18 -0400 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2018-05-16 01:23:35 -0400 |
commit | fddda2b7b521185f3aa018f9559eb33b0aee53a9 (patch) | |
tree | ece18b3d82822f8eaefd8b0afa2f93307e83b253 /kernel/sched | |
parent | 7aed53d1dfd14d468e065212ce45068e2b50c1fa (diff) |
proc: introduce proc_create_seq{,_data}
Variants of proc_create{,_data} that directly take a struct seq_operations
argument and drastically reduces the boilerplate code in the callers.
All trivial callers converted over.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'kernel/sched')
-rw-r--r-- | kernel/sched/debug.c | 28 | ||||
-rw-r--r-- | kernel/sched/stats.c | 15 |
2 files changed, 2 insertions, 41 deletions
diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c index 15b10e210a6b..e593b4118578 100644 --- a/kernel/sched/debug.c +++ b/kernel/sched/debug.c | |||
@@ -823,35 +823,9 @@ static const struct seq_operations sched_debug_sops = { | |||
823 | .show = sched_debug_show, | 823 | .show = sched_debug_show, |
824 | }; | 824 | }; |
825 | 825 | ||
826 | static int sched_debug_release(struct inode *inode, struct file *file) | ||
827 | { | ||
828 | seq_release(inode, file); | ||
829 | |||
830 | return 0; | ||
831 | } | ||
832 | |||
833 | static int sched_debug_open(struct inode *inode, struct file *filp) | ||
834 | { | ||
835 | int ret = 0; | ||
836 | |||
837 | ret = seq_open(filp, &sched_debug_sops); | ||
838 | |||
839 | return ret; | ||
840 | } | ||
841 | |||
842 | static const struct file_operations sched_debug_fops = { | ||
843 | .open = sched_debug_open, | ||
844 | .read = seq_read, | ||
845 | .llseek = seq_lseek, | ||
846 | .release = sched_debug_release, | ||
847 | }; | ||
848 | |||
849 | static int __init init_sched_debug_procfs(void) | 826 | static int __init init_sched_debug_procfs(void) |
850 | { | 827 | { |
851 | struct proc_dir_entry *pe; | 828 | if (!proc_create_seq("sched_debug", 0444, NULL, &sched_debug_sops)) |
852 | |||
853 | pe = proc_create("sched_debug", 0444, NULL, &sched_debug_fops); | ||
854 | if (!pe) | ||
855 | return -ENOMEM; | 829 | return -ENOMEM; |
856 | return 0; | 830 | return 0; |
857 | } | 831 | } |
diff --git a/kernel/sched/stats.c b/kernel/sched/stats.c index ab112cbfd7c8..750fb3c67eed 100644 --- a/kernel/sched/stats.c +++ b/kernel/sched/stats.c | |||
@@ -120,22 +120,9 @@ static const struct seq_operations schedstat_sops = { | |||
120 | .show = show_schedstat, | 120 | .show = show_schedstat, |
121 | }; | 121 | }; |
122 | 122 | ||
123 | static int schedstat_open(struct inode *inode, struct file *file) | ||
124 | { | ||
125 | return seq_open(file, &schedstat_sops); | ||
126 | } | ||
127 | |||
128 | static const struct file_operations proc_schedstat_operations = { | ||
129 | .open = schedstat_open, | ||
130 | .read = seq_read, | ||
131 | .llseek = seq_lseek, | ||
132 | .release = seq_release, | ||
133 | }; | ||
134 | |||
135 | static int __init proc_schedstat_init(void) | 123 | static int __init proc_schedstat_init(void) |
136 | { | 124 | { |
137 | proc_create("schedstat", 0, NULL, &proc_schedstat_operations); | 125 | proc_create_seq("schedstat", 0, NULL, &schedstat_sops); |
138 | |||
139 | return 0; | 126 | return 0; |
140 | } | 127 | } |
141 | subsys_initcall(proc_schedstat_init); | 128 | subsys_initcall(proc_schedstat_init); |