Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 354030
b: refs/heads/master
c: 3abfa10
h: refs/heads/master
v: v3
  • Loading branch information
H Hartley Sweeten authored and Greg Kroah-Hartman committed Jan 18, 2013
1 parent aa191e7 commit 0cf8420
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 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: 034cbd17922a8b6c64b227360314167c15c1f031
refs/heads/master: 3abfa1066b9e98df434868eda9ba91d7012d45c6
15 changes: 10 additions & 5 deletions trunk/drivers/staging/comedi/comedi_buf.c
Original file line number Diff line number Diff line change
Expand Up @@ -312,14 +312,19 @@ EXPORT_SYMBOL(comedi_buf_read_alloc);
/* transfers control of a chunk from reader to free buffer space */
unsigned comedi_buf_read_free(struct comedi_async *async, unsigned int nbytes)
{
/* barrier insures data has been read out of
* buffer before read count is incremented */
unsigned int allocated;

/*
* ensure data has been read out of buffer before
* the async read count is incremented
*/
smp_mb();
if ((int)(async->buf_read_count + nbytes -
async->buf_read_alloc_count) > 0) {

allocated = comedi_buf_read_n_allocated(async);
if (nbytes > allocated) {
dev_info(async->subdevice->device->class_dev,
"attempted to read-free more bytes than have been read-allocated.\n");
nbytes = async->buf_read_alloc_count - async->buf_read_count;
nbytes = allocated;
}
async->buf_read_count += nbytes;
async->buf_read_ptr += nbytes;
Expand Down

0 comments on commit 0cf8420

Please sign in to comment.