| From 75f5aa4638c8a5b59058162e7a5f7e96ea5e08b1 Mon Sep 17 00:00:00 2001 |
| From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> |
| Date: Sun, 2 Mar 2014 23:43:18 -0800 |
| Subject: ASoC: rsnd: use function pointer for each probe |
| |
| 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 <kuninori.morimoto.gx@renesas.com> |
| Signed-off-by: Mark Brown <broonie@linaro.org> |
| (cherry picked from commit d1ac970f5de94bef9e094b46f016899d04e8178b) |
| Signed-off-by: Simon Horman <horms+renesas@verge.net.au> |
| --- |
| sound/soc/sh/rcar/core.c | 34 ++++++++++++++-------------------- |
| 1 file changed, 14 insertions(+), 20 deletions(-) |
| |
| --- a/sound/soc/sh/rcar/core.c |
| +++ b/sound/soc/sh/rcar/core.c |
| @@ -813,7 +813,15 @@ static int rsnd_probe(struct platform_de |
| 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) { |
| @@ -837,25 +845,11 @@ static int rsnd_probe(struct platform_de |
| /* |
| * 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 |