Mercurial > pt1
changeset 120:3914cc1b2375
- adapted to 3.x kernels
- replaced lock/unlock_kernel with mutex
- enlarged read size
- changed the order in clean up so that the module no longer hangs on being removed
- changed channel step of bs17 as the upstream
- adopted some useful patches
author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
---|---|
date | Fri, 06 Jan 2012 17:32:36 +0900 |
parents | 7662d0ecd74b |
children | 1f0be0adc04f |
files | driver/pt1_pci.c driver/pt1_tuner_data.c |
diffstat | 2 files changed, 15 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/driver/pt1_pci.c Fri Nov 19 11:19:25 2010 +0900 +++ b/driver/pt1_pci.c Fri Jan 06 17:32:36 2012 +0900 @@ -33,7 +33,6 @@ #include <linux/cdev.h> #include <linux/ioctl.h> -#include <linux/smp_lock.h> #include "pt1_com.h" #include "pt1_pci.h" @@ -79,6 +78,7 @@ #define DMA_RING_MAX 511 // 1RINGにいくつ詰めるか(1023はNGで511まで) #define CHANEL_DMA_SIZE (2*1024*1024) // 地デジ用(16Mbps) #define BS_CHANEL_DMA_SIZE (4*1024*1024) // BS用(32Mbps) +#define READ_SIZE (16*DMA_SIZE) typedef struct _DMA_CONTROL{ dma_addr_t ring_dma[DMA_RING_MAX] ; // DMA情報 @@ -307,15 +307,15 @@ } } - // 頻度を落す(4Kで起動させる) + // 頻度を落す(wait until READ_SIZE) 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 >= 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 ; } @@ -404,9 +404,9 @@ __u32 size ; unsigned long dummy; - // 4K単位で起こされるのを待つ(CPU負荷対策) - if(channel->size < DMA_SIZE){ - wait_event_timeout(channel->wait_q, (channel->size >= DMA_SIZE), + // READ_SIZE単位で起こされるのを待つ(CPU負荷対策) + if(channel->size < READ_SIZE){ + wait_event_timeout(channel->wait_q, (channel->size >= READ_SIZE), msecs_to_jiffies(500)); } mutex_lock(&channel->lock); @@ -534,6 +534,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){ @@ -571,11 +572,12 @@ static long pt1_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long arg0) { + PT1_CHANNEL *channel = file->private_data; long ret; - lock_kernel(); + mutex_lock(&channel->lock); ret = pt1_do_ioctl(file, cmd, arg0); - unlock_kernel(); + mutex_unlock(&channel->lock); return ret; } @@ -607,9 +609,10 @@ .read = pt1_read, #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36) .ioctl = pt1_ioctl, -#endif +#else .unlocked_ioctl = pt1_unlocked_ioctl, .compat_ioctl = pt1_compat_ioctl, +#endif .llseek = no_llseek, }; @@ -1004,8 +1007,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);