diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-03-04 00:24:39 +0100 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-03-04 02:56:06 +0100 |
commit | 2bc16ed8e02ba39dc5010b4a2b2a606e4b87abbd (patch) | |
tree | 09f3596446f39f83ee1a5c4519e00dac02c6ace2 /sound/soc | |
parent | ASoC: core: Log a warning when machines use soc-audio (diff) | |
download | linux-2bc16ed8e02ba39dc5010b4a2b2a606e4b87abbd.tar.xz linux-2bc16ed8e02ba39dc5010b4a2b2a606e4b87abbd.zip |
ASoC: wm8994: Push wm8994 private data allocation out into device probe
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc')
-rw-r--r-- | sound/soc/codecs/wm8994.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c index 81d62a38475e..73cd8b922d12 100644 --- a/sound/soc/codecs/wm8994.c +++ b/sound/soc/codecs/wm8994.c @@ -3472,23 +3472,16 @@ static irqreturn_t wm8994_temp_shut(int irq, void *data) static int wm8994_codec_probe(struct snd_soc_codec *codec) { struct wm8994 *control = dev_get_drvdata(codec->dev->parent); - struct wm8994_priv *wm8994; + struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); struct snd_soc_dapm_context *dapm = &codec->dapm; unsigned int reg; int ret, i; + wm8994->codec = codec; codec->control_data = control->regmap; - wm8994 = devm_kzalloc(codec->dev, sizeof(struct wm8994_priv), - GFP_KERNEL); - if (wm8994 == NULL) - return -ENOMEM; - snd_soc_codec_set_drvdata(codec, wm8994); - snd_soc_codec_set_cache_io(codec, 16, 16, SND_SOC_REGMAP); - wm8994->wm8994 = dev_get_drvdata(codec->dev->parent); - wm8994->pdata = dev_get_platdata(codec->dev->parent); wm8994->codec = codec; mutex_init(&wm8994->accdet_lock); @@ -3953,6 +3946,17 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8994 = { static int __devinit wm8994_probe(struct platform_device *pdev) { + struct wm8994_priv *wm8994; + + wm8994 = devm_kzalloc(&pdev->dev, sizeof(struct wm8994_priv), + GFP_KERNEL); + if (wm8994 == NULL) + return -ENOMEM; + platform_set_drvdata(pdev, wm8994); + + wm8994->wm8994 = dev_get_drvdata(pdev->dev.parent); + wm8994->pdata = dev_get_platdata(pdev->dev.parent); + return snd_soc_register_codec(&pdev->dev, &soc_codec_dev_wm8994, wm8994_dai, ARRAY_SIZE(wm8994_dai)); } |