diff options
Diffstat (limited to 'arch/mips/kernel')
-rw-r--r-- | arch/mips/kernel/branch.c | 2 | ||||
-rw-r--r-- | arch/mips/kernel/linux32.c | 64 | ||||
-rw-r--r-- | arch/mips/kernel/rtlx.c | 11 | ||||
-rw-r--r-- | arch/mips/kernel/vpe.c | 6 |
4 files changed, 11 insertions, 72 deletions
diff --git a/arch/mips/kernel/branch.c b/arch/mips/kernel/branch.c index 374de839558d..b6232d9033cb 100644 --- a/arch/mips/kernel/branch.c +++ b/arch/mips/kernel/branch.c | |||
@@ -184,7 +184,7 @@ int __compute_return_epc(struct pt_regs *regs) | |||
184 | bit = (insn.i_format.rt >> 2); | 184 | bit = (insn.i_format.rt >> 2); |
185 | bit += (bit != 0); | 185 | bit += (bit != 0); |
186 | bit += 23; | 186 | bit += 23; |
187 | switch (insn.i_format.rt) { | 187 | switch (insn.i_format.rt & 3) { |
188 | case 0: /* bc1f */ | 188 | case 0: /* bc1f */ |
189 | case 2: /* bc1fl */ | 189 | case 2: /* bc1fl */ |
190 | if (~fcr31 & (1 << bit)) | 190 | if (~fcr31 & (1 << bit)) |
diff --git a/arch/mips/kernel/linux32.c b/arch/mips/kernel/linux32.c index 7c953bcc5f6a..a7d2bb3cf835 100644 --- a/arch/mips/kernel/linux32.c +++ b/arch/mips/kernel/linux32.c | |||
@@ -356,73 +356,13 @@ asmlinkage int sys32_llseek(unsigned int fd, unsigned int offset_high, | |||
356 | asmlinkage ssize_t sys32_pread(unsigned int fd, char __user * buf, | 356 | asmlinkage ssize_t sys32_pread(unsigned int fd, char __user * buf, |
357 | size_t count, u32 unused, u64 a4, u64 a5) | 357 | size_t count, u32 unused, u64 a4, u64 a5) |
358 | { | 358 | { |
359 | ssize_t ret; | 359 | return sys_pread64(fd, buf, count, merge_64(a4, a5)); |
360 | struct file * file; | ||
361 | ssize_t (*read)(struct file *, char __user *, size_t, loff_t *); | ||
362 | loff_t pos; | ||
363 | |||
364 | ret = -EBADF; | ||
365 | file = fget(fd); | ||
366 | if (!file) | ||
367 | goto bad_file; | ||
368 | if (!(file->f_mode & FMODE_READ)) | ||
369 | goto out; | ||
370 | pos = merge_64(a4, a5); | ||
371 | ret = rw_verify_area(READ, file, &pos, count); | ||
372 | if (ret < 0) | ||
373 | goto out; | ||
374 | ret = -EINVAL; | ||
375 | if (!file->f_op || !(read = file->f_op->read)) | ||
376 | goto out; | ||
377 | if (pos < 0) | ||
378 | goto out; | ||
379 | ret = -ESPIPE; | ||
380 | if (!(file->f_mode & FMODE_PREAD)) | ||
381 | goto out; | ||
382 | ret = read(file, buf, count, &pos); | ||
383 | if (ret > 0) | ||
384 | dnotify_parent(file->f_dentry, DN_ACCESS); | ||
385 | out: | ||
386 | fput(file); | ||
387 | bad_file: | ||
388 | return ret; | ||
389 | } | 360 | } |
390 | 361 | ||
391 | asmlinkage ssize_t sys32_pwrite(unsigned int fd, const char __user * buf, | 362 | asmlinkage ssize_t sys32_pwrite(unsigned int fd, const char __user * buf, |
392 | size_t count, u32 unused, u64 a4, u64 a5) | 363 | size_t count, u32 unused, u64 a4, u64 a5) |
393 | { | 364 | { |
394 | ssize_t ret; | 365 | return sys_pwrite64(fd, buf, count, merge_64(a4, a5)); |
395 | struct file * file; | ||
396 | ssize_t (*write)(struct file *, const char __user *, size_t, loff_t *); | ||
397 | loff_t pos; | ||
398 | |||
399 | ret = -EBADF; | ||
400 | file = fget(fd); | ||
401 | if (!file) | ||
402 | goto bad_file; | ||
403 | if (!(file->f_mode & FMODE_WRITE)) | ||
404 | goto out; | ||
405 | pos = merge_64(a4, a5); | ||
406 | ret = rw_verify_area(WRITE, file, &pos, count); | ||
407 | if (ret < 0) | ||
408 | goto out; | ||
409 | ret = -EINVAL; | ||
410 | if (!file->f_op || !(write = file->f_op->write)) | ||
411 | goto out; | ||
412 | if (pos < 0) | ||
413 | goto out; | ||
414 | |||
415 | ret = -ESPIPE; | ||
416 | if (!(file->f_mode & FMODE_PWRITE)) | ||
417 | goto out; | ||
418 | |||
419 | ret = write(file, buf, count, &pos); | ||
420 | if (ret > 0) | ||
421 | dnotify_parent(file->f_dentry, DN_MODIFY); | ||
422 | out: | ||
423 | fput(file); | ||
424 | bad_file: | ||
425 | return ret; | ||
426 | } | 366 | } |
427 | 367 | ||
428 | asmlinkage int sys32_sched_rr_get_interval(compat_pid_t pid, | 368 | asmlinkage int sys32_sched_rr_get_interval(compat_pid_t pid, |
diff --git a/arch/mips/kernel/rtlx.c b/arch/mips/kernel/rtlx.c index 6179805af9f0..caf777f83289 100644 --- a/arch/mips/kernel/rtlx.c +++ b/arch/mips/kernel/rtlx.c | |||
@@ -398,15 +398,14 @@ ssize_t rtlx_write(int index, void *buffer, size_t count, int user) | |||
398 | 398 | ||
399 | static int file_open(struct inode *inode, struct file *filp) | 399 | static int file_open(struct inode *inode, struct file *filp) |
400 | { | 400 | { |
401 | int minor = MINOR(inode->i_rdev); | 401 | int minor = iminor(inode); |
402 | 402 | ||
403 | return rtlx_open(minor, (filp->f_flags & O_NONBLOCK) ? 0 : 1); | 403 | return rtlx_open(minor, (filp->f_flags & O_NONBLOCK) ? 0 : 1); |
404 | } | 404 | } |
405 | 405 | ||
406 | static int file_release(struct inode *inode, struct file *filp) | 406 | static int file_release(struct inode *inode, struct file *filp) |
407 | { | 407 | { |
408 | int minor; | 408 | int minor = iminor(inode); |
409 | minor = MINOR(inode->i_rdev); | ||
410 | 409 | ||
411 | return rtlx_release(minor); | 410 | return rtlx_release(minor); |
412 | } | 411 | } |
@@ -416,7 +415,7 @@ static unsigned int file_poll(struct file *file, poll_table * wait) | |||
416 | int minor; | 415 | int minor; |
417 | unsigned int mask = 0; | 416 | unsigned int mask = 0; |
418 | 417 | ||
419 | minor = MINOR(file->f_dentry->d_inode->i_rdev); | 418 | minor = iminor(file->f_dentry->d_inode); |
420 | 419 | ||
421 | poll_wait(file, &channel_wqs[minor].rt_queue, wait); | 420 | poll_wait(file, &channel_wqs[minor].rt_queue, wait); |
422 | poll_wait(file, &channel_wqs[minor].lx_queue, wait); | 421 | poll_wait(file, &channel_wqs[minor].lx_queue, wait); |
@@ -438,7 +437,7 @@ static unsigned int file_poll(struct file *file, poll_table * wait) | |||
438 | static ssize_t file_read(struct file *file, char __user * buffer, size_t count, | 437 | static ssize_t file_read(struct file *file, char __user * buffer, size_t count, |
439 | loff_t * ppos) | 438 | loff_t * ppos) |
440 | { | 439 | { |
441 | int minor = MINOR(file->f_dentry->d_inode->i_rdev); | 440 | int minor = iminor(file->f_dentry->d_inode); |
442 | 441 | ||
443 | /* data available? */ | 442 | /* data available? */ |
444 | if (!rtlx_read_poll(minor, (file->f_flags & O_NONBLOCK) ? 0 : 1)) { | 443 | if (!rtlx_read_poll(minor, (file->f_flags & O_NONBLOCK) ? 0 : 1)) { |
@@ -455,7 +454,7 @@ static ssize_t file_write(struct file *file, const char __user * buffer, | |||
455 | struct rtlx_channel *rt; | 454 | struct rtlx_channel *rt; |
456 | DECLARE_WAITQUEUE(wait, current); | 455 | DECLARE_WAITQUEUE(wait, current); |
457 | 456 | ||
458 | minor = MINOR(file->f_dentry->d_inode->i_rdev); | 457 | minor = iminor(file->f_dentry->d_inode); |
459 | rt = &rtlx->channel[minor]; | 458 | rt = &rtlx->channel[minor]; |
460 | 459 | ||
461 | /* any space left... */ | 460 | /* any space left... */ |
diff --git a/arch/mips/kernel/vpe.c b/arch/mips/kernel/vpe.c index 80ffaa6d50ad..85d7df7b18e1 100644 --- a/arch/mips/kernel/vpe.c +++ b/arch/mips/kernel/vpe.c | |||
@@ -1072,7 +1072,7 @@ static int vpe_open(struct inode *inode, struct file *filp) | |||
1072 | struct vpe_notifications *not; | 1072 | struct vpe_notifications *not; |
1073 | 1073 | ||
1074 | /* assume only 1 device at the mo. */ | 1074 | /* assume only 1 device at the mo. */ |
1075 | if ((minor = MINOR(inode->i_rdev)) != 1) { | 1075 | if ((minor = iminor(inode)) != 1) { |
1076 | printk(KERN_WARNING "VPE loader: only vpe1 is supported\n"); | 1076 | printk(KERN_WARNING "VPE loader: only vpe1 is supported\n"); |
1077 | return -ENODEV; | 1077 | return -ENODEV; |
1078 | } | 1078 | } |
@@ -1133,7 +1133,7 @@ static int vpe_release(struct inode *inode, struct file *filp) | |||
1133 | struct vpe *v; | 1133 | struct vpe *v; |
1134 | Elf_Ehdr *hdr; | 1134 | Elf_Ehdr *hdr; |
1135 | 1135 | ||
1136 | minor = MINOR(inode->i_rdev); | 1136 | minor = iminor(inode); |
1137 | if ((v = get_vpe(minor)) == NULL) | 1137 | if ((v = get_vpe(minor)) == NULL) |
1138 | return -ENODEV; | 1138 | return -ENODEV; |
1139 | 1139 | ||
@@ -1174,7 +1174,7 @@ static ssize_t vpe_write(struct file *file, const char __user * buffer, | |||
1174 | size_t ret = count; | 1174 | size_t ret = count; |
1175 | struct vpe *v; | 1175 | struct vpe *v; |
1176 | 1176 | ||
1177 | minor = MINOR(file->f_dentry->d_inode->i_rdev); | 1177 | minor = iminor(file->f_dentry->d_inode); |
1178 | if ((v = get_vpe(minor)) == NULL) | 1178 | if ((v = get_vpe(minor)) == NULL) |
1179 | return -ENODEV; | 1179 | return -ENODEV; |
1180 | 1180 | ||