diff -r 5cac1af69dd1 -r 0992f932f68a driver/pt1_pci.c --- a/driver/pt1_pci.c Tue Nov 08 22:47:17 2011 +0900 +++ b/driver/pt1_pci.c Fri Nov 11 22:56:07 2011 +0900 @@ -19,8 +19,10 @@ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23) #include #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36) +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39) #include #endif +#endif #else #define set_freezable() #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,11) @@ -148,6 +150,10 @@ #define PT1MAJOR 251 #define DRIVERNAME "pt1video" +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39) +static DEFINE_MUTEX(pt1_ioctl_mutex); +#endif + static void reset_dma(PT1_DEVICE *dev_conf) { @@ -537,6 +543,7 @@ return 0 ; case STOP_REC: SetStream(channel->ptr->regs, channel->channel, FALSE); + schedule_timeout_interruptible(msecs_to_jiffies(100)); return 0 ; case GET_SIGNAL_STRENGTH: switch(channel->type){ @@ -577,9 +584,18 @@ { long rc; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39) + if(mutex_lock_interruptible(&pt1_ioctl_mutex)) + return -EINTR; +#else lock_kernel(); +#endif rc = pt1_ioctl(file->f_path.dentry->d_inode, file, cmd, arg); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39) + mutex_unlock(&pt1_ioctl_mutex); +#else unlock_kernel(); +#endif return rc; } #endif