As a requirement of multicodec changes, we need a platform device for each CODEC. Instead of add that in machine init code, do it here so a new device is added only if we choose to use it.
Signed-off-by: Seungwhan Youn sw.youn@samsung.com Reviewed-by: Jassi Brar jassi.brar@samsung.com --- sound/soc/s3c24xx/smdk_wm9713.c | 22 +++++++++++++++++++--- 1 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/sound/soc/s3c24xx/smdk_wm9713.c b/sound/soc/s3c24xx/smdk_wm9713.c index 001c2dd..f8aed14 100644 --- a/sound/soc/s3c24xx/smdk_wm9713.c +++ b/sound/soc/s3c24xx/smdk_wm9713.c @@ -60,22 +60,38 @@ static struct snd_soc_card smdk = { .num_links = 1, };
+static struct platform_device *smdk_snd_wm9713_device; static struct platform_device *smdk_snd_ac97_device;
static int __init smdk_init(void) { int ret;
- smdk_snd_ac97_device = platform_device_alloc("soc-audio", -1); - if (!smdk_snd_ac97_device) + smdk_snd_wm9713_device = platform_device_alloc("wm9713-codec", -1); + if (!smdk_snd_wm9713_device) return -ENOMEM;
+ ret = platform_device_add(smdk_snd_wm9713_device); + if (ret) + goto err; + + smdk_snd_ac97_device = platform_device_alloc("soc-audio", -1); + if (!smdk_snd_ac97_device) { + ret = -ENOMEM; + goto err; + } + platform_set_drvdata(smdk_snd_ac97_device, &smdk);
ret = platform_device_add(smdk_snd_ac97_device); - if (ret) + if (ret) { platform_device_put(smdk_snd_ac97_device); + goto err; + }
+ return 0; +err: + platform_device_put(smdk_snd_wm9713_device); return ret; }