ASoC: rsnd: count .probe/.remove for rsnd_mod_call()
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Thu, 28 Apr 2016 01:49:48 +0000 (01:49 +0000)
committerMark Brown <broonie@kernel.org>
Thu, 28 Apr 2016 09:46:47 +0000 (10:46 +0100)
Current rsnd_mod_call is counting its calling count to avoid unbalanced
function pair calling for error cases (ex init <-> quit).
SSI parent is now controlled as "mod" on current rsnd driver. Because of
this reason, SSI .remove function will be called twice if it was used as
SSI parent when user tried unbind. But probe/remove pair were not
counted. This patch counts probe/remove functions to avoid it.
Special thans Hiep

Reported-by: Hiep Cao Minh <cm-hiep@jinso.co.jp>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/sh/rcar/rsnd.h

index fc89a67..a8f61d7 100644 (file)
@@ -276,8 +276,9 @@ struct rsnd_mod {
 /*
  * status
  *
- * 0xH0000CB0
+ * 0xH0000CBA
  *
+ * A   0: probe        1: remove
  * B   0: init         1: quit
  * C   0: start        1: stop
  *
@@ -287,19 +288,19 @@ struct rsnd_mod {
  * H   0: fallback
  * H   0: hw_params
  */
+#define __rsnd_mod_shift_probe         0
+#define __rsnd_mod_shift_remove                0
 #define __rsnd_mod_shift_init          4
 #define __rsnd_mod_shift_quit          4
 #define __rsnd_mod_shift_start         8
 #define __rsnd_mod_shift_stop          8
-#define __rsnd_mod_shift_probe         28 /* always called */
-#define __rsnd_mod_shift_remove                28 /* always called */
 #define __rsnd_mod_shift_irq           28 /* always called */
 #define __rsnd_mod_shift_pcm_new       28 /* always called */
 #define __rsnd_mod_shift_fallback      28 /* always called */
 #define __rsnd_mod_shift_hw_params     28 /* always called */
 
-#define __rsnd_mod_add_probe           0
-#define __rsnd_mod_add_remove          0
+#define __rsnd_mod_add_probe            1
+#define __rsnd_mod_add_remove          -1
 #define __rsnd_mod_add_init             1
 #define __rsnd_mod_add_quit            -1
 #define __rsnd_mod_add_start            1
@@ -310,7 +311,7 @@ struct rsnd_mod {
 #define __rsnd_mod_add_hw_params       0
 
 #define __rsnd_mod_call_probe          0
-#define __rsnd_mod_call_remove         0
+#define __rsnd_mod_call_remove         1
 #define __rsnd_mod_call_init           0
 #define __rsnd_mod_call_quit           1
 #define __rsnd_mod_call_start          0