From patchwork Fri May 9 00:43:26 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 4139701 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 B3F489F23C for ; Fri, 9 May 2014 00:44:05 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EDF5B202EA for ; Fri, 9 May 2014 00:44:04 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id CAA0C202E9 for ; Fri, 9 May 2014 00:44:03 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id D4EF4265572; Fri, 9 May 2014 02:44:02 +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, NO_DNS_FOR_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 A9C5D265555; Fri, 9 May 2014 02:43:46 +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 ECC6226556F; Fri, 9 May 2014 02:43:45 +0200 (CEST) Received: from mail-pd0-f171.google.com (mail-pd0-f171.google.com [209.85.192.171]) by alsa0.perex.cz (Postfix) with ESMTP id 06245265555 for ; Fri, 9 May 2014 02:43:28 +0200 (CEST) Received: by mail-pd0-f171.google.com with SMTP id r10so2982443pdi.30 for ; Thu, 08 May 2014 17:43:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:message-id:from:to:cc:in-reply-to:references:subject :user-agent:mime-version:content-type; bh=NaJbU/VbCwBtUaSpbrDTeSLH6Fzh+2aDIFepBH0Ml4Q=; b=k8CpET5i0Pxpn/tiTpPuAGfrmsvNJEHEqfS7vCj1vF4fqPYj3kG6grKo9KvG2e1ans 9vCXkXIEkpbJjSXtatFDVbHHD5odsFRj/01nnWbT70Y1GZd9O72NZpNqAI+79bqKdgFL pPkMoiKEBucZkJ9xC6s0W/8PkvkFGxa0nsJJp6KuoKJR3YaBiJwdS2PTflpYJWWRub7e Xj0MU2bFrPUynFyXKKzlB6cZftHhymNXvELunq4Log7aS3laxIyFj6dNyH2AJcN6op1x 0L15Nb70Ancaw6U0mpvmmkNWwPtj6Nrlr3Nx26lvOSwRjOXCMYU1wULnT5VYWnQ0Wegi 8bdA== X-Received: by 10.66.231.40 with SMTP id td8mr13546496pac.103.1399596207348; Thu, 08 May 2014 17:43:27 -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 ox3sm4165353pbb.88.2014.05.08.17.43.25 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 08 May 2014 17:43:26 -0700 (PDT) Date: Thu, 08 May 2014 17:43:26 -0700 (PDT) Message-ID: <87r443aij7.wl%kuninori.morimoto.gx@gmail.com> From: Kuninori Morimoto To: Mark Brown In-Reply-To: <87siojaike.wl%kuninori.morimoto.gx@gmail.com> References: <87siojaike.wl%kuninori.morimoto.gx@gmail.com> User-Agent: Wanderlust/2.14.0 Emacs/23.3 Mule/6.0 MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Cc: Linux-ALSA , Simon , Liam Girdwood Subject: [alsa-devel] [PATCH 1/5] ASoC: rsnd: add rsnd_path_parse() macro 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 Current R-Car sound supports only SRC/SSI, but, other module will be supported. This patch adds rsnd_path_parse() macro to share code Signed-off-by: Kuninori Morimoto --- sound/soc/sh/rcar/core.c | 43 ++++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c index 8ed8470..f74d02c 100644 --- a/sound/soc/sh/rcar/core.c +++ b/sound/soc/sh/rcar/core.c @@ -576,14 +576,27 @@ static const struct snd_soc_dai_ops rsnd_soc_dai_ops = { .set_fmt = rsnd_soc_dai_set_fmt, }; +#define rsnd_path_parse(priv, io, type) \ +({ \ + struct rsnd_mod *mod; \ + int ret = 0; \ + int id = -1; \ + \ + if (rsnd_is_enable_path(io, type)) { \ + id = rsnd_info_id(priv, io, type); \ + if (id >= 0) { \ + mod = rsnd_##type##_mod_get(priv, id); \ + ret = rsnd_dai_connect(mod, io); \ + } \ + } \ + ret; \ +}) + static int rsnd_path_init(struct rsnd_priv *priv, struct rsnd_dai *rdai, struct rsnd_dai_stream *io) { - struct rsnd_mod *mod; int ret; - int ssi_id = -1; - int src_id = -1; /* * Gen1 is created by SRU/SSI, and this SRU is base module of @@ -595,28 +608,16 @@ static int rsnd_path_init(struct rsnd_priv *priv, * Gen2 SCU path is very flexible, but, Gen1 SRU (SCU parts) is * using fixed path. */ - if (rsnd_is_enable_path(io, ssi)) - ssi_id = rsnd_info_id(priv, io, ssi); - if (rsnd_is_enable_path(io, src)) - src_id = rsnd_info_id(priv, io, src); - - ret = 0; /* SRC */ - if (src_id >= 0) { - mod = rsnd_src_mod_get(priv, src_id); - ret = rsnd_dai_connect(mod, io); - if (ret < 0) - return ret; - } + ret = rsnd_path_parse(priv, io, src); + if (ret < 0) + return ret; /* SSI */ - if (ssi_id >= 0) { - mod = rsnd_ssi_mod_get(priv, ssi_id); - ret = rsnd_dai_connect(mod, io); - if (ret < 0) - return ret; - } + ret = rsnd_path_parse(priv, io, ssi); + if (ret < 0) + return ret; return ret; }