lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5326C086.6080609@ti.com>
Date:	Mon, 17 Mar 2014 11:29:42 +0200
From:	Jyri Sarha <jsarha@...com>
To:	Jean-Francois Moine <moinejf@...e.fr>,
	Mark Brown <broonie@...nel.org>
CC:	<alsa-devel@...a-project.org>, Xiubo Li <Li.Xiubo@...escale.com>,
	<linux-kernel@...r.kernel.org>,
	Kuninori Morimoto <kuninori.morimoto.gx@...esas.com>
Subject: Re: [alsa-devel] [PATCH v3 2/4] ASoC: simple-card: dynamically allocate
 the DAI link and properties

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@...e.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.

Best regards,
Jyri
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ