patch-2.3.99-pre1 linux/drivers/sound/mpu401.c
Next file: linux/drivers/sound/sb_card.c
Previous file: linux/drivers/sound/miroaci.h
Back to the patch index
Back to the overall index
-  Lines: 36
-  Date:
Mon Mar 13 12:34:01 2000
-  Orig file: 
v2.3.51/linux/drivers/sound/mpu401.c
-  Orig date: 
Tue Mar  7 14:32:26 2000
diff -u --recursive --new-file v2.3.51/linux/drivers/sound/mpu401.c linux/drivers/sound/mpu401.c
@@ -1726,25 +1726,24 @@
 {
 	/* Can be loaded either for module use or to provide functions
 	   to others */
-	cfg.irq = irq;
-	cfg.io_base = io;
-	
-	if (cfg.io_base != -1 && cfg.irq != -1) {
-		printk(KERN_WARNING "mpu401: need io and irq !");
-		return -ENODEV;
+	if (io != -1 && irq != -1) {
+	        cfg.irq = irq;
+		cfg.io_base = io;
+		if (probe_mpu401(&cfg) == 0)
+			return -ENODEV;
+		attach_mpu401(&cfg);
 	}
 	
-	if (probe_mpu401(&cfg) == 0)
-		return -ENODEV;
-	attach_mpu401(&cfg);
-
 	SOUND_LOCK;
 	return 0;
 }
 
 void cleanup_mpu401(void)
 {
-	unload_mpu401(&cfg);
+	if (io != -1 && irq != -1) {
+		/* Check for use by, for example, sscape driver */
+		unload_mpu401(&cfg);
+	}
 	SOUND_LOCK_END;
 }
 
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)