Mercurial > pt1.oyama
diff driver/pt1_pci.c @ 36:65c8ac567074
cleaning up:
- eliminate warnings
- remove dangling white spaces
- changed new line code in Makefile from CR+LF to LF
author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
---|---|
date | Fri, 13 Mar 2009 14:32:44 +0900 |
parents | 289794dc265f |
children | c359e7adf700 |
line wrap: on
line diff
--- a/driver/pt1_pci.c Fri Mar 13 14:29:56 2009 +0900 +++ b/driver/pt1_pci.c Fri Mar 13 14:32:44 2009 +0900 @@ -17,11 +17,11 @@ #include <asm/uaccess.h> #include <linux/version.h> #include <linux/mutex.h> -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23) #include <linux/freezer.h> #else #define set_freezable() -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,11) +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,11) typedef struct pm_message { int event; } pm_message_t; @@ -69,7 +69,7 @@ #define MAX_READ_BLOCK 4 // 1度に読み出す最大DMAバッファ数 #define MAX_PCI_DEVICE 128 // 最大64枚 #define DMA_SIZE 4096 // DMAバッファサイズ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22) #define DMA_RING_SIZE 128 // RINGサイズ #define DMA_RING_MAX 511 // 1RINGにいくつ詰めるか(1023はNGで511まで) #define CHANEL_DMA_SIZE (2*1024*1024) // 地デジ用(16Mbps) @@ -182,7 +182,6 @@ int lp ; int chno ; int lp2 ; - __u32 addr ; __u32 *dataptr ; __u32 *curdataptr ; __u32 val ; @@ -328,7 +327,6 @@ } static int pt1_release(struct inode *inode, struct file *file) { - int minor = iminor(inode); PT1_CHANNEL *channel = file->private_data; mutex_lock(&channel->ptr->lock); @@ -353,7 +351,7 @@ { PT1_CHANNEL *channel = file->private_data; __u32 size ; - + unsigned long dummy; // 4K単位で起こされるのを待つ(CPU負荷対策) if(channel->size < DMA_SIZE){ @@ -367,12 +365,12 @@ if(cnt < channel->size){ // バッファが足りない場合は残りを移動する size = cnt ; - copy_to_user(buf, channel->buf, cnt); + dummy = copy_to_user(buf, channel->buf, cnt); memmove(channel->buf, &channel->buf[cnt], (channel->size - cnt)); channel->size -= cnt ; }else{ size = channel->size ; - copy_to_user(buf, channel->buf, size); + dummy = copy_to_user(buf, channel->buf, size); channel->size = 0 ; } } @@ -433,16 +431,18 @@ } return 0 ; } -static int pt1_ioctl(struct inode *inode, struct file *file, unsigned int cmd, void *arg) +static int pt1_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg0) { PT1_CHANNEL *channel = file->private_data; - int signal ; + int signal ; + unsigned long dummy; + void *arg = (void *)arg0; switch(cmd){ case SET_CHANNEL: { FREQUENCY freq ; - copy_from_user(&freq, arg, sizeof(FREQUENCY)); + dummy = copy_from_user(&freq, arg, sizeof(FREQUENCY)); return SetFreq(channel, &freq); } case START_REC: @@ -462,11 +462,11 @@ break ; case CHANNEL_TYPE_ISDB_T: // calc C/N - signal = isdb_t_read_signal_strength(channel->ptr->regs, + signal = isdb_t_read_signal_strength(channel->ptr->regs, &channel->ptr->lock, channel->address); break ; } - copy_to_user(arg, &signal, sizeof(int)); + dummy = copy_to_user(arg, &signal, sizeof(int)); return 0 ; case LNB_ENABLE: if(lnb){ @@ -578,6 +578,7 @@ u16 cmd ; PT1_DEVICE *dev_conf ; PT1_CHANNEL *channel ; + struct resource *dummy; rc = pci_enable_device(pdev); if (rc) @@ -608,8 +609,8 @@ // PCIアドレスをマップする dev_conf->mmio_start = pci_resource_start(pdev, 0); dev_conf->mmio_len = pci_resource_len(pdev, 0); - rc = request_mem_region(dev_conf->mmio_start, dev_conf->mmio_len, DEV_NAME); - if (!rc) { + dummy = request_mem_region(dev_conf->mmio_start, dev_conf->mmio_len, DEV_NAME); + if (!dummy) { printk(KERN_ERR "PT1: cannot request iomem (0x%llx).\n", (unsigned long long) dev_conf->mmio_start); goto out_err_regbase; } @@ -642,9 +643,9 @@ } // 初期化完了 for(lp = 0 ; lp < MAX_CHANNEL ; lp++){ - set_sleepmode(dev_conf->regs, &dev_conf->lock, + set_sleepmode(dev_conf->regs, &dev_conf->lock, i2c_address[lp], channeltype[lp], TYPE_SLEEP); - + schedule_timeout_interruptible(msecs_to_jiffies(50)); } rc = alloc_chrdev_region(&dev_conf->dev, 0, MAX_CHANNEL, DEV_NAME); @@ -839,6 +840,7 @@ static int __init pt1_pci_init(void) { + printk(version); pt1video_class = class_create(THIS_MODULE, DRIVERNAME); if (IS_ERR(pt1video_class)) return PTR_ERR(pt1video_class);