diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2010-04-14 02:35:19 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2010-04-16 21:46:22 -0400 |
commit | b2c812e22de88bb79c290c0e718280f10b64a48d (patch) | |
tree | 4a5d967714cfb771db351cde525e6946897cca08 /sound/soc/codecs/wm9713.c | |
parent | 890c681275ab02623de1187f2d97fc355d76f372 (diff) |
ASoC: Add indirection for CODEC private data
One of the features of the multi CODEC work is that it embeds a struct
device in the CODEC to provide diagnostics via a sysfs class rather than
via the device tree, at which point it's much better to use the struct
device private data rather than having two places to store it. Provide
an accessor function to allow this change to be made more easily, and
update all the CODEC drivers are updated.
To ensure use of the accessor the private data structure member is
renamed, meaning that if code developed with older an older core that
still uses private_data is merged it will fail to build.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Diffstat (limited to 'sound/soc/codecs/wm9713.c')
-rw-r--r-- | sound/soc/codecs/wm9713.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/sound/soc/codecs/wm9713.c b/sound/soc/codecs/wm9713.c index ceb86b4ddb25..d2244c93f581 100644 --- a/sound/soc/codecs/wm9713.c +++ b/sound/soc/codecs/wm9713.c | |||
@@ -763,7 +763,7 @@ static void pll_factors(struct _pll_div *pll_div, unsigned int source) | |||
763 | static int wm9713_set_pll(struct snd_soc_codec *codec, | 763 | static int wm9713_set_pll(struct snd_soc_codec *codec, |
764 | int pll_id, unsigned int freq_in, unsigned int freq_out) | 764 | int pll_id, unsigned int freq_in, unsigned int freq_out) |
765 | { | 765 | { |
766 | struct wm9713_priv *wm9713 = codec->private_data; | 766 | struct wm9713_priv *wm9713 = snd_soc_codec_get_drvdata(codec); |
767 | u16 reg, reg2; | 767 | u16 reg, reg2; |
768 | struct _pll_div pll_div; | 768 | struct _pll_div pll_div; |
769 | 769 | ||
@@ -1174,7 +1174,7 @@ static int wm9713_soc_resume(struct platform_device *pdev) | |||
1174 | { | 1174 | { |
1175 | struct snd_soc_device *socdev = platform_get_drvdata(pdev); | 1175 | struct snd_soc_device *socdev = platform_get_drvdata(pdev); |
1176 | struct snd_soc_codec *codec = socdev->card->codec; | 1176 | struct snd_soc_codec *codec = socdev->card->codec; |
1177 | struct wm9713_priv *wm9713 = codec->private_data; | 1177 | struct wm9713_priv *wm9713 = snd_soc_codec_get_drvdata(codec); |
1178 | int i, ret; | 1178 | int i, ret; |
1179 | u16 *cache = codec->reg_cache; | 1179 | u16 *cache = codec->reg_cache; |
1180 | 1180 | ||
@@ -1227,8 +1227,9 @@ static int wm9713_soc_probe(struct platform_device *pdev) | |||
1227 | codec->reg_cache_size = sizeof(wm9713_reg); | 1227 | codec->reg_cache_size = sizeof(wm9713_reg); |
1228 | codec->reg_cache_step = 2; | 1228 | codec->reg_cache_step = 2; |
1229 | 1229 | ||
1230 | codec->private_data = kzalloc(sizeof(struct wm9713_priv), GFP_KERNEL); | 1230 | snd_soc_codec_set_drvdata(codec, kzalloc(sizeof(struct wm9713_priv), |
1231 | if (codec->private_data == NULL) { | 1231 | GFP_KERNEL)); |
1232 | if (snd_soc_codec_get_drvdata(codec) == NULL) { | ||
1232 | ret = -ENOMEM; | 1233 | ret = -ENOMEM; |
1233 | goto priv_err; | 1234 | goto priv_err; |
1234 | } | 1235 | } |
@@ -1279,7 +1280,7 @@ pcm_err: | |||
1279 | snd_soc_free_ac97_codec(codec); | 1280 | snd_soc_free_ac97_codec(codec); |
1280 | 1281 | ||
1281 | codec_err: | 1282 | codec_err: |
1282 | kfree(codec->private_data); | 1283 | kfree(snd_soc_codec_get_drvdata(codec)); |
1283 | 1284 | ||
1284 | priv_err: | 1285 | priv_err: |
1285 | kfree(codec->reg_cache); | 1286 | kfree(codec->reg_cache); |
@@ -1301,7 +1302,7 @@ static int wm9713_soc_remove(struct platform_device *pdev) | |||
1301 | snd_soc_dapm_free(socdev); | 1302 | snd_soc_dapm_free(socdev); |
1302 | snd_soc_free_pcms(socdev); | 1303 | snd_soc_free_pcms(socdev); |
1303 | snd_soc_free_ac97_codec(codec); | 1304 | snd_soc_free_ac97_codec(codec); |
1304 | kfree(codec->private_data); | 1305 | kfree(snd_soc_codec_get_drvdata(codec)); |
1305 | kfree(codec->reg_cache); | 1306 | kfree(codec->reg_cache); |
1306 | kfree(codec); | 1307 | kfree(codec); |
1307 | return 0; | 1308 | return 0; |