pressure interpolation: simplify code

Getting rid of the pointless always-zero pressure now makes it obvious
how some of the remaining code can just be removed too: there is no
point in re-initializing the pressure_time entries to zero at the
segment start, because they started out zero and we just checked that we
don't do anything to them before we hit the segment start.

Similarly, now that the silly pressure testing is gone, it is obvious
that the code for "i < cur" and "i == curr" cases is identical, and the
two cases can just be collapsed.

Signed-off-by: Linus Torvalds <torvalds@ linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Linus Torvalds 2016-02-21 15:15:25 -08:00 committed by Dirk Hohndel
parent 1f7f3c4af5
commit 398cd5d9cc

View file

@ -191,17 +191,7 @@ static struct pr_interpolate_struct get_pr_interpolate_data(pr_track_t *segment,
interpolate.pressure_time += entry->pressure_time;
break;
}
if (entry->sec == segment->t_start) {
interpolate.acc_pressure_time = 0;
interpolate.pressure_time = 0;
continue;
}
if (i < cur) {
interpolate.acc_pressure_time += entry->pressure_time;
interpolate.pressure_time += entry->pressure_time;
continue;
}
if (i == cur) {
if (i <= cur) {
interpolate.acc_pressure_time += entry->pressure_time;
interpolate.pressure_time += entry->pressure_time;
continue;