All of lore.kernel.org
 help / color / mirror / Atom feed
From: "arnaud.mouiche@invoxia.com" <arnaud.mouiche@invoxia.com>
To: alsa-devel@alsa-project.org
Subject: Re: [PATCH] ASoC: dapm: fix prefixed stream name matching in snd_soc_dapm_link_dai_widgets
Date: Fri, 05 Jun 2015 16:12:51 +0200	[thread overview]
Message-ID: <5571AE63.60206@invoxia.com> (raw)
In-Reply-To: <1433511674-29156-1-git-send-email-arnaud.mouiche@invoxia.com>

Please, ignore this patch.

it is incorrect
(line "if (!w->sname || !strstr(w->sname, dai_w->name))" is not removed)

I will send one again.
Arnaud

Le 05/06/2015 15:41, Arnaud Mouiche a écrit :
> commit "ASoC: dapm: Modify widget stream name according to prefix"
> fixed a part of the problem when dai_w->name and w->sname are equal
> before being prefixed.
>
> Remains the case where w->sname is only a sub string of dai_w->name.
>
> For example, TLV320AIC3x codec defines the widget
> 	SND_SOC_DAPM_DAC("Left DAC", "Left Playback", DAC_PWR, 7, 0)
>
> In snd_soc_dapm_link_dai_widgets, we will failed to match
> 	"[prefix] Left Playback"
> with
> 	"[prefix] Playback".
>
> Since dai_w and w necessarily belongs to the same dapm when strstr()
> is called, they necessarily have the same prefix which allow us to
> compare 'w->sname + prefix_len' with  'dai_w->name + prefix_len' directly
> without length check.
>
> Signed-off-by: Arnaud Mouiche <arnaud.mouiche@invoxia.com>
> ---
>   sound/soc/soc-dapm.c | 5 +++++
>   1 file changed, 5 insertions(+)
>
> diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
> index e19a676..7194df4 100644
> --- a/sound/soc/soc-dapm.c
> +++ b/sound/soc/soc-dapm.c
> @@ -3392,6 +3392,9 @@ int snd_soc_dapm_link_dai_widgets(struct snd_soc_card *card)
>   
>   	/* For each DAI widget... */
>   	list_for_each_entry(dai_w, &card->widgets, list) {
> +		const char *prefix = soc_dapm_prefix(dai_w->dapm);
> +		size_t prefix_len = prefix ? strlen(prefix)+1 : 0;
> +
>   		switch (dai_w->id) {
>   		case snd_soc_dapm_dai_in:
>   		case snd_soc_dapm_dai_out:
> @@ -3416,6 +3419,8 @@ int snd_soc_dapm_link_dai_widgets(struct snd_soc_card *card)
>   			}
>   
>   			if (!w->sname || !strstr(w->sname, dai_w->name))
> +			if (!w->sname ||
> +			    !strstr(w->sname + prefix_len, dai_w->name + prefix_len))
>   				continue;
>   
>   			if (dai_w->id == snd_soc_dapm_dai_in) {

      reply	other threads:[~2015-06-05 14:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-05 13:41 [PATCH] ASoC: dapm: fix prefixed stream name matching in snd_soc_dapm_link_dai_widgets Arnaud Mouiche
2015-06-05 14:12 ` arnaud.mouiche [this message]

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=5571AE63.60206@invoxia.com \
    --to=arnaud.mouiche@invoxia.com \
    --cc=alsa-devel@alsa-project.org \
    /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.