From: Koro Chen <koro.chen@mediatek.com>
To: Lars-Peter Clausen <lars@metafoo.de>
Cc: broonie@kernel.org, perex@perex.cz, tiwai@suse.de,
lgirdwood@gmail.com, alsa-devel@alsa-project.org,
srv_heupstream@mediatek.com, s.hauer@pengutronix.de,
linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org,
p.zabel@pengutronix.de, linux-arm-kernel@lists.infradead.org
Subject: Re: [alsa-devel] [RFC PATCH] ASoC: Modify check condition of multiple bindings of components
Date: Tue, 13 Oct 2015 22:18:22 +0800 [thread overview]
Message-ID: <1444745902.26493.2.camel@mtksdaap41> (raw)
In-Reply-To: <561D0AA9.5080702@metafoo.de>
On Tue, 2015-10-13 at 15:44 +0200, Lars-Peter Clausen wrote:
> On 10/13/2015 03:37 PM, Koro Chen wrote:
> > The patch "ASoC: Prevent components from being bound to multiple cards"
> > adds check to prevent multiple cards from using the same component.
> > However, snd_soc_register_platform() or snd_soc_register_codec() will
> > also create components, and sharing the same platform by multiple cards
> > is then refused. This happens with a platform having multiple
> > independent DAIs that share the same DMA controller.
> >
> > Relax the condition by checking component->registered_as_component,
> > which is only true in case of snd_soc_register_component() and
> > will be false for components created by snd_soc_register_platform()
> > or snd_soc_register_codec().
>
> Binding a component to multiple cards results in internal data structure
> corruption, regardless of whether it is a raw component, CODEC or platform,
> which is why the check was added. So the proposed change wont work.
>
Thanks for your comment. Is it possible to share an example of how the
data structure will be corrupted? So I can study into this further.
> >
> > Signed-off-by: Koro Chen <koro.chen@mediatek.com>
> > ---
> > sound/soc/soc-core.c | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
> > index 42575b0..eca169a 100644
> > --- a/sound/soc/soc-core.c
> > +++ b/sound/soc/soc-core.c
> > @@ -1106,7 +1106,8 @@ static int soc_probe_component(struct snd_soc_card *card,
> > return 0;
> >
> > if (component->card) {
> > - if (component->card != card) {
> > + if (component->card != card &&
> > + component->registered_as_component) {
> > dev_err(component->dev,
> > "Trying to bind component to card \"%s\" but is already bound to card \"%s\"\n",
> > card->name, component->card->name);
> >
>
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
WARNING: multiple messages have this Message-ID (diff)
From: koro.chen@mediatek.com (Koro Chen)
To: linux-arm-kernel@lists.infradead.org
Subject: [alsa-devel] [RFC PATCH] ASoC: Modify check condition of multiple bindings of components
Date: Tue, 13 Oct 2015 22:18:22 +0800 [thread overview]
Message-ID: <1444745902.26493.2.camel@mtksdaap41> (raw)
In-Reply-To: <561D0AA9.5080702@metafoo.de>
On Tue, 2015-10-13 at 15:44 +0200, Lars-Peter Clausen wrote:
> On 10/13/2015 03:37 PM, Koro Chen wrote:
> > The patch "ASoC: Prevent components from being bound to multiple cards"
> > adds check to prevent multiple cards from using the same component.
> > However, snd_soc_register_platform() or snd_soc_register_codec() will
> > also create components, and sharing the same platform by multiple cards
> > is then refused. This happens with a platform having multiple
> > independent DAIs that share the same DMA controller.
> >
> > Relax the condition by checking component->registered_as_component,
> > which is only true in case of snd_soc_register_component() and
> > will be false for components created by snd_soc_register_platform()
> > or snd_soc_register_codec().
>
> Binding a component to multiple cards results in internal data structure
> corruption, regardless of whether it is a raw component, CODEC or platform,
> which is why the check was added. So the proposed change wont work.
>
Thanks for your comment. Is it possible to share an example of how the
data structure will be corrupted? So I can study into this further.
> >
> > Signed-off-by: Koro Chen <koro.chen@mediatek.com>
> > ---
> > sound/soc/soc-core.c | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
> > index 42575b0..eca169a 100644
> > --- a/sound/soc/soc-core.c
> > +++ b/sound/soc/soc-core.c
> > @@ -1106,7 +1106,8 @@ static int soc_probe_component(struct snd_soc_card *card,
> > return 0;
> >
> > if (component->card) {
> > - if (component->card != card) {
> > + if (component->card != card &&
> > + component->registered_as_component) {
> > dev_err(component->dev,
> > "Trying to bind component to card \"%s\" but is already bound to card \"%s\"\n",
> > card->name, component->card->name);
> >
>
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel at alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
WARNING: multiple messages have this Message-ID (diff)
From: Koro Chen <koro.chen@mediatek.com>
To: Lars-Peter Clausen <lars@metafoo.de>
Cc: <broonie@kernel.org>, <perex@perex.cz>, <tiwai@suse.de>,
<lgirdwood@gmail.com>, <alsa-devel@alsa-project.org>,
<srv_heupstream@mediatek.com>, <s.hauer@pengutronix.de>,
<linux-kernel@vger.kernel.org>,
<linux-mediatek@lists.infradead.org>, <p.zabel@pengutronix.de>,
<linux-arm-kernel@lists.infradead.org>
Subject: Re: [alsa-devel] [RFC PATCH] ASoC: Modify check condition of multiple bindings of components
Date: Tue, 13 Oct 2015 22:18:22 +0800 [thread overview]
Message-ID: <1444745902.26493.2.camel@mtksdaap41> (raw)
In-Reply-To: <561D0AA9.5080702@metafoo.de>
On Tue, 2015-10-13 at 15:44 +0200, Lars-Peter Clausen wrote:
> On 10/13/2015 03:37 PM, Koro Chen wrote:
> > The patch "ASoC: Prevent components from being bound to multiple cards"
> > adds check to prevent multiple cards from using the same component.
> > However, snd_soc_register_platform() or snd_soc_register_codec() will
> > also create components, and sharing the same platform by multiple cards
> > is then refused. This happens with a platform having multiple
> > independent DAIs that share the same DMA controller.
> >
> > Relax the condition by checking component->registered_as_component,
> > which is only true in case of snd_soc_register_component() and
> > will be false for components created by snd_soc_register_platform()
> > or snd_soc_register_codec().
>
> Binding a component to multiple cards results in internal data structure
> corruption, regardless of whether it is a raw component, CODEC or platform,
> which is why the check was added. So the proposed change wont work.
>
Thanks for your comment. Is it possible to share an example of how the
data structure will be corrupted? So I can study into this further.
> >
> > Signed-off-by: Koro Chen <koro.chen@mediatek.com>
> > ---
> > sound/soc/soc-core.c | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
> > index 42575b0..eca169a 100644
> > --- a/sound/soc/soc-core.c
> > +++ b/sound/soc/soc-core.c
> > @@ -1106,7 +1106,8 @@ static int soc_probe_component(struct snd_soc_card *card,
> > return 0;
> >
> > if (component->card) {
> > - if (component->card != card) {
> > + if (component->card != card &&
> > + component->registered_as_component) {
> > dev_err(component->dev,
> > "Trying to bind component to card \"%s\" but is already bound to card \"%s\"\n",
> > card->name, component->card->name);
> >
>
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
next prev parent reply other threads:[~2015-10-13 14:18 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-13 13:37 [RFC PATCH] ASoC: Modify check condition of multiple bindings of components Koro Chen
2015-10-13 13:37 ` Koro Chen
2015-10-13 13:37 ` Koro Chen
2015-10-13 13:44 ` Lars-Peter Clausen
2015-10-13 13:44 ` Lars-Peter Clausen
2015-10-13 14:18 ` Koro Chen [this message]
2015-10-13 14:18 ` [alsa-devel] " Koro Chen
2015-10-13 14:18 ` Koro Chen
2015-10-13 14:42 ` Lars-Peter Clausen
2015-10-13 14:42 ` Lars-Peter Clausen
2015-10-14 1:19 ` Koro Chen
2015-10-14 1:19 ` Koro Chen
2015-10-14 1:19 ` Koro Chen
2015-10-14 9:00 ` Lars-Peter Clausen
2015-10-14 9:00 ` Lars-Peter Clausen
2015-10-15 12:10 ` Mark Brown
2015-10-15 12:10 ` Mark Brown
2015-10-15 12:49 ` Koro Chen
2015-10-15 12:49 ` Koro Chen
2015-10-15 12:49 ` Koro Chen
2015-10-15 13:26 ` Lars-Peter Clausen
2015-10-15 13:26 ` Lars-Peter Clausen
2015-10-16 2:31 ` Koro Chen
2015-10-16 2:31 ` [alsa-devel] " Koro Chen
2015-10-16 2:31 ` Koro Chen
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=1444745902.26493.2.camel@mtksdaap41 \
--to=koro.chen@mediatek.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=lars@metafoo.de \
--cc=lgirdwood@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=p.zabel@pengutronix.de \
--cc=perex@perex.cz \
--cc=s.hauer@pengutronix.de \
--cc=srv_heupstream@mediatek.com \
--cc=tiwai@suse.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.