Mercurial > pt1
comparison driver/pt1_pci.c @ 119:7662d0ecd74b
revised new ioctl functions
author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
---|---|
date | Fri, 19 Nov 2010 11:19:25 +0900 |
parents | 53266592882d |
children | 3914cc1b2375 |
comparison
equal
deleted
inserted
replaced
118:53266592882d | 119:7662d0ecd74b |
---|---|
31 | 31 |
32 #include <linux/fs.h> | 32 #include <linux/fs.h> |
33 #include <linux/cdev.h> | 33 #include <linux/cdev.h> |
34 | 34 |
35 #include <linux/ioctl.h> | 35 #include <linux/ioctl.h> |
36 #include <linux/smp_lock.h> | |
36 | 37 |
37 #include "pt1_com.h" | 38 #include "pt1_com.h" |
38 #include "pt1_pci.h" | 39 #include "pt1_pci.h" |
39 #include "pt1_tuner.h" | 40 #include "pt1_tuner.h" |
40 #include "pt1_i2c.h" | 41 #include "pt1_i2c.h" |
509 | 510 |
510 printk(KERN_INFO "used bs tuners on %p = %d\n", device, count); | 511 printk(KERN_INFO "used bs tuners on %p = %d\n", device, count); |
511 return count; | 512 return count; |
512 } | 513 } |
513 | 514 |
514 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36) | 515 static long pt1_do_ioctl(struct file *file, unsigned int cmd, unsigned long arg0) |
515 static long pt1_ioctl(struct file *file, unsigned int cmd, unsigned long arg0) | |
516 #else | |
517 static int pt1_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg0) | |
518 #endif | |
519 { | 516 { |
520 PT1_CHANNEL *channel = file->private_data; | 517 PT1_CHANNEL *channel = file->private_data; |
521 int signal; | 518 int signal; |
522 unsigned long dummy; | 519 unsigned long dummy; |
523 void *arg = (void *)arg0; | 520 void *arg = (void *)arg0; |
570 return 0 ; | 567 return 0 ; |
571 } | 568 } |
572 return -EINVAL; | 569 return -EINVAL; |
573 } | 570 } |
574 | 571 |
572 static long pt1_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long arg0) | |
573 { | |
574 long ret; | |
575 | |
576 lock_kernel(); | |
577 ret = pt1_do_ioctl(file, cmd, arg0); | |
578 unlock_kernel(); | |
579 | |
580 return ret; | |
581 } | |
582 | |
583 static long pt1_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg0) | |
584 { | |
585 long ret; | |
586 /* should do 32bit <-> 64bit conversion here? --yaz */ | |
587 ret = pt1_unlocked_ioctl(file, cmd, arg0); | |
588 | |
589 return ret; | |
590 } | |
591 | |
592 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36) | |
593 static int pt1_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg0) | |
594 { | |
595 int ret; | |
596 ret = (int)pt1_do_ioctl(file, cmd, arg0); | |
597 return ret; | |
598 } | |
599 #endif | |
600 | |
575 /* | 601 /* |
576 */ | 602 */ |
577 static const struct file_operations pt1_fops = { | 603 static const struct file_operations pt1_fops = { |
578 .owner = THIS_MODULE, | 604 .owner = THIS_MODULE, |
579 .open = pt1_open, | 605 .open = pt1_open, |
580 .release = pt1_release, | 606 .release = pt1_release, |
581 .read = pt1_read, | 607 .read = pt1_read, |
582 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36) | 608 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36) |
583 .unlocked_ioctl = pt1_ioctl, | |
584 #else | |
585 .ioctl = pt1_ioctl, | 609 .ioctl = pt1_ioctl, |
586 #endif | 610 #endif |
611 .unlocked_ioctl = pt1_unlocked_ioctl, | |
612 .compat_ioctl = pt1_compat_ioctl, | |
587 .llseek = no_llseek, | 613 .llseek = no_llseek, |
588 }; | 614 }; |
589 | 615 |
590 int pt1_makering(struct pci_dev *pdev, PT1_DEVICE *dev_conf) | 616 int pt1_makering(struct pci_dev *pdev, PT1_DEVICE *dev_conf) |
591 { | 617 { |