summaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorCharles Keepax <ckeepax@opensource.cirrus.com>2018-01-26 08:08:43 -0500
committerMark Brown <broonie@kernel.org>2018-01-26 10:22:52 -0500
commit290df4d3ab192821b66857c05346b23056ee9545 (patch)
tree3002381419f36498d97398aee64a5347acabbc0d /sound
parent4fbd8d194f06c8a3fd2af1ce560ddb31f7ec8323 (diff)
ASoC: compress: Correct handling of copy callback
The soc_compr_copy callback is currently broken. Since the changes to move the compr_ops over to the component the return value is not correctly propagated, always returning zero on success rather than the number of bytes copied. This causes user-space to stall continuously reading as it does not believe it has received any data. Furthermore, the changes to move the compr_ops over to the component iterate through the list of components and will call the copy callback for any that have compressed ops. There isn't currently any consensus on the mechanism to combine the results of multiple copy callbacks. To fix this issue for now halt searching the component list when we locate a copy callback and return the result of that single callback. Additional work should probably be done to look at the other ops, tidy things up, and work out if we want to support multiple components on a single compressed, but this is the only fix required to get things working again. Fixes: 9e7e3738ab0e ("ASoC: snd_soc_component_driver has snd_compr_ops") Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> Signed-off-by: Mark Brown <broonie@kernel.org> Cc: stable@vger.kernel.org
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/soc-compress.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sound/soc/soc-compress.c b/sound/soc/soc-compress.c
index d9b1e6417fb9..1507117d1185 100644
--- a/sound/soc/soc-compress.c
+++ b/sound/soc/soc-compress.c
@@ -944,7 +944,7 @@ static int soc_compr_copy(struct snd_compr_stream *cstream,
944 struct snd_soc_platform *platform = rtd->platform; 944 struct snd_soc_platform *platform = rtd->platform;
945 struct snd_soc_component *component; 945 struct snd_soc_component *component;
946 struct snd_soc_rtdcom_list *rtdcom; 946 struct snd_soc_rtdcom_list *rtdcom;
947 int ret = 0, __ret; 947 int ret = 0;
948 948
949 mutex_lock_nested(&rtd->pcm_mutex, rtd->pcm_subclass); 949 mutex_lock_nested(&rtd->pcm_mutex, rtd->pcm_subclass);
950 950
@@ -965,10 +965,10 @@ static int soc_compr_copy(struct snd_compr_stream *cstream,
965 !component->driver->compr_ops->copy) 965 !component->driver->compr_ops->copy)
966 continue; 966 continue;
967 967
968 __ret = component->driver->compr_ops->copy(cstream, buf, count); 968 ret = component->driver->compr_ops->copy(cstream, buf, count);
969 if (__ret < 0) 969 break;
970 ret = __ret;
971 } 970 }
971
972err: 972err:
973 mutex_unlock(&rtd->pcm_mutex); 973 mutex_unlock(&rtd->pcm_mutex);
974 return ret; 974 return ret;