patch-2.1.126 linux/drivers/sound/msnd_pinnacle.c

Next file: linux/drivers/sound/opl3sa2.c
Previous file: linux/drivers/sound/msnd.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.125/linux/drivers/sound/msnd_pinnacle.c linux/drivers/sound/msnd_pinnacle.c
@@ -29,7 +29,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: msnd_pinnacle.c,v 1.63 1998/09/10 18:37:19 andrewtv Exp $
+ * $Id: msnd_pinnacle.c,v 1.66 1998/10/09 19:54:39 andrewtv Exp $
  *
  ********************************************************************/
 
@@ -66,6 +66,10 @@
 #  define LOGNAME			"msnd_pinnacle"
 #endif
 
+#ifndef CONFIG_MSND_WRITE_NDELAY
+#  define CONFIG_MSND_WRITE_NDELAY	0
+#endif
+
 #define get_play_delay_jiffies(size)	((size) * HZ *			\
 					 dev.play_sample_size / 8 /	\
 					 dev.play_sample_rate /		\
@@ -281,7 +285,8 @@
 		return 0;
 
 	case SNDCTL_DSP_NONBLOCK:
-		if (file->f_mode & FMODE_WRITE)
+		if (!test_bit(F_DISABLE_WRITE_NDELAY, &dev.flags) &&
+		    file->f_mode & FMODE_WRITE)
 			dev.play_ndelay = 1;
 		if (file->f_mode & FMODE_READ)
 			dev.rec_ndelay = 1;
@@ -742,11 +747,14 @@
 			dev.nresets = 0;
 			if (file->f_mode & FMODE_WRITE) {
 				set_default_play_audio_parameters();
-				dev.play_ndelay = (file->f_mode & O_NDELAY) ? 1 : 0;
+				if (!test_bit(F_DISABLE_WRITE_NDELAY, &dev.flags))
+					dev.play_ndelay = (file->f_flags & O_NDELAY) ? 1 : 0;
+				else
+					dev.play_ndelay = 0;
 			}
 			if (file->f_mode & FMODE_READ) {
 				set_default_rec_audio_parameters();
-				dev.rec_ndelay = (file->f_mode & O_NDELAY) ? 1 : 0;
+				dev.rec_ndelay = (file->f_flags & O_NDELAY) ? 1 : 0;
 			}
 		}
 	}
@@ -820,7 +828,7 @@
 	if ((n = msnd_fifo_write(
 		&dev.DARF,
 		(char *)(dev.base + bank * DAR_BUFF_SIZE),
-		size, 0)) < 0) {
+		size, 0)) <= 0) {
 		outb(HPBLKSEL_0, dev.io + HP_BLKS);
 		return n;
 	}
@@ -1099,7 +1107,9 @@
 	dev_ioctl,	/* ioctl */
 	NULL,		/* mmap */
 	dev_open,	/* open */
+#ifndef LINUX20
 	NULL,		/* flush */
+#endif
 	dev_release,	/* release */
 	NULL,		/* fsync */
 	NULL,		/* fasync */
@@ -1631,6 +1641,7 @@
 MODULE_PARM				(io, "i");
 MODULE_PARM				(irq, "i");
 MODULE_PARM				(mem, "i");
+MODULE_PARM				(write_ndelay, "i");
 MODULE_PARM				(major, "i");
 MODULE_PARM				(fifosize, "i");
 MODULE_PARM				(calibrate_signal, "i");
@@ -1649,6 +1660,7 @@
 static int io __initdata =		-1;
 static int irq __initdata =		-1;
 static int mem __initdata =		-1;
+static int write_ndelay __initdata =	-1;
 
 #ifndef MSND_CLASSIC
 /* Pinnacle/Fiji non-PnP Config Port */
@@ -1676,6 +1688,8 @@
 
 #else /* not a module */
 
+static int write_ndelay __initdata =	-1;
+
 #ifdef MSND_CLASSIC
 static int io __initdata =		CONFIG_MSNDCLAS_IO;
 static int irq __initdata =		CONFIG_MSNDCLAS_IRQ;
@@ -1888,6 +1902,12 @@
 	dev.recsrc = 0;
 	dev.inc_ref = mod_inc_ref;
 	dev.dec_ref = mod_dec_ref;
+	if (write_ndelay == -1)
+		write_ndelay = CONFIG_MSND_WRITE_NDELAY;
+	if (write_ndelay)
+		clear_bit(F_DISABLE_WRITE_NDELAY, &dev.flags);
+	else
+		set_bit(F_DISABLE_WRITE_NDELAY, &dev.flags);
 
 #ifndef MSND_CLASSIC
 	if (digital) {

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov