diff --git a/[refs] b/[refs] index 596bafcc65d9..09714463c749 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: d21af4cbfb7fccbccedc1d9e143a14aee6b1c9ad +refs/heads/master: 43f9137df461f6365f76b46f404fd6775eab7d51 diff --git a/trunk/drivers/staging/comedi/comedi_buf.c b/trunk/drivers/staging/comedi/comedi_buf.c index fd2a92e29fb0..06dd544ec2c5 100644 --- a/trunk/drivers/staging/comedi/comedi_buf.c +++ b/trunk/drivers/staging/comedi/comedi_buf.c @@ -273,14 +273,17 @@ unsigned int comedi_buf_read_n_available(struct comedi_async *async) { unsigned num_bytes; - if (async == NULL) + if (!async) return 0; + num_bytes = async->munge_count - async->buf_read_count; - /* barrier insures the read of munge_count in this - query occurs before any following reads of the buffer which - might be based on the return value from this query. + + /* + * ensure the async buffer 'counts' are read before we + * attempt to read data from the buffer */ smp_rmb(); + return num_bytes; } EXPORT_SYMBOL(comedi_buf_read_n_available);