if(s->busy != file)
return -EACCES;
-
add_wait_queue(&dev->write_wait,&wait);
while(nbytes>0 && !retval){
current->state=TASK_INTERRUPTIBLE;
if(async->buf_write_ptr + m > async->prealloc_bufsz){
m = async->prealloc_bufsz - async->buf_write_ptr;
}
- m = comedi_buf_write_alloc(async, m);
+ comedi_buf_write_alloc(async, async->prealloc_bufsz);
+ if(m > comedi_buf_write_n_allocated(async))
+ m = comedi_buf_write_n_allocated(async);
if(m < n) n = m;
mask = s->async->events;
s->async->events = 0;
- //DPRINTK("comedi_event %x\n",mask);
+ //DPRINTK("comedi_event 0x%x\n",mask);
if( (s->subdev_flags & SDF_RUNNING) == 0)
return;
unsigned int num_bytes );
void comedi_buf_memcpy_from( comedi_async *async, unsigned int offset, void *destination,
unsigned int num_bytes );
+static inline unsigned comedi_buf_write_n_allocated(comedi_async *async)
+{
+ return async->buf_write_alloc_count - async->buf_write_count;
+}
+static inline unsigned comedi_buf_read_n_allocated(comedi_async *async)
+{
+ return async->buf_read_alloc_count - async->buf_read_count;
+}
void comedi_reset_async_buf(comedi_async *async);