patch-2.4.0-test7 linux/drivers/sound/sequencer.c

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

diff -u --recursive --new-file v2.4.0-test6/linux/drivers/sound/sequencer.c linux/drivers/sound/sequencer.c
@@ -1068,6 +1068,9 @@
 		if (synth_devs[i]==NULL)
 			continue;
 
+		if (synth_devs[i]->owner)
+			__MOD_INC_USE_COUNT (synth_devs[i]->owner);
+
 		if ((tmp = synth_devs[i]->open(i, mode)) < 0)
 		{
 			printk(KERN_WARNING "Sequencer: Warning! Cannot open synth device #%d (%d)\n", i, tmp);
@@ -1101,6 +1104,9 @@
 		for (i = 0; i < max_mididev; i++)
 			if (!midi_opened[i] && midi_devs[i])
 			{
+				if (midi_devs[i]->owner)
+					__MOD_INC_USE_COUNT (midi_devs[i]->owner);
+	
 				if ((retval = midi_devs[i]->open(i, mode,
 					sequencer_midi_input, sequencer_midi_output)) >= 0)
 				{
@@ -1108,8 +1114,12 @@
 				}
 			}
 	}
-	if (seq_mode == SEQ_2)
+
+	if (seq_mode == SEQ_2) {
+		if (tmr->owner)
+			__MOD_INC_USE_COUNT (tmr->owner);
 		tmr->open(tmr_no, seq_mode);
+	}
 
  	init_waitqueue_head(&seq_sleeper);
  	init_waitqueue_head(&midi_sleeper);
@@ -1191,6 +1201,9 @@
 			{
 				synth_devs[i]->close(i);
 
+				if (synth_devs[i]->owner)
+					__MOD_DEC_USE_COUNT (synth_devs[i]->owner);
+
 				if (synth_devs[i]->midi_dev)
 					midi_opened[synth_devs[i]->midi_dev] = 0;
 			}
@@ -1198,12 +1211,18 @@
 
 	for (i = 0; i < max_mididev; i++)
 	{
-		if (midi_opened[i])
+		if (midi_opened[i]) {
 			midi_devs[i]->close(i);
+			if (midi_devs[i]->owner)
+				__MOD_DEC_USE_COUNT (midi_devs[i]->owner);
+		}
 	}
 
-	if (seq_mode == SEQ_2)
+	if (seq_mode == SEQ_2) {
 		tmr->close(tmr_no);
+		if (tmr->owner)
+			__MOD_DEC_USE_COUNT (tmr->owner);
+	}
 
 	if (obsolete_api_used)
 		printk(KERN_WARNING "/dev/music: Obsolete (4 byte) API was used by %s\n", current->comm);

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