diff options
Diffstat (limited to 'arch/arm/mm/alignment.c')
-rw-r--r-- | arch/arm/mm/alignment.c | 53 |
1 files changed, 26 insertions, 27 deletions
diff --git a/arch/arm/mm/alignment.c b/arch/arm/mm/alignment.c index edddd66faac6..28b7c2776198 100644 --- a/arch/arm/mm/alignment.c +++ b/arch/arm/mm/alignment.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/errno.h> | 17 | #include <linux/errno.h> |
18 | #include <linux/string.h> | 18 | #include <linux/string.h> |
19 | #include <linux/proc_fs.h> | 19 | #include <linux/proc_fs.h> |
20 | #include <linux/seq_file.h> | ||
20 | #include <linux/init.h> | 21 | #include <linux/init.h> |
21 | #include <linux/sched.h> | 22 | #include <linux/sched.h> |
22 | #include <linux/uaccess.h> | 23 | #include <linux/uaccess.h> |
@@ -94,36 +95,29 @@ static const char *usermode_action[] = { | |||
94 | "signal+warn" | 95 | "signal+warn" |
95 | }; | 96 | }; |
96 | 97 | ||
97 | static int | 98 | static int alignment_proc_show(struct seq_file *m, void *v) |
98 | proc_alignment_read(char *page, char **start, off_t off, int count, int *eof, | ||
99 | void *data) | ||
100 | { | 99 | { |
101 | char *p = page; | 100 | seq_printf(m, "User:\t\t%lu\n", ai_user); |
102 | int len; | 101 | seq_printf(m, "System:\t\t%lu\n", ai_sys); |
103 | 102 | seq_printf(m, "Skipped:\t%lu\n", ai_skipped); | |
104 | p += sprintf(p, "User:\t\t%lu\n", ai_user); | 103 | seq_printf(m, "Half:\t\t%lu\n", ai_half); |
105 | p += sprintf(p, "System:\t\t%lu\n", ai_sys); | 104 | seq_printf(m, "Word:\t\t%lu\n", ai_word); |
106 | p += sprintf(p, "Skipped:\t%lu\n", ai_skipped); | ||
107 | p += sprintf(p, "Half:\t\t%lu\n", ai_half); | ||
108 | p += sprintf(p, "Word:\t\t%lu\n", ai_word); | ||
109 | if (cpu_architecture() >= CPU_ARCH_ARMv5TE) | 105 | if (cpu_architecture() >= CPU_ARCH_ARMv5TE) |
110 | p += sprintf(p, "DWord:\t\t%lu\n", ai_dword); | 106 | seq_printf(m, "DWord:\t\t%lu\n", ai_dword); |
111 | p += sprintf(p, "Multi:\t\t%lu\n", ai_multi); | 107 | seq_printf(m, "Multi:\t\t%lu\n", ai_multi); |
112 | p += sprintf(p, "User faults:\t%i (%s)\n", ai_usermode, | 108 | seq_printf(m, "User faults:\t%i (%s)\n", ai_usermode, |
113 | usermode_action[ai_usermode]); | 109 | usermode_action[ai_usermode]); |
114 | 110 | ||
115 | len = (p - page) - off; | 111 | return 0; |
116 | if (len < 0) | 112 | } |
117 | len = 0; | ||
118 | |||
119 | *eof = (len <= count) ? 1 : 0; | ||
120 | *start = page + off; | ||
121 | 113 | ||
122 | return len; | 114 | static int alignment_proc_open(struct inode *inode, struct file *file) |
115 | { | ||
116 | return single_open(file, alignment_proc_show, NULL); | ||
123 | } | 117 | } |
124 | 118 | ||
125 | static int proc_alignment_write(struct file *file, const char __user *buffer, | 119 | static ssize_t alignment_proc_write(struct file *file, const char __user *buffer, |
126 | unsigned long count, void *data) | 120 | size_t count, loff_t *pos) |
127 | { | 121 | { |
128 | char mode; | 122 | char mode; |
129 | 123 | ||
@@ -136,6 +130,13 @@ static int proc_alignment_write(struct file *file, const char __user *buffer, | |||
136 | return count; | 130 | return count; |
137 | } | 131 | } |
138 | 132 | ||
133 | static const struct file_operations alignment_proc_fops = { | ||
134 | .open = alignment_proc_open, | ||
135 | .read = seq_read, | ||
136 | .llseek = seq_lseek, | ||
137 | .release = single_release, | ||
138 | .write = alignment_proc_write, | ||
139 | }; | ||
139 | #endif /* CONFIG_PROC_FS */ | 140 | #endif /* CONFIG_PROC_FS */ |
140 | 141 | ||
141 | union offset_union { | 142 | union offset_union { |
@@ -901,12 +902,10 @@ static int __init alignment_init(void) | |||
901 | #ifdef CONFIG_PROC_FS | 902 | #ifdef CONFIG_PROC_FS |
902 | struct proc_dir_entry *res; | 903 | struct proc_dir_entry *res; |
903 | 904 | ||
904 | res = create_proc_entry("cpu/alignment", S_IWUSR | S_IRUGO, NULL); | 905 | res = proc_create("cpu/alignment", S_IWUSR | S_IRUGO, NULL, |
906 | &alignment_proc_fops); | ||
905 | if (!res) | 907 | if (!res) |
906 | return -ENOMEM; | 908 | return -ENOMEM; |
907 | |||
908 | res->read_proc = proc_alignment_read; | ||
909 | res->write_proc = proc_alignment_write; | ||
910 | #endif | 909 | #endif |
911 | 910 | ||
912 | /* | 911 | /* |