# HG changeset patch # User Yoshiki Yazawa # Date 1290133165 -32400 # Node ID 7662d0ecd74b330f3f970f485fe42a674cc3676b # Parent 53266592882d0d42b0634e910c23b44f91952bc3 revised new ioctl functions diff -r 53266592882d -r 7662d0ecd74b driver/pt1_pci.c --- a/driver/pt1_pci.c Thu Nov 18 23:01:40 2010 +0900 +++ b/driver/pt1_pci.c Fri Nov 19 11:19:25 2010 +0900 @@ -33,6 +33,7 @@ #include #include +#include #include "pt1_com.h" #include "pt1_pci.h" @@ -511,11 +512,7 @@ return count; } -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36) -static long pt1_ioctl(struct file *file, unsigned int cmd, unsigned long arg0) -#else -static int pt1_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg0) -#endif +static long pt1_do_ioctl(struct file *file, unsigned int cmd, unsigned long arg0) { PT1_CHANNEL *channel = file->private_data; int signal; @@ -572,6 +569,35 @@ return -EINVAL; } +static long pt1_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long arg0) +{ + long ret; + + lock_kernel(); + ret = pt1_do_ioctl(file, cmd, arg0); + unlock_kernel(); + + return ret; +} + +static long pt1_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg0) +{ + long ret; + /* should do 32bit <-> 64bit conversion here? --yaz */ + ret = pt1_unlocked_ioctl(file, cmd, arg0); + + return ret; +} + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36) +static int pt1_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg0) +{ + int ret; + ret = (int)pt1_do_ioctl(file, cmd, arg0); + return ret; +} +#endif + /* */ static const struct file_operations pt1_fops = { @@ -579,11 +605,11 @@ .open = pt1_open, .release = pt1_release, .read = pt1_read, -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36) - .unlocked_ioctl = pt1_ioctl, -#else +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36) .ioctl = pt1_ioctl, #endif + .unlocked_ioctl = pt1_unlocked_ioctl, + .compat_ioctl = pt1_compat_ioctl, .llseek = no_llseek, };