Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 354029
b: refs/heads/master
c: 034cbd1
h: refs/heads/master
i:
  354027: 58b4994
v: v3
  • Loading branch information
H Hartley Sweeten authored and Greg Kroah-Hartman committed Jan 18, 2013
1 parent edb85d5 commit aa191e7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 43f9137df461f6365f76b46f404fd6775eab7d51
refs/heads/master: 034cbd17922a8b6c64b227360314167c15c1f031
18 changes: 12 additions & 6 deletions trunk/drivers/staging/comedi/comedi_buf.c
Original file line number Diff line number Diff line change
Expand Up @@ -291,14 +291,20 @@ EXPORT_SYMBOL(comedi_buf_read_n_available);
/* allocates a chunk for the reader from filled (and munged) buffer space */
unsigned comedi_buf_read_alloc(struct comedi_async *async, unsigned nbytes)
{
if ((int)(async->buf_read_alloc_count + nbytes - async->munge_count) >
0) {
nbytes = async->munge_count - async->buf_read_alloc_count;
}
unsigned int available;

available = async->munge_count - async->buf_read_alloc_count;
if (nbytes > available)
nbytes = available;

async->buf_read_alloc_count += nbytes;
/* barrier insures read of munge_count occurs before we actually read
data out of buffer */

/*
* ensure the async buffer 'counts' are read before we
* attempt to read data from the read-alloc'ed buffer space
*/
smp_rmb();

return nbytes;
}
EXPORT_SYMBOL(comedi_buf_read_alloc);
Expand Down

0 comments on commit aa191e7

Please sign in to comment.