Mercurial > pt1.oyama
comparison driver/pt1_pci.c @ 51:c915076353ae
backout 23b6f99f65b2 for now. it may cause scheduling while atomic operation.
author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
---|---|
date | Sat, 29 Aug 2009 04:26:33 +0900 |
parents | 23b6f99f65b2 |
children | 98a92ce5382e |
comparison
equal
deleted
inserted
replaced
50:23b6f99f65b2 | 51:c915076353ae |
---|---|
49 MODULE_AUTHOR("Tomoaki Ishikawa tomy@users.sourceforge.jp"); | 49 MODULE_AUTHOR("Tomoaki Ishikawa tomy@users.sourceforge.jp"); |
50 #define DRIVER_DESC "PCI earthsoft PT1 driver" | 50 #define DRIVER_DESC "PCI earthsoft PT1 driver" |
51 MODULE_DESCRIPTION(DRIVER_DESC); | 51 MODULE_DESCRIPTION(DRIVER_DESC); |
52 MODULE_LICENSE("GPL"); | 52 MODULE_LICENSE("GPL"); |
53 | 53 |
54 static int debug = 7; /* 1 normal messages, 0 quiet .. | 54 static int debug = 7; /* 1 normal messages, 0 quiet .. 7 verbose. */ |
55 7 verbose. */ | 55 static int lnb = 0; /* LNB OFF:0 +11V:1 +15V:2 */ |
56 static int lnb = 0; /* LNB OFF:0 +11V:1 +15V:2 */ | |
57 static spinlock_t lock; /* to synchronize at probing */ | |
58 | 56 |
59 module_param(debug, int, 0); | 57 module_param(debug, int, 0); |
60 module_param(lnb, int, 0); | 58 module_param(lnb, int, 0); |
61 MODULE_PARM_DESC(debug, "debug level (1-2)"); | 59 MODULE_PARM_DESC(debug, "debug level (1-2)"); |
62 MODULE_PARM_DESC(debug, "LNB level (0:OFF 1:+11V 2:+15V)"); | 60 MODULE_PARM_DESC(debug, "LNB level (0:OFF 1:+11V 2:+15V)"); |
698 if(rc < 0){ | 696 if(rc < 0){ |
699 printk(KERN_ERR "Error tuner_init\n"); | 697 printk(KERN_ERR "Error tuner_init\n"); |
700 goto out_err_fpga; | 698 goto out_err_fpga; |
701 } | 699 } |
702 } | 700 } |
703 | |
704 spin_lock(&lock); | |
705 | |
706 // 初期化完了 | 701 // 初期化完了 |
707 for(lp = 0 ; lp < MAX_CHANNEL ; lp++){ | 702 for(lp = 0 ; lp < MAX_CHANNEL ; lp++){ |
708 set_sleepmode(dev_conf->regs, &dev_conf->lock, | 703 set_sleepmode(dev_conf->regs, &dev_conf->lock, |
709 i2c_address[lp], channeltype[lp], TYPE_SLEEP); | 704 i2c_address[lp], channeltype[lp], TYPE_SLEEP); |
710 | 705 |
711 schedule_timeout_interruptible(msecs_to_jiffies(50)); | 706 schedule_timeout_interruptible(msecs_to_jiffies(50)); |
712 } | 707 } |
713 rc = alloc_chrdev_region(&dev_conf->dev, 0, MAX_CHANNEL, DEV_NAME); | 708 rc = alloc_chrdev_region(&dev_conf->dev, 0, MAX_CHANNEL, DEV_NAME); |
714 if(rc < 0){ | 709 if(rc < 0){ |
715 spin_unlock(&lock); | |
716 goto out_err_fpga; | 710 goto out_err_fpga; |
717 } | 711 } |
718 | 712 |
719 // 初期化 | 713 // 初期化 |
720 init_waitqueue_head(&dev_conf->dma_wait_q); | 714 init_waitqueue_head(&dev_conf->dma_wait_q); |
727 device[lp] = dev_conf ; | 721 device[lp] = dev_conf ; |
728 dev_conf->card_number = lp; | 722 dev_conf->card_number = lp; |
729 break ; | 723 break ; |
730 } | 724 } |
731 } | 725 } |
732 | |
733 spin_unlock(&lock); | |
734 | |
735 for(lp = 0 ; lp < MAX_CHANNEL ; lp++){ | 726 for(lp = 0 ; lp < MAX_CHANNEL ; lp++){ |
736 cdev_init(&dev_conf->cdev[lp], &pt1_fops); | 727 cdev_init(&dev_conf->cdev[lp], &pt1_fops); |
737 dev_conf->cdev[lp].owner = THIS_MODULE; | 728 dev_conf->cdev[lp].owner = THIS_MODULE; |
738 cdev_add(&dev_conf->cdev[lp], | 729 cdev_add(&dev_conf->cdev[lp], |
739 MKDEV(MAJOR(dev_conf->dev), (MINOR(dev_conf->dev) + lp)), 1); | 730 MKDEV(MAJOR(dev_conf->dev), (MINOR(dev_conf->dev) + lp)), 1); |
917 { | 908 { |
918 printk(version); | 909 printk(version); |
919 pt1video_class = class_create(THIS_MODULE, DRIVERNAME); | 910 pt1video_class = class_create(THIS_MODULE, DRIVERNAME); |
920 if (IS_ERR(pt1video_class)) | 911 if (IS_ERR(pt1video_class)) |
921 return PTR_ERR(pt1video_class); | 912 return PTR_ERR(pt1video_class); |
922 spin_lock_init(&lock); | |
923 return pci_register_driver(&pt1_driver); | 913 return pci_register_driver(&pt1_driver); |
924 } | 914 } |
925 | 915 |
926 | 916 |
927 static void __exit pt1_pci_cleanup(void) | 917 static void __exit pt1_pci_cleanup(void) |