From patchwork Thu Aug 28 07:00:47 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Horman X-Patchwork-Id: 4798021 Return-Path: X-Original-To: patchwork-ltsi-dev@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 0A82DC0338 for ; Thu, 28 Aug 2014 08:15:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 08E762012E for ; Thu, 28 Aug 2014 08:15:50 +0000 (UTC) Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1FD7C200F0 for ; Thu, 28 Aug 2014 08:15:49 +0000 (UTC) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 0D4ED1345; Thu, 28 Aug 2014 07:31:51 +0000 (UTC) X-Original-To: ltsi-dev@lists.linuxfoundation.org Delivered-To: ltsi-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 560CF1320 for ; Thu, 28 Aug 2014 07:31:45 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from kirsty.vergenet.net (kirsty.vergenet.net [202.4.237.240]) by smtp1.linuxfoundation.org (Postfix) with ESMTP id 97B5D1F88A for ; Thu, 28 Aug 2014 07:31:44 +0000 (UTC) Received: from ayumi.isobedori.kobe.vergenet.net (p4222-ipbfp1605kobeminato.hyogo.ocn.ne.jp [114.154.95.222]) by kirsty.vergenet.net (Postfix) with ESMTP id 6084D267350; Thu, 28 Aug 2014 17:08:38 +1000 (EST) Received: by ayumi.isobedori.kobe.vergenet.net (Postfix, from userid 7100) id D3C55EDE5ED; Thu, 28 Aug 2014 16:08:36 +0900 (JST) From: Simon Horman To: ltsi-dev@lists.linuxfoundation.org Date: Thu, 28 Aug 2014 16:00:47 +0900 Message-Id: <1409209620-24487-522-git-send-email-horms+renesas@verge.net.au> X-Mailer: git-send-email 2.0.1 In-Reply-To: <1409209620-24487-1-git-send-email-horms+renesas@verge.net.au> References: <1409209620-24487-1-git-send-email-horms+renesas@verge.net.au> X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org Cc: Magnus Damm Subject: [LTSI-dev] [PATCH LTSI-3.14 521/894] ASoC: simple-card: simplify code X-BeenThere: ltsi-dev@lists.linuxfoundation.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: "A list to discuss patches, development, and other things related to the LTSI project" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ltsi-dev-bounces@lists.linuxfoundation.org Errors-To: ltsi-dev-bounces@lists.linuxfoundation.org X-Virus-Scanned: ClamAV using ClamSMTP From: Jean-Francois Moine Have a cleaner code using a DAI link pointer. Signed-off-by: Jean-Francois Moine Signed-off-by: Mark Brown (cherry picked from commit 5ca8ba4180a6f629d51dba699b4a6428cc5eeba7) Signed-off-by: Simon Horman --- sound/soc/generic/simple-card.c | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c index 89f83b3..797696f 100644 --- a/sound/soc/generic/simple-card.c +++ b/sound/soc/generic/simple-card.c @@ -123,6 +123,7 @@ static int asoc_simple_card_parse_of(struct device_node *node, struct asoc_simple_card_info *info, struct device *dev) { + struct snd_soc_dai_link *dai_link = info->snd_card.dai_link; struct device_node *np; char *name; int ret; @@ -145,7 +146,7 @@ static int asoc_simple_card_parse_of(struct device_node *node, if (np) ret = asoc_simple_card_sub_parse_of(np, &info->cpu_dai, - &info->snd_link.cpu_of_node); + &dai_link->cpu_of_node); if (ret < 0) return ret; @@ -155,7 +156,7 @@ static int asoc_simple_card_parse_of(struct device_node *node, if (np) ret = asoc_simple_card_sub_parse_of(np, &info->codec_dai, - &info->snd_link.codec_of_node); + &dai_link->codec_of_node); if (ret < 0) return ret; @@ -169,10 +170,10 @@ static int asoc_simple_card_parse_of(struct device_node *node, GFP_KERNEL); sprintf(name, "%s-%s", info->cpu_dai.name, info->codec_dai.name); info->snd_card.name = name; - info->snd_link.name = info->snd_link.stream_name = name; + dai_link->name = dai_link->stream_name = name; /* simple-card assumes platform == cpu */ - info->snd_link.platform_of_node = info->snd_link.cpu_of_node; + dai_link->platform_of_node = dai_link->cpu_of_node; dev_dbg(dev, "card-name : %s\n", name); dev_dbg(dev, "platform : %04x\n", info->daifmt); @@ -191,6 +192,7 @@ static int asoc_simple_card_parse_of(struct device_node *node, static int asoc_simple_card_probe(struct platform_device *pdev) { struct asoc_simple_card_info *cinfo; + struct snd_soc_dai_link *dai_link; struct device_node *np = pdev->dev.of_node; struct device *dev = &pdev->dev; int ret; @@ -204,8 +206,9 @@ static int asoc_simple_card_probe(struct platform_device *pdev) */ cinfo->snd_card.owner = THIS_MODULE; cinfo->snd_card.dev = dev; - cinfo->snd_card.dai_link = &cinfo->snd_link; - cinfo->snd_card.num_links = 1; + dai_link = &cinfo->snd_link; + cinfo->snd_card.dai_link = dai_link; + cinfo->snd_card.num_links = 1; if (np && of_device_is_available(np)) { @@ -233,18 +236,18 @@ static int asoc_simple_card_probe(struct platform_device *pdev) } cinfo->snd_card.name = cinfo->card; - cinfo->snd_link.name = cinfo->name; - cinfo->snd_link.stream_name = cinfo->name; - cinfo->snd_link.platform_name = cinfo->platform; - cinfo->snd_link.codec_name = cinfo->codec; + dai_link->name = cinfo->name; + dai_link->stream_name = cinfo->name; + dai_link->platform_name = cinfo->platform; + dai_link->codec_name = cinfo->codec; } /* * init snd_soc_dai_link */ - cinfo->snd_link.cpu_dai_name = cinfo->cpu_dai.name; - cinfo->snd_link.codec_dai_name = cinfo->codec_dai.name; - cinfo->snd_link.init = asoc_simple_card_dai_init; + dai_link->cpu_dai_name = cinfo->cpu_dai.name; + dai_link->codec_dai_name = cinfo->codec_dai.name; + dai_link->init = asoc_simple_card_dai_init; snd_soc_card_set_drvdata(&cinfo->snd_card, cinfo);