]> git.hungrycats.org Git - linux/commitdiff
ASoC: rsnd: avoid pointless loop in rsnd_mod_interrupt()
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Mon, 26 Oct 2015 08:41:53 +0000 (08:41 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 30 Aug 2017 08:19:28 +0000 (10:19 +0200)
commit 2daf71ad8da6cb57f919c9c876ee7e42530371df upstream.

Current Renesas sound driver doesn't have 1:1 relationship between
stream <-> mod because it is supporting MIX. Because of this reason
rsnd_mod_interrupt() is searching correspond mod by for loop.
But this loop is not needed, because each mod has own type.
This patch avoid pointless loop by using mod->type.

This patch is good for SSI-parent support, because stream might have
2 SSI as SSI-parent/child. SSI interrupt handler will be called twice
if stream has SSI-parent without this patch.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Thong Ho <thong.ho.px@rvc.renesas.com>
Signed-off-by: Nhan Nguyen <nhan.nguyen.yb@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
sound/soc/sh/rcar/core.c

index deed48ef28b832821010f7192961aaa9af4ba84b..10b93991ae97bd99efa07bf8eb091626509a8c08 100644 (file)
@@ -192,19 +192,16 @@ void rsnd_mod_interrupt(struct rsnd_mod *mod,
        struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
        struct rsnd_dai_stream *io;
        struct rsnd_dai *rdai;
-       int i, j;
-
-       for_each_rsnd_dai(rdai, priv, j) {
+       int i;
 
-               for (i = 0; i < RSND_MOD_MAX; i++) {
-                       io = &rdai->playback;
-                       if (mod == io->mod[i])
-                               callback(mod, io);
+       for_each_rsnd_dai(rdai, priv, i) {
+               io = &rdai->playback;
+               if (mod == io->mod[mod->type])
+                       callback(mod, io);
 
-                       io = &rdai->capture;
-                       if (mod == io->mod[i])
-                               callback(mod, io);
-               }
+               io = &rdai->capture;
+               if (mod == io->mod[mod->type])
+                       callback(mod, io);
        }
 }