patch-2.1.24 linux/drivers/sound/audio.c
Next file: linux/drivers/sound/dmabuf.c
Previous file: linux/drivers/scsi/ChangeLog
Back to the patch index
Back to the overall index
- Lines: 71
- Date:
Tue Jan 28 10:02:45 1997
- Orig file:
v2.1.23/linux/drivers/sound/audio.c
- Orig date:
Tue Oct 29 19:58:14 1996
diff -u --recursive --new-file v2.1.23/linux/drivers/sound/audio.c linux/drivers/sound/audio.c
@@ -12,7 +12,7 @@
* for more info.
*/
#include <linux/config.h>
-
+#include <linux/poll.h>
#include "sound_config.h"
@@ -542,44 +542,31 @@
*/
}
-int
-audio_select (int dev, struct fileinfo *file, int sel_type, select_table * wait)
+unsigned int
+audio_poll (kdev_t dev, struct fileinfo *file, poll_table * wait)
{
char *dma_buf;
+ unsigned int mask = 0;
int buf_no, buf_ptr, buf_size;
dev = dev >> 4;
- switch (sel_type)
- {
- case SEL_IN:
- if (audio_mode[dev] & AM_WRITE && !(audio_devs[dev]->flags & DMA_DUPLEX))
- {
- return 0; /* Not recording */
- }
-
- return DMAbuf_select (dev, file, sel_type, wait);
- break;
-
- case SEL_OUT:
- if (audio_mode[dev] & AM_READ && !(audio_devs[dev]->flags & DMA_DUPLEX))
- {
- return 0; /* Wrong direction */
- }
-
- if (DMAbuf_get_curr_buffer (dev, &buf_no, &dma_buf, &buf_ptr, &buf_size) >= 0)
- {
- return 1; /* There is space in the current buffer */
- }
-
- return DMAbuf_select (dev, file, sel_type, wait);
- break;
+ mask = DMAbuf_poll (dev, file, wait);
- case SEL_EX:
- return 0;
- }
+/* sel_in */
+ if (audio_mode[dev] & AM_WRITE && !(audio_devs[dev]->flags & DMA_DUPLEX))
+ mask &= ~(POLLIN | POLLRDNORM); /* Wrong direction */
+
+/* sel_out */
+ if (audio_mode[dev] & AM_READ && !(audio_devs[dev]->flags & DMA_DUPLEX)) {
+ mask &= ~(POLLOUT | POLLWRNORM); /* Wrong direction */
+ goto sel_ex;
+ }
+ if (DMAbuf_get_curr_buffer (dev, &buf_no, &dma_buf, &buf_ptr, &buf_size) >= 0)
+ mask |= POLLOUT | POLLWRNORM;
- return 0;
+ sel_ex:
+ return mask;
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov