patch-2.4.0-test2 linux/drivers/sound/cmpci.c

Next file: linux/drivers/sound/cs4232.c
Previous file: linux/drivers/sound/awe_wave.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.0-test1/linux/drivers/sound/cmpci.c linux/drivers/sound/cmpci.c
@@ -1161,7 +1161,6 @@
 		return -ENODEV;
        	VALIDATE_STATE(s);
 	file->private_data = s;
-	MOD_INC_USE_COUNT;
 	return 0;
 }
 
@@ -1170,7 +1169,6 @@
 	struct cm_state *s = (struct cm_state *)file->private_data;
 	
 	VALIDATE_STATE(s);
-	MOD_DEC_USE_COUNT;
 	return 0;
 }
 
@@ -1180,6 +1178,7 @@
 }
 
 static /*const*/ struct file_operations cm_mixer_fops = {
+	owner:		THIS_MODULE,
 	llseek:		cm_llseek,
 	ioctl:		cm_ioctl_mixdev,
 	open:		cm_open_mixdev,
@@ -1765,7 +1764,6 @@
 	set_fmt(s, fmtm, fmts);
 	s->open_mode |= file->f_mode & (FMODE_READ | FMODE_WRITE);
 	up(&s->open_sem);
-	MOD_INC_USE_COUNT;
 	return 0;
 }
 
@@ -1788,11 +1786,11 @@
 	s->open_mode &= (~file->f_mode) & (FMODE_READ|FMODE_WRITE);
 	up(&s->open_sem);
 	wake_up(&s->open_wait);
-	MOD_DEC_USE_COUNT;
 	return 0;
 }
 
 static /*const*/ struct file_operations cm_audio_fops = {
+	owner:		THIS_MODULE,
 	llseek:		cm_llseek,
 	read:		cm_read,
 	write:		cm_write,
@@ -2012,7 +2010,6 @@
 	spin_unlock_irqrestore(&s->lock, flags);
 	s->open_mode |= (file->f_mode << FMODE_MIDI_SHIFT) & (FMODE_MIDI_READ | FMODE_MIDI_WRITE);
 	up(&s->open_sem);
-	MOD_INC_USE_COUNT;
 	return 0;
 }
 
@@ -2062,11 +2059,11 @@
 	spin_unlock_irqrestore(&s->lock, flags);
 	up(&s->open_sem);
 	wake_up(&s->open_wait);
-	MOD_DEC_USE_COUNT;
 	return 0;
 }
 
 static /*const*/ struct file_operations cm_midi_fops = {
+	owner:		THIS_MODULE,
 	llseek:		cm_llseek,
 	read:		cm_midi_read,
 	write:		cm_midi_write,
@@ -2207,7 +2204,6 @@
 	outb(1, s->iosynth+3);  /* enable OPL3 */
 	s->open_mode |= FMODE_DMFM;
 	up(&s->open_sem);
-	MOD_INC_USE_COUNT;
 	return 0;
 }
 
@@ -2227,11 +2223,11 @@
 	}
 	up(&s->open_sem);
 	wake_up(&s->open_wait);
-	MOD_DEC_USE_COUNT;
 	return 0;
 }
 
 static /*const*/ struct file_operations cm_dmfm_fops = {
+	owner:		THIS_MODULE,
 	llseek:		cm_llseek,
 	ioctl:		cm_dmfm_ioctl,
 	open:		cm_dmfm_open,
@@ -2321,6 +2317,8 @@
  	       (pcidev = pci_find_device(PCI_VENDOR_ID_CMEDIA, PCI_DEVICE_ID_CMEDIA_CM8338A, pcidev)) ||
 	       (pcidev = pci_find_device(PCI_VENDOR_ID_CMEDIA, PCI_DEVICE_ID_CMEDIA_CM8338B, pcidev)) ||
 	       (pcidev = pci_find_device(PCI_VENDOR_ID_CMEDIA, PCI_DEVICE_ID_CMEDIA_CM8738, pcidev)))) {
+		if (pci_enable_device(pcidev))
+			continue;
 		if (pcidev->irq == 0)
 			continue;
 		if (!(s = kmalloc(sizeof(struct cm_state), GFP_KERNEL))) {
@@ -2345,7 +2343,7 @@
 		init_MUTEX(&s->open_sem);
 		spin_lock_init(&s->lock);
 		s->magic = CM_MAGIC;
-		s->iobase = pcidev->resource[0].start;
+		s->iobase = pci_resource_start(pcidev, 0);
 		s->iosynth = 0x388;
 		s->iomidi = 0x330;
 		spin_lock_init(&s->lock);

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)