diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2015-04-10 04:49:49 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2015-04-27 15:57:38 -0400 |
commit | e9c390df671fadc829550935ffb6b23549f26ded (patch) | |
tree | 61669925f96241c05e861886b3ab84a8a24e86c5 | |
parent | eb2535f542b4279b42518d6a312c6f7290434e55 (diff) |
ASoC: rsnd: make sure it uses lock when it calls rsnd_dai_call
rsnd_dai_call() should be called under rsnd_lock
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r-- | sound/soc/sh/rcar/core.c | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c index a2a0b5768c44..164653c0bc10 100644 --- a/sound/soc/sh/rcar/core.c +++ b/sound/soc/sh/rcar/core.c | |||
@@ -731,10 +731,15 @@ static int rsnd_hw_params(struct snd_pcm_substream *substream, | |||
731 | { | 731 | { |
732 | struct snd_soc_dai *dai = rsnd_substream_to_dai(substream); | 732 | struct snd_soc_dai *dai = rsnd_substream_to_dai(substream); |
733 | struct rsnd_dai *rdai = rsnd_dai_to_rdai(dai); | 733 | struct rsnd_dai *rdai = rsnd_dai_to_rdai(dai); |
734 | struct rsnd_priv *priv = rsnd_dai_to_priv(dai); | ||
734 | struct rsnd_dai_stream *io = rsnd_rdai_to_io(rdai, substream); | 735 | struct rsnd_dai_stream *io = rsnd_rdai_to_io(rdai, substream); |
736 | unsigned long flags; | ||
735 | int ret; | 737 | int ret; |
736 | 738 | ||
739 | rsnd_lock(priv, flags); | ||
737 | ret = rsnd_dai_call(hw_params, io, substream, hw_params); | 740 | ret = rsnd_dai_call(hw_params, io, substream, hw_params); |
741 | rsnd_unlock(priv, flags); | ||
742 | |||
738 | if (ret) | 743 | if (ret) |
739 | return ret; | 744 | return ret; |
740 | 745 | ||
@@ -919,14 +924,16 @@ int rsnd_kctrl_new_e(struct rsnd_mod *mod, | |||
919 | static int rsnd_pcm_new(struct snd_soc_pcm_runtime *rtd) | 924 | static int rsnd_pcm_new(struct snd_soc_pcm_runtime *rtd) |
920 | { | 925 | { |
921 | struct snd_soc_dai *dai = rtd->cpu_dai; | 926 | struct snd_soc_dai *dai = rtd->cpu_dai; |
927 | struct rsnd_priv *priv = rsnd_dai_to_priv(dai); | ||
922 | struct rsnd_dai *rdai = rsnd_dai_to_rdai(dai); | 928 | struct rsnd_dai *rdai = rsnd_dai_to_rdai(dai); |
923 | int ret; | 929 | unsigned long flags; |
930 | int ret = 0; | ||
924 | 931 | ||
925 | ret = rsnd_dai_call(pcm_new, &rdai->playback, rtd); | 932 | rsnd_lock(priv, flags); |
926 | if (ret) | 933 | ret |= rsnd_dai_call(pcm_new, &rdai->playback, rtd); |
927 | return ret; | 934 | ret |= rsnd_dai_call(pcm_new, &rdai->capture, rtd); |
935 | rsnd_unlock(priv, flags); | ||
928 | 936 | ||
929 | ret = rsnd_dai_call(pcm_new, &rdai->capture, rtd); | ||
930 | if (ret) | 937 | if (ret) |
931 | return ret; | 938 | return ret; |
932 | 939 | ||
@@ -949,8 +956,11 @@ static const struct snd_soc_component_driver rsnd_soc_component = { | |||
949 | static int rsnd_rdai_continuance_probe(struct rsnd_priv *priv, | 956 | static int rsnd_rdai_continuance_probe(struct rsnd_priv *priv, |
950 | struct rsnd_dai_stream *io) | 957 | struct rsnd_dai_stream *io) |
951 | { | 958 | { |
959 | unsigned long flags; | ||
952 | int ret; | 960 | int ret; |
953 | 961 | ||
962 | rsnd_lock(priv, flags); | ||
963 | |||
954 | ret = rsnd_dai_call(probe, io, priv); | 964 | ret = rsnd_dai_call(probe, io, priv); |
955 | if (ret == -EAGAIN) { | 965 | if (ret == -EAGAIN) { |
956 | /* | 966 | /* |
@@ -983,6 +993,7 @@ static int rsnd_rdai_continuance_probe(struct rsnd_priv *priv, | |||
983 | */ | 993 | */ |
984 | ret = rsnd_dai_call(probe, io, priv); | 994 | ret = rsnd_dai_call(probe, io, priv); |
985 | } | 995 | } |
996 | rsnd_unlock(priv, flags); | ||
986 | 997 | ||
987 | return ret; | 998 | return ret; |
988 | } | 999 | } |
@@ -998,6 +1009,7 @@ static int rsnd_probe(struct platform_device *pdev) | |||
998 | struct rsnd_dai *rdai; | 1009 | struct rsnd_dai *rdai; |
999 | const struct of_device_id *of_id = of_match_device(rsnd_of_match, dev); | 1010 | const struct of_device_id *of_id = of_match_device(rsnd_of_match, dev); |
1000 | const struct rsnd_of_data *of_data; | 1011 | const struct rsnd_of_data *of_data; |
1012 | unsigned long flags; | ||
1001 | int (*probe_func[])(struct platform_device *pdev, | 1013 | int (*probe_func[])(struct platform_device *pdev, |
1002 | const struct rsnd_of_data *of_data, | 1014 | const struct rsnd_of_data *of_data, |
1003 | struct rsnd_priv *priv) = { | 1015 | struct rsnd_priv *priv) = { |
@@ -1084,10 +1096,12 @@ static int rsnd_probe(struct platform_device *pdev) | |||
1084 | exit_snd_soc: | 1096 | exit_snd_soc: |
1085 | snd_soc_unregister_platform(dev); | 1097 | snd_soc_unregister_platform(dev); |
1086 | exit_snd_probe: | 1098 | exit_snd_probe: |
1099 | rsnd_lock(priv, flags); | ||
1087 | for_each_rsnd_dai(rdai, priv, i) { | 1100 | for_each_rsnd_dai(rdai, priv, i) { |
1088 | rsnd_dai_call(remove, &rdai->playback, priv); | 1101 | rsnd_dai_call(remove, &rdai->playback, priv); |
1089 | rsnd_dai_call(remove, &rdai->capture, priv); | 1102 | rsnd_dai_call(remove, &rdai->capture, priv); |
1090 | } | 1103 | } |
1104 | rsnd_unlock(priv, flags); | ||
1091 | 1105 | ||
1092 | return ret; | 1106 | return ret; |
1093 | } | 1107 | } |
@@ -1096,6 +1110,7 @@ static int rsnd_remove(struct platform_device *pdev) | |||
1096 | { | 1110 | { |
1097 | struct rsnd_priv *priv = dev_get_drvdata(&pdev->dev); | 1111 | struct rsnd_priv *priv = dev_get_drvdata(&pdev->dev); |
1098 | struct rsnd_dai *rdai; | 1112 | struct rsnd_dai *rdai; |
1113 | unsigned long flags; | ||
1099 | void (*remove_func[])(struct platform_device *pdev, | 1114 | void (*remove_func[])(struct platform_device *pdev, |
1100 | struct rsnd_priv *priv) = { | 1115 | struct rsnd_priv *priv) = { |
1101 | rsnd_ssi_remove, | 1116 | rsnd_ssi_remove, |
@@ -1106,10 +1121,12 @@ static int rsnd_remove(struct platform_device *pdev) | |||
1106 | 1121 | ||
1107 | pm_runtime_disable(&pdev->dev); | 1122 | pm_runtime_disable(&pdev->dev); |
1108 | 1123 | ||
1124 | rsnd_lock(priv, flags); | ||
1109 | for_each_rsnd_dai(rdai, priv, i) { | 1125 | for_each_rsnd_dai(rdai, priv, i) { |
1110 | ret |= rsnd_dai_call(remove, &rdai->playback, priv); | 1126 | ret |= rsnd_dai_call(remove, &rdai->playback, priv); |
1111 | ret |= rsnd_dai_call(remove, &rdai->capture, priv); | 1127 | ret |= rsnd_dai_call(remove, &rdai->capture, priv); |
1112 | } | 1128 | } |
1129 | rsnd_unlock(priv, flags); | ||
1113 | 1130 | ||
1114 | for (i = 0; i < ARRAY_SIZE(remove_func); i++) | 1131 | for (i = 0; i < ARRAY_SIZE(remove_func); i++) |
1115 | remove_func[i](pdev, priv); | 1132 | remove_func[i](pdev, priv); |