ASoC: core: Don't schedule deferred_resume_work twice
commitc4e133f4e253b57e5d4409964a3b51f2d887e94b
authorStephen Warren <swarren@nvidia.com>
Wed, 25 May 2011 20:06:41 +0000 (25 14:06 -0600)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 21 Dec 2011 20:57:48 +0000 (21 12:57 -0800)
treef7d96d1e5d7ba32e921e1b30824f6a4882762db5
parent5dfcd4d5e36784b14071bbe5e42947d3e8bf1c69
ASoC: core: Don't schedule deferred_resume_work twice

commit 82e14e8bdd88b69018fe757192b01dd98582905e upstream.

For cards that have two or more DAIs, snd_soc_resume's loop over all
DAIs ends up calling schedule_work(deferred_resume_work) once per DAI.
Since this is the same work item each time, the 2nd and subsequent
calls return 0 (work item already queued), and trigger the dev_err
message below stating that a work item may have been lost.

Solve this by adjusting the loop to simply calculate whether to run the
resume work immediately or defer it, and then call schedule work (or not)
one time based on that.

Note: This has not been tested in mainline, but only in chromeos-2.6.38;
mainline doesn't support suspend/resume on Tegra, nor does the mainline
Tegra ASoC driver contain multiple DAIs. It has been compile-checked in
mainline.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
sound/soc/soc-core.c