From patchwork Wed Sep 10 04:38:24 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 4874151 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 68A38C0338 for ; Wed, 10 Sep 2014 04:39:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 837302017A for ; Wed, 10 Sep 2014 04:39:35 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 574F420149 for ; Wed, 10 Sep 2014 04:39:34 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 53ACB2617AB; Wed, 10 Sep 2014 06:39:33 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 3EBE026262A; Wed, 10 Sep 2014 06:38:56 +0200 (CEST) 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 4DA1A26262A; Wed, 10 Sep 2014 06:38:54 +0200 (CEST) Received: from mail-pa0-f42.google.com (mail-pa0-f42.google.com [209.85.220.42]) by alsa0.perex.cz (Postfix) with ESMTP id CB6202617A5 for ; Wed, 10 Sep 2014 06:38:25 +0200 (CEST) Received: by mail-pa0-f42.google.com with SMTP id lj1so5658291pab.1 for ; Tue, 09 Sep 2014 21:38:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:message-id:from:subject:user-agent:to:cc:in-reply-to :references:mime-version:content-type; bh=+yAtepqOqZaS59VZkXjHTeFdljrhSCrTW/I5Vo8zP7c=; b=XUEaszXPAfW2twlw2Gzk98i/Ae4Nkwvnylu0+Hqzbg+EjxZZwY+TASnCTcs46tPhMF GibeER2WBJiLhr0XZp45aWF5Mj0wlvYRwxMX3/womPh1ujAhRV5vzKg8mu5j/0D8yLB9 S9bgoBn5Zhw7OkQ4/AlusJbw+QZeBPoKm3AoZeLDAUV+pmgp0XUU69qJTxBGfVob/ngP raeF93edin2FkPjjWidqSsUqCOn1ochy/QJHw8A1qZd8ik4o8gdDRJ/IlbblPZbhfm9Q 6msT5FnwBOwpLm+WQmooDjhHFA4DXIOk5BSrA8MNMDarstzVZ+MRG/MotRqQcNwPP46+ ZBEQ== X-Received: by 10.70.94.201 with SMTP id de9mr63603876pdb.103.1410323904967; Tue, 09 Sep 2014 21:38:24 -0700 (PDT) Received: from remon.gmail.com (49.14.32.202.bf.2iij.net. [202.32.14.49]) by mx.google.com with ESMTPSA id k11sm10150125pbq.64.2014.09.09.21.38.22 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 09 Sep 2014 21:38:24 -0700 (PDT) Date: Tue, 09 Sep 2014 21:38:24 -0700 (PDT) Message-ID: <87y4tsxf7m.wl%kuninori.morimoto.gx@gmail.com> From: Kuninori Morimoto User-Agent: Wanderlust/2.14.0 Emacs/23.3 Mule/6.0 To: Mark Brown In-Reply-To: <871trkytuv.wl%kuninori.morimoto.gx@gmail.com> References: <871trkytuv.wl%kuninori.morimoto.gx@gmail.com> MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Cc: Linux-ALSA , Simon , Liam Girdwood , Kuninori Morimoto Subject: [alsa-devel] [PATCH 2/3] ASoC: simple-card: tidyup get dai_link/dai_props from priv 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP From: Kuninori Morimoto It can get dai_link/dai_props pointer from priv + index Signed-off-by: Kuninori Morimoto --- sound/soc/generic/simple-card.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c index b8f3e11..f8e126a 100644 --- a/sound/soc/generic/simple-card.c +++ b/sound/soc/generic/simple-card.c @@ -29,6 +29,8 @@ struct simple_card_data { }; #define simple_priv_to_dev(priv) ((priv)->snd_card.dev) +#define simple_priv_to_link(priv, i) ((priv)->snd_card.dai_link + i) +#define simple_priv_to_props(priv, i) ((priv)->dai_props + i) static int asoc_simple_card_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) @@ -174,11 +176,12 @@ asoc_simple_card_sub_parse_of(struct device_node *np, static int asoc_simple_card_dai_link_of(struct device_node *node, struct simple_card_data *priv, - struct snd_soc_dai_link *dai_link, - struct simple_dai_props *dai_props, + int idx, bool is_top_level_node) { struct device *dev = simple_priv_to_dev(priv); + struct snd_soc_dai_link *dai_link = simple_priv_to_link(priv, idx); + struct simple_dai_props *dai_props = simple_priv_to_props(priv, idx); struct device_node *np = NULL; struct device_node *bitclkmaster = NULL; struct device_node *framemaster = NULL; @@ -324,8 +327,6 @@ static int asoc_simple_card_parse_of(struct device_node *node, struct simple_card_data *priv) { struct device *dev = simple_priv_to_dev(priv); - struct snd_soc_dai_link *dai_link = priv->snd_card.dai_link; - struct simple_dai_props *dai_props = priv->dai_props; u32 val; int ret; @@ -367,9 +368,7 @@ static int asoc_simple_card_parse_of(struct device_node *node, for_each_child_of_node(node, np) { dev_dbg(dev, "\tlink %d:\n", i); ret = asoc_simple_card_dai_link_of(np, priv, - dai_link + i, - dai_props + i, - false); + i, false); if (ret < 0) { of_node_put(np); return ret; @@ -378,8 +377,7 @@ static int asoc_simple_card_parse_of(struct device_node *node, } } else { /* For single DAI link & old style of DT node */ - ret = asoc_simple_card_dai_link_of(node, priv, - dai_link, dai_props, true); + ret = asoc_simple_card_dai_link_of(node, priv, 0, true); if (ret < 0) return ret; }