]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/staging/comedi/comedi_buf.c
staging: comedi: add new comedi_buf_write_n_available()
[karo-tx-linux.git] / drivers / staging / comedi / comedi_buf.c
index 4837559ac6b84d03e5d48afe887a89db0a27f362..90c28016c6c13a51b16a2d9a889a8b4e6563209e 100644 (file)
@@ -253,6 +253,14 @@ static unsigned int comedi_buf_write_n_unalloc(struct comedi_subdevice *s)
        return free_end - async->buf_write_alloc_count;
 }
 
+unsigned int comedi_buf_write_n_available(struct comedi_subdevice *s)
+{
+       struct comedi_async *async = s->async;
+       unsigned int free_end = async->buf_read_count + async->prealloc_bufsz;
+
+       return free_end - async->buf_write_count;
+}
+
 /**
  * comedi_buf_write_alloc() - Reserve buffer space for writing
  * @s: COMEDI subdevice.