From patchwork Mon Mar 3 07:43:18 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 3751841 X-Patchwork-Delegate: broonie@sirena.org.uk 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 99C4E9F1EE for ; Mon, 3 Mar 2014 07:47:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 61B9C20394 for ; Mon, 3 Mar 2014 07:47:09 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 301FF203AB for ; Mon, 3 Mar 2014 07:47:08 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 3A4042656F0; Mon, 3 Mar 2014 08:47:07 +0100 (CET) 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 B60432655BE; Mon, 3 Mar 2014 08:43:53 +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 1568B265603; Mon, 3 Mar 2014 08:43:52 +0100 (CET) Received: from mail-pb0-f53.google.com (mail-pb0-f53.google.com [209.85.160.53]) by alsa0.perex.cz (Postfix) with ESMTP id 58CCC2655BC for ; Mon, 3 Mar 2014 08:43:20 +0100 (CET) Received: by mail-pb0-f53.google.com with SMTP id rp16so3422228pbb.40 for ; Sun, 02 Mar 2014 23:43:19 -0800 (PST) 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=2cLjrM7jtYX/w9OeVKPSWoB4Tq444YSv9O+nN3llmaI=; b=fq9CAZUY8SHQbehVft/DkUtYEDrP37d9sp/UVMM6VTzoVrrZh3FnMODgmc/xz/GAoJ RHrEryAA4mVXRL5v7TlZBpo+jXkFcdF0ZeTZaztbDB82ySynU4cATlkLVYn/VAV1LIjJ IXmdpuczPHtOMqK1t0BtxE2eB9cNY7H0CZ5bFFjfv6ZVsVnBP9XdrcwCRDitArWrr4/U yJIvVwXVcT/vSBx88nRPSiySgfnS9h5BIAtqgxT7f8bBGL460QwpjxJlkdOphhezUCem ueOTImbkqg4A28sROmUXKIcZyRiYq+I1curcIZkukdkklv+WgMQPHf8wN2bwuEfi463e UE5w== X-Received: by 10.68.164.229 with SMTP id yt5mr18130970pbb.28.1393832599395; Sun, 02 Mar 2014 23:43:19 -0800 (PST) Received: from morimoto-Dell-XPS420.gmail.com (49.14.32.202.bf.2iij.net. [202.32.14.49]) by mx.google.com with ESMTPSA id ns7sm33024416pbc.32.2014.03.02.23.43.17 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sun, 02 Mar 2014 23:43:18 -0800 (PST) Date: Sun, 02 Mar 2014 23:43:18 -0800 (PST) Message-ID: <87txbfwwvg.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: <871tyjybhr.wl%kuninori.morimoto.gx@gmail.com> References: <87d2ib90t9.wl%kuninori.morimoto.gx@gmail.com> <871tyjybhr.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 5/8] ASoC: rsnd: use function pointer for each probe 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 R-Car sound consists of many devices. It will have more device support in the future. Thus, for each probe become now function pointer array. Signed-off-by: Kuninori Morimoto --- sound/soc/sh/rcar/core.c | 34 ++++++++++++++-------------------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c index 416b078..ea747614 100644 --- a/sound/soc/sh/rcar/core.c +++ b/sound/soc/sh/rcar/core.c @@ -814,7 +814,15 @@ static int rsnd_probe(struct platform_device *pdev) struct rcar_snd_info *info; struct rsnd_priv *priv; struct device *dev = &pdev->dev; - int ret; + int (*probe_func[])(struct platform_device *pdev, + struct rsnd_priv *priv) = { + rsnd_gen_probe, + rsnd_ssi_probe, + rsnd_scu_probe, + rsnd_adg_probe, + rsnd_dai_probe, + }; + int ret, i; info = pdev->dev.platform_data; if (!info) { @@ -838,25 +846,11 @@ static int rsnd_probe(struct platform_device *pdev) /* * init each module */ - ret = rsnd_gen_probe(pdev, priv); - if (ret) - return ret; - - ret = rsnd_ssi_probe(pdev, priv); - if (ret) - return ret; - - ret = rsnd_scu_probe(pdev, priv); - if (ret) - return ret; - - ret = rsnd_adg_probe(pdev, priv); - if (ret) - return ret; - - ret = rsnd_dai_probe(pdev, priv); - if (ret) - return ret; + for (i = 0; i < ARRAY_SIZE(probe_func); i++) { + ret = probe_func[i](pdev, priv); + if (ret) + return ret; + } /* * asoc register