Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jean-Francois Moine <moinejf@free.fr>
To: Jyri Sarha <jsarha@ti.com>
Cc: Xiubo Li <Li.Xiubo@freescale.com>,
	alsa-devel@alsa-project.org, Mark Brown <broonie@kernel.org>,
	linux-kernel@vger.kernel.org,
	Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Subject: Re: [PATCH v3 2/4] ASoC: simple-card: dynamically allocate the DAI link and properties
Date: Mon, 17 Mar 2014 11:23:32 +0100	[thread overview]
Message-ID: <20140317112332.4a0700d8@armhf> (raw)
In-Reply-To: <5326C086.6080609@ti.com>

On Mon, 17 Mar 2014 11:29:42 +0200
Jyri Sarha <jsarha@ti.com> wrote:

> On 03/15/2014 01:09 PM, Jean-Francois Moine wrote:
> > The DAI link array and the properties (fmt, sysclk slots) are
> > hard-coded for a single CPU / CODEC link.
> >
> > This patch dynamically allocates the DAI link array and the
> > properties with the aim of supporting many DAI links.
> >
> > Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
> > ---
> >   sound/soc/generic/simple-card.c | 49 +++++++++++++++++++++++++----------------
> >   1 file changed, 30 insertions(+), 19 deletions(-)
> >
> > diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
> > index ca7e63e..a55dc46 100644
> > --- a/sound/soc/generic/simple-card.c
> > +++ b/sound/soc/generic/simple-card.c
> > @@ -20,9 +20,11 @@
> >
> >   struct simple_card_data {
> >   	struct snd_soc_card snd_card;
> > -	struct asoc_simple_dai cpu_dai;
> > -	struct asoc_simple_dai codec_dai;
> > -	struct snd_soc_dai_link snd_link;
> > +	struct simple_dais {
> > +		struct asoc_simple_dai cpu_dai;
> > +		struct asoc_simple_dai codec_dai;
> > +	} *dais;
> > +	struct snd_soc_dai_link dai_link[];	/* dynamically allocated */
> >   };
> >
> 
> This is only an implementation detail, but wouldn't it produce a cleaner 
> implementation if you would write the above structure like this:
> 
>    struct simple_card_data {
>    	struct snd_soc_card snd_card;
> 	struct simple_dai_links {
> 		struct snd_soc_dai_link dai_link;
> 		struct asoc_simple_dai cpu_dai;
> 		struct asoc_simple_dai codec_dai;
> 	} *dai_links;
>    };
> 
> or even
> 
>    struct simple_card_data {
>    	struct snd_soc_card snd_card;
> 	struct simple_dai_links {
> 		struct snd_soc_dai_link dai_link;
> 		struct asoc_simple_dai cpu_dai;
> 		struct asoc_simple_dai codec_dai;
> 	} dai_links[]; /* dynamically allocated */
>    };
> 
> But, as said this only an implementation detail.

Jyri,

No, this would not work. The DAI link in the struct snd_soc_card is an
array of struct snd_soc_dai_link. There cannot be anything between the
elements!

-- 
Ken ar c'hentañ	|	      ** Breizh ha Linux atav! **
Jef		|		http://moinejf.free.fr/
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

  reply	other threads:[~2014-03-17 10:23 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-15 11:32 [PATCH v3 0/4] ASoC: simple-card: multi DAI links extension Jean-Francois Moine
2014-03-15 10:32 ` [PATCH v3 1/4] ASoC: simple-card: Simplify code Jean-Francois Moine
2014-03-17 16:24   ` Mark Brown
2014-03-15 11:09 ` [PATCH v3 2/4] ASoC: simple-card: dynamically allocate the DAI link and properties Jean-Francois Moine
2014-03-17  9:29   ` [alsa-devel] " Jyri Sarha
2014-03-17 10:23     ` Jean-Francois Moine [this message]
2014-03-17 10:27       ` Jyri Sarha
2014-03-17 16:24   ` Mark Brown
2014-03-18 20:18   ` Mark Brown
2014-03-15 11:26 ` [PATCH v3 3/4] ASoC: simple-card: Handle many DAI links Jean-Francois Moine
2014-03-17 16:29   ` Mark Brown
2014-03-15 11:30 ` [PATCH v3 4/4] ASoC: simple-card: Add DT documentation for multi-DAI links Jean-Francois Moine
     [not found]   ` <d054780a0edf4b2338a52e48bff9144e19aa614f.1394883134.git.moinejf-GANU6spQydw@public.gmane.org>
2014-03-17 10:19     ` [alsa-devel] " Jyri Sarha
2014-03-17 16:43     ` Mark Brown
2014-03-18  8:17       ` Jean-Francois Moine
2014-03-18 10:41         ` Mark Brown
2014-03-19 10:08         ` Jyri Sarha
     [not found]           ` <53296CB7.1000909-l0cyMroinI0@public.gmane.org>
2014-03-19 13:46             ` Mark Brown
2014-03-19 18:32               ` Jyri Sarha
2014-03-19 19:14                 ` Mark Brown
2014-03-19 16:07             ` Jean-Francois Moine
2014-03-19 18:51             ` [alsa-devel] " Lars-Peter Clausen
2014-03-19 19:15               ` Jyri Sarha
     [not found]                 ` <5329ECC2.7040803-l0cyMroinI0@public.gmane.org>
2014-03-19 19:21                   ` Mark Brown
     [not found]                     ` <20140319192157.GW11706-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2014-03-19 19:31                       ` Lars-Peter Clausen
     [not found]                         ` <5329F0A1.8020801-Qo5EllUWu/uELgA04lAiVw@public.gmane.org>
2014-03-20 11:24                           ` Jyri Sarha
2014-03-17  3:49 ` [PATCH v3 0/4] ASoC: simple-card: multi DAI links extension Li.Xiubo

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=20140317112332.4a0700d8@armhf \
    --to=moinejf@free.fr \
    --cc=Li.Xiubo@freescale.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=jsarha@ti.com \
    --cc=kuninori.morimoto.gx@renesas.com \
    --cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox