From patchwork Wed Feb 19 18:07:41 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Francois Moine X-Patchwork-Id: 3698101 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 2C16DBF13A for ; Fri, 21 Feb 2014 15:35:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E67562018B for ; Fri, 21 Feb 2014 15:35:45 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id C3DE820122 for ; Fri, 21 Feb 2014 15:35:44 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id B2572265928; Fri, 21 Feb 2014 16:35:43 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Status: No, score=-0.6 required=5.0 tests=BAYES_00, DATE_IN_PAST_24_48, FREEMAIL_FROM,UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id C2B60265908; Fri, 21 Feb 2014 16:34:57 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 07FCA265938; Fri, 21 Feb 2014 16:34:56 +0100 (CET) Received: from smtp1-g21.free.fr (smtp1-g21.free.fr [212.27.42.1]) by alsa0.perex.cz (Postfix) with ESMTP id 1A155265908 for ; Fri, 21 Feb 2014 16:34:33 +0100 (CET) Received: from localhost (unknown [IPv6:2a01:e35:2f5c:9de0:212:bfff:fe1e:9ce4]) by smtp1-g21.free.fr (Postfix) with ESMTP id D58DA9400BC; Fri, 21 Feb 2014 16:34:24 +0100 (CET) X-Mailbox-Line: From 41aa7354a6883f31afa60c21c2e14ecbb3bbb7e9 Mon Sep 17 00:00:00 2001 Message-Id: <41aa7354a6883f31afa60c21c2e14ecbb3bbb7e9.1392995566.git.moinejf@free.fr> In-Reply-To: References: From: Jean-Francois Moine Date: Wed, 19 Feb 2014 19:07:41 +0100 To: Mark Brown Cc: alsa-devel@alsa-project.org, Xiubo Li , linux-kernel@vger.kernel.org, Kuninori Morimoto Subject: [alsa-devel] [PATCH 2/4] ASoC: simple-card: dynamically allocate the DAI link array X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP The DAI link array is hard-coded as a single CPU / CODEC DAIs link. This patch allocates this array with the card definition and facilitates handling more links. Signed-off-by: Jean-Francois Moine --- sound/soc/generic/simple-card.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c index 8809ab4..a75a8bb 100644 --- a/sound/soc/generic/simple-card.c +++ b/sound/soc/generic/simple-card.c @@ -20,7 +20,6 @@ struct simple_card_data { unsigned int daifmt; struct asoc_simple_dai cpu_dai; struct asoc_simple_dai codec_dai; - struct snd_soc_dai_link snd_link; }; static int __asoc_simple_card_dai_init(struct snd_soc_dai *dai, @@ -246,7 +245,9 @@ static int asoc_simple_card_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc(dev, + sizeof(*priv) + sizeof(*dai_link), + GFP_KERNEL); if (!priv) return -ENOMEM; @@ -255,7 +256,7 @@ static int asoc_simple_card_probe(struct platform_device *pdev) */ priv->snd_card.owner = THIS_MODULE; priv->snd_card.dev = dev; - dai_link = &priv->snd_link; + dai_link = (struct snd_soc_dai_link *) (priv + 1); priv->snd_card.dai_link = dai_link; priv->snd_card.num_links = 1;