patch-2.1.90 linux/drivers/sound/dmabuf.c
Next file: linux/drivers/sound/dmabuf.c.old
Previous file: linux/drivers/sound/dev_table.c
Back to the patch index
Back to the overall index
- Lines: 92
- Date:
Thu Mar 12 10:53:23 1998
- Orig file:
v2.1.89/linux/drivers/sound/dmabuf.c
- Orig date:
Tue Mar 10 10:03:33 1998
diff -u --recursive --new-file v2.1.89/linux/drivers/sound/dmabuf.c linux/drivers/sound/dmabuf.c
@@ -104,7 +104,7 @@
dmap->raw_buf_phys = virt_to_bus(start_addr);
for (i = MAP_NR(start_addr); i <= MAP_NR(end_addr); i++)
- set_bit(PG_reserved, &mem_map[i].flags);;
+ set_bit(PG_reserved, &mem_map[i].flags);
return 0;
}
@@ -115,8 +115,6 @@
if (dmap->raw_buf == NULL)
return;
- if (dmap->mapping_flags & DMA_MAP_MAPPED)
- return; /* Don't free mmapped buffer. Will use it next time */
for (sz = 0, size = PAGE_SIZE; size < dmap->buffsize; sz++, size <<= 1);
start_addr = (unsigned long) dmap->raw_buf;
@@ -127,6 +125,8 @@
free_pages((unsigned long) dmap->raw_buf, sz);
dmap->raw_buf = NULL;
+ /* Remember the buffer is deleted so we dont Oops later */
+ dmap->fragment_size = 0;
}
@@ -206,6 +206,7 @@
dmap->dma_mode = DMODE_NONE;
dmap->flags &= ~DMA_BUSY;
disable_dma(dmap->dma);
+ sound_free_dmap(dmap);
}
@@ -832,12 +833,12 @@
dmap->user_counter += l;
dmap->flags |= DMA_DIRTY;
- if (dmap->user_counter >= dmap->max_byte_counter) {
+ if (dmap->byte_counter >= dmap->max_byte_counter) {
/* Wrap the byte counters */
- long decr = dmap->user_counter;
- dmap->user_counter = (dmap->user_counter % dmap->bytes_in_use) + dmap->bytes_in_use;
- decr -= dmap->user_counter;
- dmap->byte_counter -= decr;
+ long decr = dmap->byte_counter;
+ dmap->byte_counter = (dmap->byte_counter % dmap->bytes_in_use);
+ decr -= dmap->byte_counter;
+ dmap->user_counter -= decr;
}
end_ptr = (dmap->user_counter / dmap->fragment_size) * dmap->fragment_size;
@@ -928,7 +929,7 @@
dmap->byte_counter += dmap->bytes_in_use;
if (dmap->byte_counter >= dmap->max_byte_counter) { /* Overflow */
long decr = dmap->byte_counter;
- dmap->byte_counter = (dmap->byte_counter % dmap->bytes_in_use) + dmap->bytes_in_use;
+ dmap->byte_counter = (dmap->byte_counter % dmap->bytes_in_use);
decr -= dmap->byte_counter;
dmap->user_counter -= decr;
}
@@ -952,7 +953,7 @@
dmap->byte_counter += dmap->bytes_in_use;
if (dmap->byte_counter >= dmap->max_byte_counter) { /* Overflow */
long decr = dmap->byte_counter;
- dmap->byte_counter = (dmap->byte_counter % dmap->bytes_in_use) + dmap->bytes_in_use;
+ dmap->byte_counter = (dmap->byte_counter % dmap->bytes_in_use);
decr -= dmap->byte_counter;
dmap->user_counter -= decr;
}
@@ -1209,20 +1210,6 @@
unsigned int DMAbuf_poll(struct file * file, int dev, poll_table *wait)
{
return poll_input(file, dev, wait) | poll_output(file, dev, wait);
-}
-
-void DMAbuf_deinit(int dev)
-{
- struct audio_operations *adev = audio_devs[dev];
- /* This routine is called when driver is being unloaded */
- if (!adev)
- return;
-#ifdef RUNTIME_DMA_ALLOC
- sound_free_dmap(adev->dmap_out);
-
- if (adev->flags & DMA_DUPLEX)
- sound_free_dmap(adev->dmap_in);
-#endif
}
#endif
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov