aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrank Mori Hess <[email protected]>2018-02-15 15:13:42 -0500
committerGreg Kroah-Hartman <[email protected]>2018-03-06 07:21:10 -0800
commita42ae5905140c324362fe5036ae1dbb16e4d359c (patch)
treed4f19950624eb6a242d0a856e614a02dadb0c717
parentcb57469c9573f6018cd1302953dd45d6e05aba7b (diff)
staging: comedi: fix comedi_nsamples_left.
A rounding error was causing comedi_nsamples_left to return the wrong value when nsamples was not a multiple of the scan length. Cc: <[email protected]> # v4.4+ Signed-off-by: Frank Mori Hess <[email protected]> Reviewed-by: Ian Abbott <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
-rw-r--r--drivers/staging/comedi/drivers.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/staging/comedi/drivers.c b/drivers/staging/comedi/drivers.c
index e618a87521a3..9d733471ca2e 100644
--- a/drivers/staging/comedi/drivers.c
+++ b/drivers/staging/comedi/drivers.c
@@ -475,8 +475,7 @@ unsigned int comedi_nsamples_left(struct comedi_subdevice *s,
struct comedi_cmd *cmd = &async->cmd;
if (cmd->stop_src == TRIG_COUNT) {
- unsigned int nscans = nsamples / cmd->scan_end_arg;
- unsigned int scans_left = __comedi_nscans_left(s, nscans);
+ unsigned int scans_left = __comedi_nscans_left(s, cmd->stop_arg);
unsigned int scan_pos =
comedi_bytes_to_samples(s, async->scan_progress);
unsigned long long samples_left = 0;