ols: simplify calculation of readcount

Somewhen we probably want DIV_ROUND_UP from the Kernel.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
This commit is contained in:
Wolfram Sang 2019-01-02 13:15:18 +01:00 committed by Uwe Hermann
parent be15c51ed4
commit aad0c77708
1 changed files with 2 additions and 6 deletions

View File

@ -417,14 +417,10 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
/* /*
* Limit readcount to prevent reading past the end of the hardware * Limit readcount to prevent reading past the end of the hardware
* buffer. * buffer. Rather read too many samples than too few.
*/ */
samplecount = MIN(devc->max_samples / num_ols_changrp, devc->limit_samples); samplecount = MIN(devc->max_samples / num_ols_changrp, devc->limit_samples);
readcount = samplecount / 4; readcount = (samplecount + 3) / 4;
/* Rather read too many samples than too few. */
if (samplecount % 4 != 0)
readcount++;
/* Basic triggers. */ /* Basic triggers. */
if (ols_convert_trigger(sdi) != SR_OK) { if (ols_convert_trigger(sdi) != SR_OK) {