aboutsummaryrefslogtreecommitdiffstats
path: root/arch/frv/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'arch/frv/kernel')
-rw-r--r--arch/frv/kernel/irq.c5
-rw-r--r--arch/frv/kernel/pm.c114
-rw-r--r--arch/frv/kernel/process.c5
-rw-r--r--arch/frv/kernel/setup.c2
-rw-r--r--arch/frv/kernel/sys_frv.c155
-rw-r--r--arch/frv/kernel/sysctl.c8
6 files changed, 14 insertions, 275 deletions
diff --git a/arch/frv/kernel/irq.c b/arch/frv/kernel/irq.c
index af3e824b91b3..625136625a7f 100644
--- a/arch/frv/kernel/irq.c
+++ b/arch/frv/kernel/irq.c
@@ -16,7 +16,6 @@
16#include <linux/ioport.h> 16#include <linux/ioport.h>
17#include <linux/interrupt.h> 17#include <linux/interrupt.h>
18#include <linux/timex.h> 18#include <linux/timex.h>
19#include <linux/slab.h>
20#include <linux/random.h> 19#include <linux/random.h>
21#include <linux/init.h> 20#include <linux/init.h>
22#include <linux/kernel_stat.h> 21#include <linux/kernel_stat.h>
@@ -69,7 +68,7 @@ int show_interrupts(struct seq_file *p, void *v)
69 } 68 }
70 69
71 if (i < NR_IRQS) { 70 if (i < NR_IRQS) {
72 spin_lock_irqsave(&irq_desc[i].lock, flags); 71 raw_spin_lock_irqsave(&irq_desc[i].lock, flags);
73 action = irq_desc[i].action; 72 action = irq_desc[i].action;
74 if (action) { 73 if (action) {
75 seq_printf(p, "%3d: ", i); 74 seq_printf(p, "%3d: ", i);
@@ -85,7 +84,7 @@ int show_interrupts(struct seq_file *p, void *v)
85 seq_putc(p, '\n'); 84 seq_putc(p, '\n');
86 } 85 }
87 86
88 spin_unlock_irqrestore(&irq_desc[i].lock, flags); 87 raw_spin_unlock_irqrestore(&irq_desc[i].lock, flags);
89 } else if (i == NR_IRQS) { 88 } else if (i == NR_IRQS) {
90 seq_printf(p, "Err: %10u\n", atomic_read(&irq_err_count)); 89 seq_printf(p, "Err: %10u\n", atomic_read(&irq_err_count));
91 } 90 }
diff --git a/arch/frv/kernel/pm.c b/arch/frv/kernel/pm.c
index 0d4d3e3a4cfc..5fa3889d858b 100644
--- a/arch/frv/kernel/pm.c
+++ b/arch/frv/kernel/pm.c
@@ -211,37 +211,6 @@ static int cmode_procctl(ctl_table *ctl, int write,
211 return try_set_cmode(new_cmode)?:*lenp; 211 return try_set_cmode(new_cmode)?:*lenp;
212} 212}
213 213
214static int cmode_sysctl(ctl_table *table,
215 void __user *oldval, size_t __user *oldlenp,
216 void __user *newval, size_t newlen)
217{
218 if (oldval && oldlenp) {
219 size_t oldlen;
220
221 if (get_user(oldlen, oldlenp))
222 return -EFAULT;
223
224 if (oldlen != sizeof(int))
225 return -EINVAL;
226
227 if (put_user(clock_cmode_current, (unsigned __user *)oldval) ||
228 put_user(sizeof(int), oldlenp))
229 return -EFAULT;
230 }
231 if (newval && newlen) {
232 int new_cmode;
233
234 if (newlen != sizeof(int))
235 return -EINVAL;
236
237 if (get_user(new_cmode, (int __user *)newval))
238 return -EFAULT;
239
240 return try_set_cmode(new_cmode)?:1;
241 }
242 return 1;
243}
244
245static int try_set_p0(int new_p0) 214static int try_set_p0(int new_p0)
246{ 215{
247 unsigned long flags, clkc; 216 unsigned long flags, clkc;
@@ -314,37 +283,6 @@ static int p0_procctl(ctl_table *ctl, int write,
314 return try_set_p0(new_p0)?:*lenp; 283 return try_set_p0(new_p0)?:*lenp;
315} 284}
316 285
317static int p0_sysctl(ctl_table *table,
318 void __user *oldval, size_t __user *oldlenp,
319 void __user *newval, size_t newlen)
320{
321 if (oldval && oldlenp) {
322 size_t oldlen;
323
324 if (get_user(oldlen, oldlenp))
325 return -EFAULT;
326
327 if (oldlen != sizeof(int))
328 return -EINVAL;
329
330 if (put_user(clock_p0_current, (unsigned __user *)oldval) ||
331 put_user(sizeof(int), oldlenp))
332 return -EFAULT;
333 }
334 if (newval && newlen) {
335 int new_p0;
336
337 if (newlen != sizeof(int))
338 return -EINVAL;
339
340 if (get_user(new_p0, (int __user *)newval))
341 return -EFAULT;
342
343 return try_set_p0(new_p0)?:1;
344 }
345 return 1;
346}
347
348static int cm_procctl(ctl_table *ctl, int write, 286static int cm_procctl(ctl_table *ctl, int write,
349 void __user *buffer, size_t *lenp, loff_t *fpos) 287 void __user *buffer, size_t *lenp, loff_t *fpos)
350{ 288{
@@ -358,87 +296,47 @@ static int cm_procctl(ctl_table *ctl, int write,
358 return try_set_cm(new_cm)?:*lenp; 296 return try_set_cm(new_cm)?:*lenp;
359} 297}
360 298
361static int cm_sysctl(ctl_table *table,
362 void __user *oldval, size_t __user *oldlenp,
363 void __user *newval, size_t newlen)
364{
365 if (oldval && oldlenp) {
366 size_t oldlen;
367
368 if (get_user(oldlen, oldlenp))
369 return -EFAULT;
370
371 if (oldlen != sizeof(int))
372 return -EINVAL;
373
374 if (put_user(clock_cm_current, (unsigned __user *)oldval) ||
375 put_user(sizeof(int), oldlenp))
376 return -EFAULT;
377 }
378 if (newval && newlen) {
379 int new_cm;
380
381 if (newlen != sizeof(int))
382 return -EINVAL;
383
384 if (get_user(new_cm, (int __user *)newval))
385 return -EFAULT;
386
387 return try_set_cm(new_cm)?:1;
388 }
389 return 1;
390}
391
392
393static struct ctl_table pm_table[] = 299static struct ctl_table pm_table[] =
394{ 300{
395 { 301 {
396 .ctl_name = CTL_PM_SUSPEND,
397 .procname = "suspend", 302 .procname = "suspend",
398 .data = NULL, 303 .data = NULL,
399 .maxlen = 0, 304 .maxlen = 0,
400 .mode = 0200, 305 .mode = 0200,
401 .proc_handler = &sysctl_pm_do_suspend, 306 .proc_handler = sysctl_pm_do_suspend,
402 }, 307 },
403 { 308 {
404 .ctl_name = CTL_PM_CMODE,
405 .procname = "cmode", 309 .procname = "cmode",
406 .data = &clock_cmode_current, 310 .data = &clock_cmode_current,
407 .maxlen = sizeof(int), 311 .maxlen = sizeof(int),
408 .mode = 0644, 312 .mode = 0644,
409 .proc_handler = &cmode_procctl, 313 .proc_handler = cmode_procctl,
410 .strategy = &cmode_sysctl,
411 }, 314 },
412 { 315 {
413 .ctl_name = CTL_PM_P0,
414 .procname = "p0", 316 .procname = "p0",
415 .data = &clock_p0_current, 317 .data = &clock_p0_current,
416 .maxlen = sizeof(int), 318 .maxlen = sizeof(int),
417 .mode = 0644, 319 .mode = 0644,
418 .proc_handler = &p0_procctl, 320 .proc_handler = p0_procctl,
419 .strategy = &p0_sysctl,
420 }, 321 },
421 { 322 {
422 .ctl_name = CTL_PM_CM,
423 .procname = "cm", 323 .procname = "cm",
424 .data = &clock_cm_current, 324 .data = &clock_cm_current,
425 .maxlen = sizeof(int), 325 .maxlen = sizeof(int),
426 .mode = 0644, 326 .mode = 0644,
427 .proc_handler = &cm_procctl, 327 .proc_handler = cm_procctl,
428 .strategy = &cm_sysctl,
429 }, 328 },
430 { .ctl_name = 0} 329 { }
431}; 330};
432 331
433static struct ctl_table pm_dir_table[] = 332static struct ctl_table pm_dir_table[] =
434{ 333{
435 { 334 {
436 .ctl_name = CTL_PM,
437 .procname = "pm", 335 .procname = "pm",
438 .mode = 0555, 336 .mode = 0555,
439 .child = pm_table, 337 .child = pm_table,
440 }, 338 },
441 { .ctl_name = 0} 339 { }
442}; 340};
443 341
444/* 342/*
diff --git a/arch/frv/kernel/process.c b/arch/frv/kernel/process.c
index 904255938216..21d0fd19276d 100644
--- a/arch/frv/kernel/process.c
+++ b/arch/frv/kernel/process.c
@@ -255,15 +255,12 @@ asmlinkage int sys_execve(char __user *name, char __user * __user *argv, char __
255 int error; 255 int error;
256 char * filename; 256 char * filename;
257 257
258 lock_kernel();
259 filename = getname(name); 258 filename = getname(name);
260 error = PTR_ERR(filename); 259 error = PTR_ERR(filename);
261 if (IS_ERR(filename)) 260 if (IS_ERR(filename))
262 goto out; 261 return error;
263 error = do_execve(filename, argv, envp, __frame); 262 error = do_execve(filename, argv, envp, __frame);
264 putname(filename); 263 putname(filename);
265 out:
266 unlock_kernel();
267 return error; 264 return error;
268} 265}
269 266
diff --git a/arch/frv/kernel/setup.c b/arch/frv/kernel/setup.c
index 55e4fab7c0bc..75cf7f4b2fa8 100644
--- a/arch/frv/kernel/setup.c
+++ b/arch/frv/kernel/setup.c
@@ -10,7 +10,7 @@
10 * 2 of the License, or (at your option) any later version. 10 * 2 of the License, or (at your option) any later version.
11 */ 11 */
12 12
13#include <linux/utsrelease.h> 13#include <generated/utsrelease.h>
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/sched.h> 15#include <linux/sched.h>
16#include <linux/delay.h> 16#include <linux/delay.h>
diff --git a/arch/frv/kernel/sys_frv.c b/arch/frv/kernel/sys_frv.c
index 2b6b5289cdcc..9c4980825bbb 100644
--- a/arch/frv/kernel/sys_frv.c
+++ b/arch/frv/kernel/sys_frv.c
@@ -31,9 +31,6 @@ asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
31 unsigned long prot, unsigned long flags, 31 unsigned long prot, unsigned long flags,
32 unsigned long fd, unsigned long pgoff) 32 unsigned long fd, unsigned long pgoff)
33{ 33{
34 int error = -EBADF;
35 struct file * file = NULL;
36
37 /* As with sparc32, make sure the shift for mmap2 is constant 34 /* As with sparc32, make sure the shift for mmap2 is constant
38 (12), no matter what PAGE_SIZE we have.... */ 35 (12), no matter what PAGE_SIZE we have.... */
39 36
@@ -41,155 +38,7 @@ asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
41 trying to map something we can't */ 38 trying to map something we can't */
42 if (pgoff & ((1 << (PAGE_SHIFT - 12)) - 1)) 39 if (pgoff & ((1 << (PAGE_SHIFT - 12)) - 1))
43 return -EINVAL; 40 return -EINVAL;
44 pgoff >>= PAGE_SHIFT - 12;
45
46 flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
47 if (!(flags & MAP_ANONYMOUS)) {
48 file = fget(fd);
49 if (!file)
50 goto out;
51 }
52
53 down_write(&current->mm->mmap_sem);
54 error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
55 up_write(&current->mm->mmap_sem);
56
57 if (file)
58 fput(file);
59out:
60 return error;
61}
62
63#if 0 /* DAVIDM - do we want this */
64struct mmap_arg_struct64 {
65 __u32 addr;
66 __u32 len;
67 __u32 prot;
68 __u32 flags;
69 __u64 offset; /* 64 bits */
70 __u32 fd;
71};
72
73asmlinkage long sys_mmap64(struct mmap_arg_struct64 *arg)
74{
75 int error = -EFAULT;
76 struct file * file = NULL;
77 struct mmap_arg_struct64 a;
78 unsigned long pgoff;
79
80 if (copy_from_user(&a, arg, sizeof(a)))
81 return -EFAULT;
82
83 if ((long)a.offset & ~PAGE_MASK)
84 return -EINVAL;
85
86 pgoff = a.offset >> PAGE_SHIFT;
87 if ((a.offset >> PAGE_SHIFT) != pgoff)
88 return -EINVAL;
89
90 if (!(a.flags & MAP_ANONYMOUS)) {
91 error = -EBADF;
92 file = fget(a.fd);
93 if (!file)
94 goto out;
95 }
96 a.flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
97
98 down_write(&current->mm->mmap_sem);
99 error = do_mmap_pgoff(file, a.addr, a.len, a.prot, a.flags, pgoff);
100 up_write(&current->mm->mmap_sem);
101 if (file)
102 fput(file);
103out:
104 return error;
105}
106#endif
107
108/*
109 * sys_ipc() is the de-multiplexer for the SysV IPC calls..
110 *
111 * This is really horribly ugly.
112 */
113asmlinkage long sys_ipc(unsigned long call,
114 unsigned long first,
115 unsigned long second,
116 unsigned long third,
117 void __user *ptr,
118 unsigned long fifth)
119{
120 int version, ret;
121
122 version = call >> 16; /* hack for backward compatibility */
123 call &= 0xffff;
124
125 switch (call) {
126 case SEMOP:
127 return sys_semtimedop(first, (struct sembuf __user *)ptr, second, NULL);
128 case SEMTIMEDOP:
129 return sys_semtimedop(first, (struct sembuf __user *)ptr, second,
130 (const struct timespec __user *)fifth);
131
132 case SEMGET:
133 return sys_semget (first, second, third);
134 case SEMCTL: {
135 union semun fourth;
136 if (!ptr)
137 return -EINVAL;
138 if (get_user(fourth.__pad, (void * __user *) ptr))
139 return -EFAULT;
140 return sys_semctl (first, second, third, fourth);
141 }
142
143 case MSGSND:
144 return sys_msgsnd (first, (struct msgbuf __user *) ptr,
145 second, third);
146 case MSGRCV:
147 switch (version) {
148 case 0: {
149 struct ipc_kludge tmp;
150 if (!ptr)
151 return -EINVAL;
152
153 if (copy_from_user(&tmp,
154 (struct ipc_kludge __user *) ptr,
155 sizeof (tmp)))
156 return -EFAULT;
157 return sys_msgrcv (first, tmp.msgp, second,
158 tmp.msgtyp, third);
159 }
160 default:
161 return sys_msgrcv (first,
162 (struct msgbuf __user *) ptr,
163 second, fifth, third);
164 }
165 case MSGGET:
166 return sys_msgget ((key_t) first, second);
167 case MSGCTL:
168 return sys_msgctl (first, second, (struct msqid_ds __user *) ptr);
169 41
170 case SHMAT: 42 return sys_mmap_pgoff(addr, len, prot, flags, fd,
171 switch (version) { 43 pgoff >> (PAGE_SHIFT - 12));
172 default: {
173 ulong raddr;
174 ret = do_shmat (first, (char __user *) ptr, second, &raddr);
175 if (ret)
176 return ret;
177 return put_user (raddr, (ulong __user *) third);
178 }
179 case 1: /* iBCS2 emulator entry point */
180 if (!segment_eq(get_fs(), get_ds()))
181 return -EINVAL;
182 /* The "(ulong *) third" is valid _only_ because of the kernel segment thing */
183 return do_shmat (first, (char __user *) ptr, second, (ulong *) third);
184 }
185 case SHMDT:
186 return sys_shmdt ((char __user *)ptr);
187 case SHMGET:
188 return sys_shmget (first, second, third);
189 case SHMCTL:
190 return sys_shmctl (first, second,
191 (struct shmid_ds __user *) ptr);
192 default:
193 return -ENOSYS;
194 }
195} 44}
diff --git a/arch/frv/kernel/sysctl.c b/arch/frv/kernel/sysctl.c
index 3e9d7e03fb95..71abd1510a59 100644
--- a/arch/frv/kernel/sysctl.c
+++ b/arch/frv/kernel/sysctl.c
@@ -9,7 +9,6 @@
9 * 2 of the License, or (at your option) any later version. 9 * 2 of the License, or (at your option) any later version.
10 */ 10 */
11 11
12#include <linux/slab.h>
13#include <linux/sysctl.h> 12#include <linux/sysctl.h>
14#include <linux/proc_fs.h> 13#include <linux/proc_fs.h>
15#include <linux/init.h> 14#include <linux/init.h>
@@ -176,21 +175,19 @@ static int procctl_frv_pin_cxnr(ctl_table *table, int write, struct file *filp,
176static struct ctl_table frv_table[] = 175static struct ctl_table frv_table[] =
177{ 176{
178 { 177 {
179 .ctl_name = 1,
180 .procname = "cache-mode", 178 .procname = "cache-mode",
181 .data = NULL, 179 .data = NULL,
182 .maxlen = 0, 180 .maxlen = 0,
183 .mode = 0644, 181 .mode = 0644,
184 .proc_handler = &procctl_frv_cachemode, 182 .proc_handler = procctl_frv_cachemode,
185 }, 183 },
186#ifdef CONFIG_MMU 184#ifdef CONFIG_MMU
187 { 185 {
188 .ctl_name = 2,
189 .procname = "pin-cxnr", 186 .procname = "pin-cxnr",
190 .data = NULL, 187 .data = NULL,
191 .maxlen = 0, 188 .maxlen = 0,
192 .mode = 0644, 189 .mode = 0644,
193 .proc_handler = &procctl_frv_pin_cxnr 190 .proc_handler = procctl_frv_pin_cxnr
194 }, 191 },
195#endif 192#endif
196 {} 193 {}
@@ -203,7 +200,6 @@ static struct ctl_table frv_table[] =
203static struct ctl_table frv_dir_table[] = 200static struct ctl_table frv_dir_table[] =
204{ 201{
205 { 202 {
206 .ctl_name = CTL_FRV,
207 .procname = "frv", 203 .procname = "frv",
208 .mode = 0555, 204 .mode = 0555,
209 .child = frv_table 205 .child = frv_table