ASoC: dapm: Remove path 'walked' flag
authorLars-Peter Clausen <lars@metafoo.de>
Mon, 20 Oct 2014 17:36:39 +0000 (19:36 +0200)
committerMark Brown <broonie@kernel.org>
Wed, 22 Oct 2014 11:11:38 +0000 (12:11 +0100)
commit130897ac5ac03adb4604d27497c378c64c7b22dd
treea47a4365ff53420b96e1eb3ad28ca0c0757e0312
parentcdef2ad3ae64cc1ab2daeff26335e0dde988eed7
ASoC: dapm: Remove path 'walked' flag

The 'walked' flag was used to avoid walking paths that have already been
walked. But since we started caching the number of inputs and outputs of a
path we never actually get into a situation where we try to walk a path that
has the 'walked' flag set.

There are two cases in which we can end up walking a path multiple times
within a single run of is_connected_output_ep() or is_connected_input_ep().

1) If a path splits up and rejoins later:

     .--> C ---v
A -> B         E --> F
     '--> D ---^

When walking from A to F we'll end up at E twice, once via C and once via D.
But since we do a depth first search we'll fully discover the path and
initialize the number of outputs/inputs of the widget the first time we get
there. The second time we get there we'll use the cached value and not
bother to check any of the paths again. So we'll never see a path where
'walked' is set in this case.

2) If there is a circle:

A --> B <-- C <-.--> F
      '--> D ---'

When walking from A to F we'll end up twice at B. But since there is a
circle the 'walking' flag will still be set on B once we get there the
second time. This means we won't look at any of it's outgoing paths. So in
this case we won't ever see a path where 'walked' is set either.

So it is safe to remove the flag. This on one hand means we remove some
always true checks from one of the hottest paths of the DAPM algorithm and
on the other hand means we do not have to do the tedious clearing of the
flag after checking the number inputs or outputs of a widget.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
include/sound/soc-dapm.h
sound/soc/soc-dapm.c
This page took 0.027226 seconds and 5 git commands to generate.