From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kuninori Morimoto Subject: [PATCH 12/19] ASoC: rsnd: use function pointer for each probe Date: Mon, 24 Feb 2014 22:16:12 -0800 (PST) Message-ID: <87vbw37m53.wl%kuninori.morimoto.gx@gmail.com> References: <87d2ib90t9.wl%kuninori.morimoto.gx@gmail.com> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail-pa0-f43.google.com (mail-pa0-f43.google.com [209.85.220.43]) by alsa0.perex.cz (Postfix) with ESMTP id E3EF526558E for ; Tue, 25 Feb 2014 07:16:13 +0100 (CET) Received: by mail-pa0-f43.google.com with SMTP id rd3so7630220pab.16 for ; Mon, 24 Feb 2014 22:16:12 -0800 (PST) In-Reply-To: <87d2ib90t9.wl%kuninori.morimoto.gx@gmail.com> 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 To: Mark Brown Cc: Linux-ALSA , Simon , Liam Girdwood , Kuninori Morimoto List-Id: alsa-devel@alsa-project.org 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 50047b3..3933ec4 100644 --- a/sound/soc/sh/rcar/core.c +++ b/sound/soc/sh/rcar/core.c @@ -831,7 +831,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) { @@ -855,25 +863,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 -- 1.7.9.5