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>
This commit is contained in:
parent
f9368c18e9
commit
526c59784c
1 changed files with 20 additions and 24 deletions
|
@ -21,6 +21,7 @@
|
||||||
#include <linux/init.h>
|
#include <linux/init.h>
|
||||||
#include <linux/kernel.h>
|
#include <linux/kernel.h>
|
||||||
#include <linux/proc_fs.h>
|
#include <linux/proc_fs.h>
|
||||||
|
#include <linux/seq_file.h>
|
||||||
#include <linux/sched.h>
|
#include <linux/sched.h>
|
||||||
#include <linux/syscalls.h>
|
#include <linux/syscalls.h>
|
||||||
#include <linux/perf_event.h>
|
#include <linux/perf_event.h>
|
||||||
|
@ -79,27 +80,27 @@ static unsigned long abtcounter;
|
||||||
static pid_t previous_pid;
|
static pid_t previous_pid;
|
||||||
|
|
||||||
#ifdef CONFIG_PROC_FS
|
#ifdef CONFIG_PROC_FS
|
||||||
static int proc_read_status(char *page, char **start, off_t off, int count,
|
static int proc_status_show(struct seq_file *m, void *v)
|
||||||
int *eof, void *data)
|
|
||||||
{
|
{
|
||||||
char *p = page;
|
seq_printf(m, "Emulated SWP:\t\t%lu\n", swpcounter);
|
||||||
int len;
|
seq_printf(m, "Emulated SWPB:\t\t%lu\n", swpbcounter);
|
||||||
|
seq_printf(m, "Aborted SWP{B}:\t\t%lu\n", abtcounter);
|
||||||
p += sprintf(p, "Emulated SWP:\t\t%lu\n", swpcounter);
|
|
||||||
p += sprintf(p, "Emulated SWPB:\t\t%lu\n", swpbcounter);
|
|
||||||
p += sprintf(p, "Aborted SWP{B}:\t\t%lu\n", abtcounter);
|
|
||||||
if (previous_pid != 0)
|
if (previous_pid != 0)
|
||||||
p += sprintf(p, "Last process:\t\t%d\n", previous_pid);
|
seq_printf(m, "Last process:\t\t%d\n", previous_pid);
|
||||||
|
return 0;
|
||||||
len = (p - page) - off;
|
|
||||||
if (len < 0)
|
|
||||||
len = 0;
|
|
||||||
|
|
||||||
*eof = (len <= count) ? 1 : 0;
|
|
||||||
*start = page + off;
|
|
||||||
|
|
||||||
return len;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int proc_status_open(struct inode *inode, struct file *file)
|
||||||
|
{
|
||||||
|
return single_open(file, proc_status_show, PDE_DATA(inode));
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct file_operations proc_status_fops = {
|
||||||
|
.open = proc_status_open,
|
||||||
|
.read = seq_read,
|
||||||
|
.llseek = seq_lseek,
|
||||||
|
.release = seq_release,
|
||||||
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -266,12 +267,7 @@ static struct undef_hook swp_hook = {
|
||||||
static int __init swp_emulation_init(void)
|
static int __init swp_emulation_init(void)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_PROC_FS
|
#ifdef CONFIG_PROC_FS
|
||||||
struct proc_dir_entry *res;
|
if (!proc_create("cpu/swp_emulation", S_IRUGO, NULL, &proc_status_fops))
|
||||||
|
|
||||||
res = create_proc_read_entry("cpu/swp_emulation", S_IRUGO, NULL,
|
|
||||||
proc_read_status, NULL);
|
|
||||||
|
|
||||||
if (!res)
|
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
#endif /* CONFIG_PROC_FS */
|
#endif /* CONFIG_PROC_FS */
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue