提交 ad7dd338 编写于 作者: C Christoph Hellwig 提交者: Kyle McMartin

[PARISC] move PA perf driver over to ->compat_ioctl

Move PA perf driver over to ->compat_ioctl.
Signed-off-by: NChristoph Hellwig <hch@lst.de>
Acked-by: NRandolph Chung <tausq@parisc-linux.org>
Signed-off-by: NKyle McMartin <kyle@parisc-linux.org>
上级 a137ce85
...@@ -561,11 +561,6 @@ IOCTL_TABLE_START ...@@ -561,11 +561,6 @@ IOCTL_TABLE_START
#define DECLARES #define DECLARES
#include "compat_ioctl.c" #include "compat_ioctl.c"
/* PA-specific ioctls */
COMPATIBLE_IOCTL(PA_PERF_ON)
COMPATIBLE_IOCTL(PA_PERF_OFF)
COMPATIBLE_IOCTL(PA_PERF_VERSION)
/* And these ioctls need translation */ /* And these ioctls need translation */
HANDLE_IOCTL(SIOCGPPPSTATS, dev_ifsioc) HANDLE_IOCTL(SIOCGPPPSTATS, dev_ifsioc)
HANDLE_IOCTL(SIOCGPPPCSTATS, dev_ifsioc) HANDLE_IOCTL(SIOCGPPPCSTATS, dev_ifsioc)
......
...@@ -196,8 +196,7 @@ static int perf_open(struct inode *inode, struct file *file); ...@@ -196,8 +196,7 @@ static int perf_open(struct inode *inode, struct file *file);
static ssize_t perf_read(struct file *file, char __user *buf, size_t cnt, loff_t *ppos); static ssize_t perf_read(struct file *file, char __user *buf, size_t cnt, loff_t *ppos);
static ssize_t perf_write(struct file *file, const char __user *buf, size_t count, static ssize_t perf_write(struct file *file, const char __user *buf, size_t count,
loff_t *ppos); loff_t *ppos);
static int perf_ioctl(struct inode *inode, struct file *file, unsigned int cmd, static long perf_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
unsigned long arg);
static void perf_start_counters(void); static void perf_start_counters(void);
static int perf_stop_counters(uint32_t *raddr); static int perf_stop_counters(uint32_t *raddr);
static struct rdr_tbl_ent * perf_rdr_get_entry(uint32_t rdr_num); static struct rdr_tbl_ent * perf_rdr_get_entry(uint32_t rdr_num);
...@@ -438,48 +437,56 @@ static void perf_patch_images(void) ...@@ -438,48 +437,56 @@ static void perf_patch_images(void)
* must be running on the processor that you wish to change. * must be running on the processor that you wish to change.
*/ */
static int perf_ioctl(struct inode *inode, struct file *file, unsigned int cmd, static long perf_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
unsigned long arg)
{ {
long error_start; long error_start;
uint32_t raddr[4]; uint32_t raddr[4];
int error = 0;
lock_kernel();
switch (cmd) { switch (cmd) {
case PA_PERF_ON: case PA_PERF_ON:
/* Start the counters */ /* Start the counters */
perf_start_counters(); perf_start_counters();
return 0; break;
case PA_PERF_OFF: case PA_PERF_OFF:
error_start = perf_stop_counters(raddr); error_start = perf_stop_counters(raddr);
if (error_start != 0) { if (error_start != 0) {
printk(KERN_ERR "perf_off: perf_stop_counters = %ld\n", error_start); printk(KERN_ERR "perf_off: perf_stop_counters = %ld\n", error_start);
return -EFAULT; error = -EFAULT;
break;
} }
/* copy out the Counters */ /* copy out the Counters */
if (copy_to_user((void __user *)arg, raddr, if (copy_to_user((void __user *)arg, raddr,
sizeof (raddr)) != 0) { sizeof (raddr)) != 0) {
return -EFAULT; error = -EFAULT;
break;
} }
return 0; break;
case PA_PERF_VERSION: case PA_PERF_VERSION:
/* Return the version # */ /* Return the version # */
return put_user(PERF_VERSION, (int *)arg); error = put_user(PERF_VERSION, (int *)arg);
break;
default: default:
break; error = -ENOTTY;
} }
return -ENOTTY;
unlock_kernel();
return error;
} }
static struct file_operations perf_fops = { static struct file_operations perf_fops = {
.llseek = no_llseek, .llseek = no_llseek,
.read = perf_read, .read = perf_read,
.write = perf_write, .write = perf_write,
.ioctl = perf_ioctl, .unlocked_ioctl = perf_ioctl,
.compat_ioctl = perf_ioctl,
.open = perf_open, .open = perf_open,
.release = perf_release .release = perf_release
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册