diff options
author | David Howells <dhowells@redhat.com> | 2013-04-10 22:05:01 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2013-04-29 15:42:00 -0400 |
commit | 526c59784c09fb794a5f0181429525bc473453c9 (patch) | |
tree | 33701ac99250bc3189c622732360b91b972d9d8a /arch/arm/kernel | |
parent | f9368c18e9a99d86c509ac113363e9d295e0bf74 (diff) |
arm: Don't use create_proc_read_entry()
Don't use create_proc_read_entry() as that is deprecated, but rather use
proc_create_data() and seq_file instead.
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Russell King <linux@arm.linux.org.uk>
cc: Kevin Hilman <khilman@deeprootsystems.com>
cc: Tony Lindgren <tony@atomide.com>
cc: linux-arm-kernel@lists.infradead.org
cc: linux-omap@vger.kernel.org
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'arch/arm/kernel')
-rw-r--r-- | arch/arm/kernel/swp_emulate.c | 42 |
1 files changed, 19 insertions, 23 deletions
diff --git a/arch/arm/kernel/swp_emulate.c b/arch/arm/kernel/swp_emulate.c index 0bba47ada5bd..087fc321e9e5 100644 --- a/arch/arm/kernel/swp_emulate.c +++ b/arch/arm/kernel/swp_emulate.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/init.h> | 21 | #include <linux/init.h> |
22 | #include <linux/kernel.h> | 22 | #include <linux/kernel.h> |
23 | #include <linux/proc_fs.h> | 23 | #include <linux/proc_fs.h> |
24 | #include <linux/seq_file.h> | ||
24 | #include <linux/sched.h> | 25 | #include <linux/sched.h> |
25 | #include <linux/syscalls.h> | 26 | #include <linux/syscalls.h> |
26 | #include <linux/perf_event.h> | 27 | #include <linux/perf_event.h> |
@@ -79,27 +80,27 @@ static unsigned long abtcounter; | |||
79 | static pid_t previous_pid; | 80 | static pid_t previous_pid; |
80 | 81 | ||
81 | #ifdef CONFIG_PROC_FS | 82 | #ifdef CONFIG_PROC_FS |
82 | static int proc_read_status(char *page, char **start, off_t off, int count, | 83 | static int proc_status_show(struct seq_file *m, void *v) |
83 | int *eof, void *data) | ||
84 | { | 84 | { |
85 | char *p = page; | 85 | seq_printf(m, "Emulated SWP:\t\t%lu\n", swpcounter); |
86 | int len; | 86 | seq_printf(m, "Emulated SWPB:\t\t%lu\n", swpbcounter); |
87 | 87 | seq_printf(m, "Aborted SWP{B}:\t\t%lu\n", abtcounter); | |
88 | p += sprintf(p, "Emulated SWP:\t\t%lu\n", swpcounter); | ||
89 | p += sprintf(p, "Emulated SWPB:\t\t%lu\n", swpbcounter); | ||
90 | p += sprintf(p, "Aborted SWP{B}:\t\t%lu\n", abtcounter); | ||
91 | if (previous_pid != 0) | 88 | if (previous_pid != 0) |
92 | p += sprintf(p, "Last process:\t\t%d\n", previous_pid); | 89 | seq_printf(m, "Last process:\t\t%d\n", previous_pid); |
93 | 90 | return 0; | |
94 | len = (p - page) - off; | 91 | } |
95 | if (len < 0) | ||
96 | len = 0; | ||
97 | |||
98 | *eof = (len <= count) ? 1 : 0; | ||
99 | *start = page + off; | ||
100 | 92 | ||
101 | return len; | 93 | static int proc_status_open(struct inode *inode, struct file *file) |
94 | { | ||
95 | return single_open(file, proc_status_show, PDE_DATA(inode)); | ||
102 | } | 96 | } |
97 | |||
98 | static const struct file_operations proc_status_fops = { | ||
99 | .open = proc_status_open, | ||
100 | .read = seq_read, | ||
101 | .llseek = seq_lseek, | ||
102 | .release = seq_release, | ||
103 | }; | ||
103 | #endif | 104 | #endif |
104 | 105 | ||
105 | /* | 106 | /* |
@@ -266,12 +267,7 @@ static struct undef_hook swp_hook = { | |||
266 | static int __init swp_emulation_init(void) | 267 | static int __init swp_emulation_init(void) |
267 | { | 268 | { |
268 | #ifdef CONFIG_PROC_FS | 269 | #ifdef CONFIG_PROC_FS |
269 | struct proc_dir_entry *res; | 270 | if (!proc_create("cpu/swp_emulation", S_IRUGO, NULL, &proc_status_fops)) |
270 | |||
271 | res = create_proc_read_entry("cpu/swp_emulation", S_IRUGO, NULL, | ||
272 | proc_read_status, NULL); | ||
273 | |||
274 | if (!res) | ||
275 | return -ENOMEM; | 271 | return -ENOMEM; |
276 | #endif /* CONFIG_PROC_FS */ | 272 | #endif /* CONFIG_PROC_FS */ |
277 | 273 | ||