aboutsummaryrefslogtreecommitdiffstats
path: root/arch/parisc/kernel/perf.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/parisc/kernel/perf.c')
-rw-r--r--arch/parisc/kernel/perf.c33
1 files changed, 20 insertions, 13 deletions
diff --git a/arch/parisc/kernel/perf.c b/arch/parisc/kernel/perf.c
index 44670d6e06f4..f6fec62b6a2f 100644
--- a/arch/parisc/kernel/perf.c
+++ b/arch/parisc/kernel/perf.c
@@ -196,8 +196,7 @@ static int perf_open(struct inode *inode, struct file *file);
196static ssize_t perf_read(struct file *file, char __user *buf, size_t cnt, loff_t *ppos); 196static ssize_t perf_read(struct file *file, char __user *buf, size_t cnt, loff_t *ppos);
197static ssize_t perf_write(struct file *file, const char __user *buf, size_t count, 197static ssize_t perf_write(struct file *file, const char __user *buf, size_t count,
198 loff_t *ppos); 198 loff_t *ppos);
199static int perf_ioctl(struct inode *inode, struct file *file, unsigned int cmd, 199static long perf_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
200 unsigned long arg);
201static void perf_start_counters(void); 200static void perf_start_counters(void);
202static int perf_stop_counters(uint32_t *raddr); 201static int perf_stop_counters(uint32_t *raddr);
203static struct rdr_tbl_ent * perf_rdr_get_entry(uint32_t rdr_num); 202static struct rdr_tbl_ent * perf_rdr_get_entry(uint32_t rdr_num);
@@ -438,48 +437,56 @@ static void perf_patch_images(void)
438 * must be running on the processor that you wish to change. 437 * must be running on the processor that you wish to change.
439 */ 438 */
440 439
441static int perf_ioctl(struct inode *inode, struct file *file, unsigned int cmd, 440static long perf_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
442 unsigned long arg)
443{ 441{
444 long error_start; 442 long error_start;
445 uint32_t raddr[4]; 443 uint32_t raddr[4];
444 int error = 0;
446 445
446 lock_kernel();
447 switch (cmd) { 447 switch (cmd) {
448 448
449 case PA_PERF_ON: 449 case PA_PERF_ON:
450 /* Start the counters */ 450 /* Start the counters */
451 perf_start_counters(); 451 perf_start_counters();
452 return 0; 452 break;
453 453
454 case PA_PERF_OFF: 454 case PA_PERF_OFF:
455 error_start = perf_stop_counters(raddr); 455 error_start = perf_stop_counters(raddr);
456 if (error_start != 0) { 456 if (error_start != 0) {
457 printk(KERN_ERR "perf_off: perf_stop_counters = %ld\n", error_start); 457 printk(KERN_ERR "perf_off: perf_stop_counters = %ld\n", error_start);
458 return -EFAULT; 458 error = -EFAULT;
459 break;
459 } 460 }
460 461
461 /* copy out the Counters */ 462 /* copy out the Counters */
462 if (copy_to_user((void __user *)arg, raddr, 463 if (copy_to_user((void __user *)arg, raddr,
463 sizeof (raddr)) != 0) { 464 sizeof (raddr)) != 0) {
464 return -EFAULT; 465 error = -EFAULT;
466 break;
465 } 467 }
466 return 0; 468 break;
467 469
468 case PA_PERF_VERSION: 470 case PA_PERF_VERSION:
469 /* Return the version # */ 471 /* Return the version # */
470 return put_user(PERF_VERSION, (int *)arg); 472 error = put_user(PERF_VERSION, (int *)arg);
473 break;
471 474
472 default: 475 default:
473 break; 476 error = -ENOTTY;
474 } 477 }
475 return -ENOTTY; 478
479 unlock_kernel();
480
481 return error;
476} 482}
477 483
478static struct file_operations perf_fops = { 484static struct file_operations perf_fops = {
479 .llseek = no_llseek, 485 .llseek = no_llseek,
480 .read = perf_read, 486 .read = perf_read,
481 .write = perf_write, 487 .write = perf_write,
482 .ioctl = perf_ioctl, 488 .unlocked_ioctl = perf_ioctl,
489 .compat_ioctl = perf_ioctl,
483 .open = perf_open, 490 .open = perf_open,
484 .release = perf_release 491 .release = perf_release
485}; 492};