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/wm8971.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/wm8971.c')
-rw-r--r-- | sound/soc/codecs/wm8971.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/sound/soc/codecs/wm8971.c b/sound/soc/codecs/wm8971.c index d9540d55fc89..95c9ec3862d5 100644 --- a/sound/soc/codecs/wm8971.c +++ b/sound/soc/codecs/wm8971.c | |||
@@ -414,7 +414,7 @@ static int wm8971_set_dai_sysclk(struct snd_soc_dai *codec_dai, | |||
414 | int clk_id, unsigned int freq, int dir) | 414 | int clk_id, unsigned int freq, int dir) |
415 | { | 415 | { |
416 | struct snd_soc_codec *codec = codec_dai->codec; | 416 | struct snd_soc_codec *codec = codec_dai->codec; |
417 | struct wm8971_priv *wm8971 = codec->private_data; | 417 | struct wm8971_priv *wm8971 = snd_soc_codec_get_drvdata(codec); |
418 | 418 | ||
419 | switch (freq) { | 419 | switch (freq) { |
420 | case 11289600: | 420 | case 11289600: |
@@ -493,7 +493,7 @@ static int wm8971_pcm_hw_params(struct snd_pcm_substream *substream, | |||
493 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 493 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
494 | struct snd_soc_device *socdev = rtd->socdev; | 494 | struct snd_soc_device *socdev = rtd->socdev; |
495 | struct snd_soc_codec *codec = socdev->card->codec; | 495 | struct snd_soc_codec *codec = socdev->card->codec; |
496 | struct wm8971_priv *wm8971 = codec->private_data; | 496 | struct wm8971_priv *wm8971 = snd_soc_codec_get_drvdata(codec); |
497 | u16 iface = snd_soc_read(codec, WM8971_IFACE) & 0x1f3; | 497 | u16 iface = snd_soc_read(codec, WM8971_IFACE) & 0x1f3; |
498 | u16 srate = snd_soc_read(codec, WM8971_SRATE) & 0x1c0; | 498 | u16 srate = snd_soc_read(codec, WM8971_SRATE) & 0x1c0; |
499 | int coeff = get_coeff(wm8971->sysclk, params_rate(params)); | 499 | int coeff = get_coeff(wm8971->sysclk, params_rate(params)); |
@@ -819,7 +819,7 @@ static int wm8971_probe(struct platform_device *pdev) | |||
819 | return -ENOMEM; | 819 | return -ENOMEM; |
820 | } | 820 | } |
821 | 821 | ||
822 | codec->private_data = wm8971; | 822 | snd_soc_codec_set_drvdata(codec, wm8971); |
823 | socdev->card->codec = codec; | 823 | socdev->card->codec = codec; |
824 | mutex_init(&codec->mutex); | 824 | mutex_init(&codec->mutex); |
825 | INIT_LIST_HEAD(&codec->dapm_widgets); | 825 | INIT_LIST_HEAD(&codec->dapm_widgets); |
@@ -829,7 +829,7 @@ static int wm8971_probe(struct platform_device *pdev) | |||
829 | INIT_DELAYED_WORK(&codec->delayed_work, wm8971_work); | 829 | INIT_DELAYED_WORK(&codec->delayed_work, wm8971_work); |
830 | wm8971_workq = create_workqueue("wm8971"); | 830 | wm8971_workq = create_workqueue("wm8971"); |
831 | if (wm8971_workq == NULL) { | 831 | if (wm8971_workq == NULL) { |
832 | kfree(codec->private_data); | 832 | kfree(snd_soc_codec_get_drvdata(codec)); |
833 | kfree(codec); | 833 | kfree(codec); |
834 | return -ENOMEM; | 834 | return -ENOMEM; |
835 | } | 835 | } |
@@ -843,7 +843,7 @@ static int wm8971_probe(struct platform_device *pdev) | |||
843 | 843 | ||
844 | if (ret != 0) { | 844 | if (ret != 0) { |
845 | destroy_workqueue(wm8971_workq); | 845 | destroy_workqueue(wm8971_workq); |
846 | kfree(codec->private_data); | 846 | kfree(snd_soc_codec_get_drvdata(codec)); |
847 | kfree(codec); | 847 | kfree(codec); |
848 | } | 848 | } |
849 | 849 | ||
@@ -866,7 +866,7 @@ static int wm8971_remove(struct platform_device *pdev) | |||
866 | i2c_unregister_device(codec->control_data); | 866 | i2c_unregister_device(codec->control_data); |
867 | i2c_del_driver(&wm8971_i2c_driver); | 867 | i2c_del_driver(&wm8971_i2c_driver); |
868 | #endif | 868 | #endif |
869 | kfree(codec->private_data); | 869 | kfree(snd_soc_codec_get_drvdata(codec)); |
870 | kfree(codec); | 870 | kfree(codec); |
871 | 871 | ||
872 | return 0; | 872 | return 0; |