From patchwork Wed Sep 10 04:37:57 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 4874141 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 6F6899F32F for ; Wed, 10 Sep 2014 04:38:19 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A3D912017A for ; Wed, 10 Sep 2014 04:38:18 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 77EFB20149 for ; Wed, 10 Sep 2014 04:38:17 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 626FF261A8B; Wed, 10 Sep 2014 06:38:16 +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 6F6C126109E; Wed, 10 Sep 2014 06:38:09 +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 EB0CD2615FC; Wed, 10 Sep 2014 06:38:07 +0200 (CEST) Received: from mail-pd0-f181.google.com (mail-pd0-f181.google.com [209.85.192.181]) by alsa0.perex.cz (Postfix) with ESMTP id 9B795260824 for ; Wed, 10 Sep 2014 06:37:59 +0200 (CEST) Received: by mail-pd0-f181.google.com with SMTP id w10so5336861pde.26 for ; Tue, 09 Sep 2014 21:37:58 -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=1sYKSz32ESOUKQ4sTiFKHBrzvEq/Xf4yqknkSfB+f9M=; b=psfGcZhRIa85khNUrmy3/bTcPBE3yVBXD3heXuxM62pk18UMhUM4MwdjcaABfj7pGV 9kc1/yGxmt54Sq7iu+LfX7pWoLYP5nYC7PiH3rcvDyWevWAeECUfllpK2jcE2UhqV012 pWb8pE6f1OWIPTyLXy4865KUmT+d+6qkCc1AsE1E4sQkLq+reiE8/STj3hpXAtGPr9pM Kx/MHKFOWWTTIBcuae6jagXsH12ScIOArj3QuIeOm1d8xARThYLZ+iWRIwmIpAIJyGHa OQDKsB/NNUD4SmXVUmdXQIUskRypXbGu5lSQUJYXTTdiwnFoI71gkg0fLs+ozbDErLT2 h9+Q== X-Received: by 10.69.26.105 with SMTP id ix9mr35436559pbd.29.1410323878073; Tue, 09 Sep 2014 21:37:58 -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 r7sm5412892pdj.75.2014.09.09.21.37.55 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 09 Sep 2014 21:37:57 -0700 (PDT) Date: Tue, 09 Sep 2014 21:37:57 -0700 (PDT) Message-ID: <87zje8xf8d.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 1/3] ASoC: simple-card: tidyup use priv in parameter 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 priv has many information about simple-card driver. Using it becomes easy to extend feature. This patch gets dev from priv as 1st step Signed-off-by: Kuninori Morimoto --- sound/soc/generic/simple-card.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c index 4053152..b8f3e11 100644 --- a/sound/soc/generic/simple-card.c +++ b/sound/soc/generic/simple-card.c @@ -28,6 +28,8 @@ struct simple_card_data { struct snd_soc_dai_link dai_link[]; /* dynamically allocated */ }; +#define simple_priv_to_dev(priv) ((priv)->snd_card.dev) + static int asoc_simple_card_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) { @@ -171,11 +173,12 @@ asoc_simple_card_sub_parse_of(struct device_node *np, } static int asoc_simple_card_dai_link_of(struct device_node *node, - struct device *dev, + struct simple_card_data *priv, struct snd_soc_dai_link *dai_link, struct simple_dai_props *dai_props, bool is_top_level_node) { + struct device *dev = simple_priv_to_dev(priv); struct device_node *np = NULL; struct device_node *bitclkmaster = NULL; struct device_node *framemaster = NULL; @@ -318,9 +321,9 @@ dai_link_of_err: } static int asoc_simple_card_parse_of(struct device_node *node, - struct simple_card_data *priv, - struct device *dev) + 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; @@ -363,7 +366,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, dev, + ret = asoc_simple_card_dai_link_of(np, priv, dai_link + i, dai_props + i, false); @@ -375,7 +378,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, dev, + ret = asoc_simple_card_dai_link_of(node, priv, dai_link, dai_props, true); if (ret < 0) return ret; @@ -447,7 +450,7 @@ static int asoc_simple_card_probe(struct platform_device *pdev) if (np && of_device_is_available(np)) { - ret = asoc_simple_card_parse_of(np, priv, dev); + ret = asoc_simple_card_parse_of(np, priv); if (ret < 0) { if (ret != -EPROBE_DEFER) dev_err(dev, "parse error %d\n", ret);