diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-03-03 18:24:39 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-03-03 20:56:06 -0500 |
commit | 2bc16ed8e02ba39dc5010b4a2b2a606e4b87abbd (patch) | |
tree | 09f3596446f39f83ee1a5c4519e00dac02c6ace2 /sound/soc/codecs | |
parent | fe4085e84f17a57a533a210a626e0cc9ead381f9 (diff) |
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/codecs')
-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) | |||
3472 | static int wm8994_codec_probe(struct snd_soc_codec *codec) | 3472 | static int wm8994_codec_probe(struct snd_soc_codec *codec) |
3473 | { | 3473 | { |
3474 | struct wm8994 *control = dev_get_drvdata(codec->dev->parent); | 3474 | struct wm8994 *control = dev_get_drvdata(codec->dev->parent); |
3475 | struct wm8994_priv *wm8994; | 3475 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); |
3476 | struct snd_soc_dapm_context *dapm = &codec->dapm; | 3476 | struct snd_soc_dapm_context *dapm = &codec->dapm; |
3477 | unsigned int reg; | 3477 | unsigned int reg; |
3478 | int ret, i; | 3478 | int ret, i; |
3479 | 3479 | ||
3480 | wm8994->codec = codec; | ||
3480 | codec->control_data = control->regmap; | 3481 | codec->control_data = control->regmap; |
3481 | 3482 | ||
3482 | wm8994 = devm_kzalloc(codec->dev, sizeof(struct wm8994_priv), | ||
3483 | GFP_KERNEL); | ||
3484 | if (wm8994 == NULL) | ||
3485 | return -ENOMEM; | ||
3486 | snd_soc_codec_set_drvdata(codec, wm8994); | ||
3487 | |||
3488 | snd_soc_codec_set_cache_io(codec, 16, 16, SND_SOC_REGMAP); | 3483 | snd_soc_codec_set_cache_io(codec, 16, 16, SND_SOC_REGMAP); |
3489 | 3484 | ||
3490 | wm8994->wm8994 = dev_get_drvdata(codec->dev->parent); | ||
3491 | wm8994->pdata = dev_get_platdata(codec->dev->parent); | ||
3492 | wm8994->codec = codec; | 3485 | wm8994->codec = codec; |
3493 | 3486 | ||
3494 | mutex_init(&wm8994->accdet_lock); | 3487 | mutex_init(&wm8994->accdet_lock); |
@@ -3953,6 +3946,17 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8994 = { | |||
3953 | 3946 | ||
3954 | static int __devinit wm8994_probe(struct platform_device *pdev) | 3947 | static int __devinit wm8994_probe(struct platform_device *pdev) |
3955 | { | 3948 | { |
3949 | struct wm8994_priv *wm8994; | ||
3950 | |||
3951 | wm8994 = devm_kzalloc(&pdev->dev, sizeof(struct wm8994_priv), | ||
3952 | GFP_KERNEL); | ||
3953 | if (wm8994 == NULL) | ||
3954 | return -ENOMEM; | ||
3955 | platform_set_drvdata(pdev, wm8994); | ||
3956 | |||
3957 | wm8994->wm8994 = dev_get_drvdata(pdev->dev.parent); | ||
3958 | wm8994->pdata = dev_get_platdata(pdev->dev.parent); | ||
3959 | |||
3956 | return snd_soc_register_codec(&pdev->dev, &soc_codec_dev_wm8994, | 3960 | return snd_soc_register_codec(&pdev->dev, &soc_codec_dev_wm8994, |
3957 | wm8994_dai, ARRAY_SIZE(wm8994_dai)); | 3961 | wm8994_dai, ARRAY_SIZE(wm8994_dai)); |
3958 | } | 3962 | } |