patch-2.1.13 linux/drivers/sound/dmabuf.c

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

diff -u --recursive --new-file v2.1.12/linux/drivers/sound/dmabuf.c linux/drivers/sound/dmabuf.c
@@ -203,7 +203,10 @@
   }
 
   if (dmap->raw_buf == NULL)
-    return -ENOSPC;		/* Memory allocation failed during boot */
+    {
+      printk ("Sound: DMA buffers not available\n");
+      return -ENOSPC;		/* Memory allocation failed during boot */
+    }
 
   if (sound_open_dma (chan, audio_devs[dev]->name))
     {
@@ -452,6 +455,9 @@
 
   dmap->dma_mode |= DMODE_OUTPUT;
 
+  if (dmap->counts[dmap->qhead] == 0)
+    dmap->counts[dmap->qhead] = dmap->fragment_size;
+
   audio_devs[dev]->d->output_block (dev, dmap->raw_buf_phys +
 				    dmap->qhead * dmap->fragment_size,
 				    dmap->counts[dmap->qhead], 0,
@@ -870,7 +876,7 @@
       pos = get_dma_residue (chan);
       if (chan > 3)		/* Word count */
 	pos *= 2;
-      pos = dmap->bytes_in_use - pos;
+      pos = dmap->bytes_in_use - pos - 1;
       if (pos < 0)
 	pos = 0;
       if (pos > dmap->bytes_in_use)
@@ -1605,6 +1611,9 @@
 
       if (!(audio_devs[dev]->flags & DMA_AUTOMODE))
 	{
+	  if (dmap->counts[dmap->qhead] == 0)
+	    dmap->counts[dmap->qhead] = dmap->fragment_size;
+
 	  audio_devs[dev]->d->output_block (dev, dmap->raw_buf_phys +
 					  dmap->qhead * dmap->fragment_size,
 					    dmap->counts[dmap->qhead], 1,

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