From: Charles Keepax <ckeepax@opensource.cirrus.com>
To: broonie@kernel.org
Cc: alsa-devel@alsa-project.org, ladis@linux-mips.org,
kuninori.morimoto.gx@renesas.com, vinod.koul@intel.com,
lgirdwood@gmail.com, dan.carpenter@oracle.com
Subject: [PATCH 1/3] ASoC: compress: Correct handling of copy callback
Date: Fri, 26 Jan 2018 13:08:43 +0000 [thread overview]
Message-ID: <20180126130845.7122-1-ckeepax@opensource.cirrus.com> (raw)
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>
---
Ok here is the simpler fix that should make it much easier to
either sneak this into 4.15 or at least apply it to stable.
Going to do a little more thinking on the full patch before I
send again that need to really wrap my head around what the
intentions are with trying to enable multiple components to
furfil the same role. If anyone has any thoughts on use cases
etc. for this please do send them on :-)
Thanks,
Charles
sound/soc/soc-compress.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/sound/soc/soc-compress.c b/sound/soc/soc-compress.c
index 81232f4ab614b..7973f92cd40f5 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,
struct snd_soc_platform *platform = rtd->platform;
struct snd_soc_component *component;
struct snd_soc_rtdcom_list *rtdcom;
- int ret = 0, __ret;
+ int ret = 0;
mutex_lock_nested(&rtd->pcm_mutex, rtd->pcm_subclass);
@@ -965,10 +965,10 @@ static int soc_compr_copy(struct snd_compr_stream *cstream,
!component->driver->compr_ops->copy)
continue;
- __ret = component->driver->compr_ops->copy(cstream, buf, count);
- if (__ret < 0)
- ret = __ret;
+ ret = component->driver->compr_ops->copy(cstream, buf, count);
+ break;
}
+
err:
mutex_unlock(&rtd->pcm_mutex);
return ret;
--
2.11.0
next reply other threads:[~2018-01-26 13:08 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-26 13:08 Charles Keepax [this message]
2018-01-26 13:08 ` [PATCH 2/3] ASoC: compress: Remove some extraneous blank lines Charles Keepax
2018-01-26 15:25 ` Applied "ASoC: compress: Remove some extraneous blank lines" to the asoc tree Mark Brown
2018-01-26 13:08 ` [PATCH 3/3] ASoC: compress: Fixup error messages Charles Keepax
2018-01-26 15:25 ` Applied "ASoC: compress: Fixup error messages" to the asoc tree Mark Brown
2018-01-26 15:23 ` Applied "ASoC: compress: Correct handling of copy callback" " Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180126130845.7122-1-ckeepax@opensource.cirrus.com \
--to=ckeepax@opensource.cirrus.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=dan.carpenter@oracle.com \
--cc=kuninori.morimoto.gx@renesas.com \
--cc=ladis@linux-mips.org \
--cc=lgirdwood@gmail.com \
--cc=vinod.koul@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).