diff options
author | H Hartley Sweeten <hsweeten@visionengravers.com> | 2014-11-05 17:20:52 (GMT) |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-11-05 22:59:46 (GMT) |
commit | 1dacbe5b26268fd3eaa6dad41271d296b072f3df (patch) | |
tree | 1602523e9f5cb50e02e8a0ae24cbdfe4e10a1014 /drivers/staging/comedi/drivers.c | |
parent | f4757af8516d95aaf9c6a1238887c34914e54622 (diff) | |
download | linux-1dacbe5b26268fd3eaa6dad41271d296b072f3df.tar.xz |
staging: comedi: comedidev.h: add 'scans_done' member to comedi_async
Introduce a new member to comedi_async to count the number of scans completed.
This member is cleared by comedi_buf_reset() along with the other comedi_async
members. It is incremented in comedi_inc_scan_progress() when the end of scan
is detected.
This member will be used to clean up the scan counting in the comedi drivers.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/comedi/drivers.c')
-rw-r--r-- | drivers/staging/comedi/drivers.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/staging/comedi/drivers.c b/drivers/staging/comedi/drivers.c index 9a8c5fc..02a01ba 100644 --- a/drivers/staging/comedi/drivers.c +++ b/drivers/staging/comedi/drivers.c @@ -352,6 +352,13 @@ void comedi_inc_scan_progress(struct comedi_subdevice *s, async->scan_progress += num_bytes; if (async->scan_progress >= scan_length) { + unsigned int nscans = async->scan_progress / scan_length; + + if (async->scans_done < (UINT_MAX - nscans)) + async->scans_done += nscans; + else + async->scans_done = UINT_MAX; + async->scan_progress %= scan_length; async->events |= COMEDI_CB_EOS; } |