# HG changeset patch # User Naoya OYAMA # Date 1340810207 -32400 # Node ID 4303bbfd5d3789d738db615bcbcb6bb11fa72972 # Parent 2a9ac5ce2c7ec3aa22d9692b9473d31dd92aa843 Support Linux-3.x kernel delete asm/system.h diff -r 2a9ac5ce2c7e -r 4303bbfd5d37 driver/pt1_i2c.c --- a/driver/pt1_i2c.c Wed Jun 27 23:41:49 2012 +0900 +++ b/driver/pt1_i2c.c Thu Jun 28 00:16:47 2012 +0900 @@ -10,7 +10,6 @@ #include #include -#include #include #include #include diff -r 2a9ac5ce2c7e -r 4303bbfd5d37 driver/pt1_pci.c --- a/driver/pt1_pci.c Wed Jun 27 23:41:49 2012 +0900 +++ b/driver/pt1_pci.c Thu Jun 28 00:16:47 2012 +0900 @@ -10,14 +10,18 @@ #include #include -#include #include #include #include #include #include #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23) -#include + #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) @@ -76,6 +80,7 @@ #define DMA_SIZE 4096 // DMAバッファサイズ #define DMA_RING_SIZE 128 // RINGサイズ #define DMA_RING_MAX 511 // 1RINGにいくつ詰めるか(1023はNGで511まで) +#define MAX_READ_SIZE (1024 * 4) #define CHANEL_DMA_SIZE (2*1024*1024) // 地デジ用(16Mbps) #define BS_CHANEL_DMA_SIZE (4*1024*1024) // BS用(32Mbps) @@ -144,6 +149,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) { @@ -309,12 +318,12 @@ // 頻度を落す(4Kで起動させる) for(lp = 0 ; lp < MAX_CHANNEL ; lp++){ channel = dev_conf->channel[real_channel[lp]] ; - if((channel->size >= DMA_SIZE) && (channel->valid == TRUE)){ + if((channel->size >= MAX_READ_SIZE ) && (channel->valid == TRUE)){ wake_up(&channel->wait_q); } } } - schedule_timeout_interruptible(msecs_to_jiffies(1)); + schedule_timeout_interruptible(msecs_to_jiffies(10)); } return 0 ; } @@ -403,9 +412,9 @@ __u32 size ; unsigned long dummy; - // 4K単位で起こされるのを待つ(CPU負荷対策) - if(channel->size < DMA_SIZE){ - wait_event_timeout(channel->wait_q, (channel->size >= DMA_SIZE), + // 128K単位で起こされるのを待つ(CPU負荷対策) + if(channel->size < MAX_READ_SIZE){ + wait_event_timeout(channel->wait_q, (channel->size >= MAX_READ_SIZE), msecs_to_jiffies(500)); } mutex_lock(&channel->lock); @@ -533,6 +542,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){ @@ -568,6 +578,25 @@ return -EINVAL; } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36) +static long pt1_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long arg) +{ + long rc; + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39) + if(mutex_lock_interruptible(&pt1_ioctl_mutex)) + return -EINTR; + rc = pt1_ioctl(file->f_path.dentry->d_inode, file, cmd, arg); + mutex_unlock(&pt1_ioctl_mutex); +#else + lock_kernel(); + rc = pt1_ioctl(file->f_path.dentry->d_inode, file, cmd, arg); + unlock_kernel(); +#endif + return rc; +} +#endif + /* */ static const struct file_operations pt1_fops = { @@ -575,7 +604,11 @@ .open = pt1_open, .release = pt1_release, .read = pt1_read, +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36) + .unlocked_ioctl = pt1_unlocked_ioctl, +#else .ioctl = pt1_ioctl, +#endif .llseek = no_llseek, }; @@ -970,8 +1003,8 @@ static void __exit pt1_pci_cleanup(void) { + pci_unregister_driver(&pt1_driver); class_destroy(pt1video_class); - pci_unregister_driver(&pt1_driver); } module_init(pt1_pci_init); diff -r 2a9ac5ce2c7e -r 4303bbfd5d37 driver/pt1_tuner.c --- a/driver/pt1_tuner.c Wed Jun 27 23:41:49 2012 +0900 +++ b/driver/pt1_tuner.c Thu Jun 28 00:16:47 2012 +0900 @@ -8,7 +8,6 @@ #include #include -#include #include #include #include diff -r 2a9ac5ce2c7e -r 4303bbfd5d37 driver/pt1_tuner_data.c --- a/driver/pt1_tuner_data.c Wed Jun 27 23:41:49 2012 +0900 +++ b/driver/pt1_tuner_data.c Thu Jun 28 00:16:47 2012 +0900 @@ -6,7 +6,6 @@ #include #include -#include #include #include #include