ASoC: Add indirection for CODEC private data
authorMark Brown <broonie@opensource.wolfsonmicro.com>
Wed, 14 Apr 2010 06:35:19 +0000 (15:35 +0900)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Sat, 17 Apr 2010 01:46:22 +0000 (10:46 +0900)
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>
43 files changed:
include/sound/soc.h
sound/soc/codecs/ad1836.c
sound/soc/codecs/ad193x.c
sound/soc/codecs/ak4104.c
sound/soc/codecs/ak4535.c
sound/soc/codecs/ak4642.c
sound/soc/codecs/ak4671.c
sound/soc/codecs/cs4270.c
sound/soc/codecs/cx20442.c
sound/soc/codecs/da7210.c
sound/soc/codecs/ssm2602.c
sound/soc/codecs/stac9766.c
sound/soc/codecs/tlv320aic3x.c
sound/soc/codecs/tlv320dac33.c
sound/soc/codecs/twl4030.c
sound/soc/codecs/uda134x.c
sound/soc/codecs/uda1380.c
sound/soc/codecs/wm8350.c
sound/soc/codecs/wm8400.c
sound/soc/codecs/wm8523.c
sound/soc/codecs/wm8580.c
sound/soc/codecs/wm8711.c
sound/soc/codecs/wm8731.c
sound/soc/codecs/wm8750.c
sound/soc/codecs/wm8753.c
sound/soc/codecs/wm8776.c
sound/soc/codecs/wm8900.c
sound/soc/codecs/wm8903.c
sound/soc/codecs/wm8904.c
sound/soc/codecs/wm8940.c
sound/soc/codecs/wm8955.c
sound/soc/codecs/wm8960.c
sound/soc/codecs/wm8961.c
sound/soc/codecs/wm8971.c
sound/soc/codecs/wm8974.c
sound/soc/codecs/wm8978.c
sound/soc/codecs/wm8988.c
sound/soc/codecs/wm8990.c
sound/soc/codecs/wm8993.c
sound/soc/codecs/wm8994.c
sound/soc/codecs/wm9081.c
sound/soc/codecs/wm9713.c
sound/soc/codecs/wm_hubs.c

index 4ab3dad..01e9c66 100644 (file)
@@ -414,7 +414,7 @@ struct snd_soc_codec {
        struct snd_ac97 *ac97;  /* for ad-hoc ac97 devices */
        unsigned int active;
        unsigned int pcm_devs;
-       void *private_data;
+       void *drvdata;
 
        /* codec IO */
        void *control_data; /* codec control (i2c/3wire) data */
@@ -597,6 +597,17 @@ static inline unsigned int snd_soc_write(struct snd_soc_codec *codec,
        return codec->write(codec, reg, val);
 }
 
+static inline void snd_soc_codec_set_drvdata(struct snd_soc_codec *codec,
+                                            void *data)
+{
+       codec->drvdata = data;
+}
+
+static inline void *snd_soc_codec_get_drvdata(struct snd_soc_codec *codec)
+{
+       return codec->drvdata;
+}
+
 #include <sound/soc-dai.h>
 
 #endif
index 3c80137..48e1272 100644 (file)
@@ -277,7 +277,7 @@ static int ad1836_register(struct ad1836_priv *ad1836)
        mutex_init(&codec->mutex);
        INIT_LIST_HEAD(&codec->dapm_widgets);
        INIT_LIST_HEAD(&codec->dapm_paths);
-       codec->private_data = ad1836;
+       snd_soc_codec_set_drvdata(codec, ad1836);
        codec->reg_cache = ad1836->reg_cache;
        codec->reg_cache_size = AD1836_NUM_REGS;
        codec->name = "AD1836";
index 4bfd66b..7ed787e 100644 (file)
@@ -305,7 +305,7 @@ static int ad193x_bus_probe(struct device *dev, void *ctrl_data, int bus_type)
        mutex_init(&codec->mutex);
        codec->control_data = ctrl_data;
        codec->dev = dev;
-       codec->private_data = ad193x;
+       snd_soc_codec_set_drvdata(codec, ad193x);
        codec->reg_cache = ad193x->reg_cache;
        codec->reg_cache_size = AD193X_NUM_REGS;
        codec->name = "AD193X";
index b68d99f..962d746 100644 (file)
@@ -221,7 +221,7 @@ static int ak4104_spi_probe(struct spi_device *spi)
        codec->owner = THIS_MODULE;
        codec->dai = &ak4104_dai;
        codec->num_dai = 1;
-       codec->private_data = ak4104;
+       snd_soc_codec_set_drvdata(codec, ak4104);
        codec->control_data = spi;
        codec->reg_cache = ak4104->reg_cache;
        codec->reg_cache_size = AK4104_NUM_REGS;
index ff96656..2f6221b 100644 (file)
@@ -301,7 +301,7 @@ static int ak4535_set_dai_sysclk(struct snd_soc_dai *codec_dai,
        int clk_id, unsigned int freq, int dir)
 {
        struct snd_soc_codec *codec = codec_dai->codec;
-       struct ak4535_priv *ak4535 = codec->private_data;
+       struct ak4535_priv *ak4535 = snd_soc_codec_get_drvdata(codec);
 
        ak4535->sysclk = freq;
        return 0;
@@ -314,7 +314,7 @@ static int ak4535_hw_params(struct snd_pcm_substream *substream,
        struct snd_soc_pcm_runtime *rtd = substream->private_data;
        struct snd_soc_device *socdev = rtd->socdev;
        struct snd_soc_codec *codec = socdev->card->codec;
-       struct ak4535_priv *ak4535 = codec->private_data;
+       struct ak4535_priv *ak4535 = snd_soc_codec_get_drvdata(codec);
        u8 mode2 = ak4535_read_reg_cache(codec, AK4535_MODE2) & ~(0x3 << 5);
        int rate = params_rate(params), fs = 256;
 
@@ -599,7 +599,7 @@ static int ak4535_probe(struct platform_device *pdev)
                return -ENOMEM;
        }
 
-       codec->private_data = ak4535;
+       snd_soc_codec_set_drvdata(codec, ak4535);
        socdev->card->codec = codec;
        mutex_init(&codec->mutex);
        INIT_LIST_HEAD(&codec->dapm_widgets);
@@ -616,7 +616,7 @@ static int ak4535_probe(struct platform_device *pdev)
 #endif
 
        if (ret != 0) {
-               kfree(codec->private_data);
+               kfree(snd_soc_codec_get_drvdata(codec));
                kfree(codec);
        }
        return ret;
@@ -638,7 +638,7 @@ static int ak4535_remove(struct platform_device *pdev)
                i2c_unregister_device(codec->control_data);
        i2c_del_driver(&ak4535_i2c_driver);
 #endif
-       kfree(codec->private_data);
+       kfree(snd_soc_codec_get_drvdata(codec));
        kfree(codec);
 
        return 0;
index de1809d..1254a7a 100644 (file)
@@ -431,7 +431,7 @@ static int ak4642_init(struct ak4642_priv *ak4642)
        INIT_LIST_HEAD(&codec->dapm_widgets);
        INIT_LIST_HEAD(&codec->dapm_paths);
 
-       codec->private_data     = ak4642;
+       snd_soc_codec_set_drvdata(codec, ak4642);
        codec->name             = "AK4642";
        codec->owner            = THIS_MODULE;
        codec->read             = ak4642_read_reg_cache;
index 82fca28..18fd447 100644 (file)
@@ -701,7 +701,7 @@ static int ak4671_register(struct ak4671_priv *ak4671,
        INIT_LIST_HEAD(&codec->dapm_widgets);
        INIT_LIST_HEAD(&codec->dapm_paths);
 
-       codec->private_data = ak4671;
+       snd_soc_codec_set_drvdata(codec,  ak4671);
        codec->name = "AK4671";
        codec->owner = THIS_MODULE;
        codec->bias_level = SND_SOC_BIAS_OFF;
index dfbeb2d..a7f09f3 100644 (file)
@@ -210,7 +210,7 @@ static int cs4270_set_dai_sysclk(struct snd_soc_dai *codec_dai,
                                 int clk_id, unsigned int freq, int dir)
 {
        struct snd_soc_codec *codec = codec_dai->codec;
-       struct cs4270_private *cs4270 = codec->private_data;
+       struct cs4270_private *cs4270 = snd_soc_codec_get_drvdata(codec);
        unsigned int rates = 0;
        unsigned int rate_min = -1;
        unsigned int rate_max = 0;
@@ -269,7 +269,7 @@ static int cs4270_set_dai_fmt(struct snd_soc_dai *codec_dai,
                              unsigned int format)
 {
        struct snd_soc_codec *codec = codec_dai->codec;
-       struct cs4270_private *cs4270 = codec->private_data;
+       struct cs4270_private *cs4270 = snd_soc_codec_get_drvdata(codec);
        int ret = 0;
 
        /* set DAI format */
@@ -411,7 +411,7 @@ static int cs4270_hw_params(struct snd_pcm_substream *substream,
        struct snd_soc_pcm_runtime *rtd = substream->private_data;
        struct snd_soc_device *socdev = rtd->socdev;
        struct snd_soc_codec *codec = socdev->card->codec;
-       struct cs4270_private *cs4270 = codec->private_data;
+       struct cs4270_private *cs4270 = snd_soc_codec_get_drvdata(codec);
        int ret;
        unsigned int i;
        unsigned int rate;
@@ -490,7 +490,7 @@ static int cs4270_hw_params(struct snd_pcm_substream *substream,
 static int cs4270_dai_mute(struct snd_soc_dai *dai, int mute)
 {
        struct snd_soc_codec *codec = dai->codec;
-       struct cs4270_private *cs4270 = codec->private_data;
+       struct cs4270_private *cs4270 = snd_soc_codec_get_drvdata(codec);
        int reg6;
 
        reg6 = snd_soc_read(codec, CS4270_MUTE);
@@ -523,7 +523,7 @@ static int cs4270_soc_put_mute(struct snd_kcontrol *kcontrol,
                                struct snd_ctl_elem_value *ucontrol)
 {
        struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
-       struct cs4270_private *cs4270 = codec->private_data;
+       struct cs4270_private *cs4270 = snd_soc_codec_get_drvdata(codec);
        int left = !ucontrol->value.integer.value[0];
        int right = !ucontrol->value.integer.value[1];
 
@@ -599,7 +599,7 @@ static int cs4270_probe(struct platform_device *pdev)
 {
        struct snd_soc_device *socdev = platform_get_drvdata(pdev);
        struct snd_soc_codec *codec = cs4270_codec;
-       struct cs4270_private *cs4270 = codec->private_data;
+       struct cs4270_private *cs4270 = snd_soc_codec_get_drvdata(codec);
        int i, ret;
 
        /* Connect the codec to the socdev.  snd_soc_new_pcms() needs this. */
@@ -656,7 +656,7 @@ static int cs4270_remove(struct platform_device *pdev)
 {
        struct snd_soc_device *socdev = platform_get_drvdata(pdev);
        struct snd_soc_codec *codec = cs4270_codec;
-       struct cs4270_private *cs4270 = codec->private_data;
+       struct cs4270_private *cs4270 = snd_soc_codec_get_drvdata(codec);
 
        snd_soc_free_pcms(socdev);
        regulator_bulk_disable(ARRAY_SIZE(cs4270->supplies), cs4270->supplies);
@@ -729,7 +729,7 @@ static int cs4270_i2c_probe(struct i2c_client *i2c_client,
        codec->owner = THIS_MODULE;
        codec->dai = &cs4270_dai;
        codec->num_dai = 1;
-       codec->private_data = cs4270;
+       snd_soc_codec_set_drvdata(codec, cs4270);
        codec->control_data = i2c_client;
        codec->read = cs4270_read_reg_cache;
        codec->write = cs4270_i2c_write;
@@ -842,7 +842,7 @@ MODULE_DEVICE_TABLE(i2c, cs4270_id);
 static int cs4270_soc_suspend(struct platform_device *pdev, pm_message_t mesg)
 {
        struct snd_soc_codec *codec = cs4270_codec;
-       struct cs4270_private *cs4270 = codec->private_data;
+       struct cs4270_private *cs4270 = snd_soc_codec_get_drvdata(codec);
        int reg, ret;
 
        reg = snd_soc_read(codec, CS4270_PWRCTL) | CS4270_PWRCTL_PDN_ALL;
@@ -862,7 +862,7 @@ static int cs4270_soc_suspend(struct platform_device *pdev, pm_message_t mesg)
 static int cs4270_soc_resume(struct platform_device *pdev)
 {
        struct snd_soc_codec *codec = cs4270_codec;
-       struct cs4270_private *cs4270 = codec->private_data;
+       struct cs4270_private *cs4270 = snd_soc_codec_get_drvdata(codec);
        struct i2c_client *i2c_client = codec->control_data;
        int reg;
 
index e000cdf..203e51f 100644 (file)
@@ -386,7 +386,7 @@ static int cx20442_register(struct cx20442_priv *cx20442)
 
        codec->name = "CX20442";
        codec->owner = THIS_MODULE;
-       codec->private_data = cx20442;
+       snd_soc_codec_set_drvdata(codec, cx20442);
 
        codec->dai = &cx20442_dai;
        codec->num_dai = 1;
index 35b8816..89cea32 100644 (file)
@@ -460,7 +460,7 @@ static int da7210_init(struct da7210_priv *da7210)
        INIT_LIST_HEAD(&codec->dapm_widgets);
        INIT_LIST_HEAD(&codec->dapm_paths);
 
-       codec->private_data     = da7210;
+       snd_soc_codec_set_drvdata(codec, da7210);
        codec->name             = "DA7210";
        codec->owner            = THIS_MODULE;
        codec->read             = da7210_read;
index 942f5dc..99ddec7 100644 (file)
@@ -277,7 +277,7 @@ static int ssm2602_hw_params(struct snd_pcm_substream *substream,
        struct snd_soc_pcm_runtime *rtd = substream->private_data;
        struct snd_soc_device *socdev = rtd->socdev;
        struct snd_soc_codec *codec = socdev->card->codec;
-       struct ssm2602_priv *ssm2602 = codec->private_data;
+       struct ssm2602_priv *ssm2602 = snd_soc_codec_get_drvdata(codec);
        struct i2c_client *i2c = codec->control_data;
        u16 iface = ssm2602_read_reg_cache(codec, SSM2602_IFACE) & 0xfff3;
        int i = get_coeff(ssm2602->sysclk, params_rate(params));
@@ -322,7 +322,7 @@ static int ssm2602_startup(struct snd_pcm_substream *substream,
        struct snd_soc_pcm_runtime *rtd = substream->private_data;
        struct snd_soc_device *socdev = rtd->socdev;
        struct snd_soc_codec *codec = socdev->card->codec;
-       struct ssm2602_priv *ssm2602 = codec->private_data;
+       struct ssm2602_priv *ssm2602 = snd_soc_codec_get_drvdata(codec);
        struct i2c_client *i2c = codec->control_data;
        struct snd_pcm_runtime *master_runtime;
 
@@ -373,7 +373,7 @@ static void ssm2602_shutdown(struct snd_pcm_substream *substream,
        struct snd_soc_pcm_runtime *rtd = substream->private_data;
        struct snd_soc_device *socdev = rtd->socdev;
        struct snd_soc_codec *codec = socdev->card->codec;
-       struct ssm2602_priv *ssm2602 = codec->private_data;
+       struct ssm2602_priv *ssm2602 = snd_soc_codec_get_drvdata(codec);
 
        /* deactivate */
        if (!codec->active)
@@ -401,7 +401,7 @@ static int ssm2602_set_dai_sysclk(struct snd_soc_dai *codec_dai,
                int clk_id, unsigned int freq, int dir)
 {
        struct snd_soc_codec *codec = codec_dai->codec;
-       struct ssm2602_priv *ssm2602 = codec->private_data;
+       struct ssm2602_priv *ssm2602 = snd_soc_codec_get_drvdata(codec);
        switch (freq) {
        case 11289600:
        case 12000000:
@@ -726,7 +726,7 @@ static int ssm2602_probe(struct platform_device *pdev)
                return -ENOMEM;
        }
 
-       codec->private_data = ssm2602;
+       snd_soc_codec_set_drvdata(codec, ssm2602);
        socdev->card->codec = codec;
        mutex_init(&codec->mutex);
        INIT_LIST_HEAD(&codec->dapm_widgets);
@@ -759,7 +759,7 @@ static int ssm2602_remove(struct platform_device *pdev)
        i2c_unregister_device(codec->control_data);
        i2c_del_driver(&ssm2602_i2c_driver);
 #endif
-       kfree(codec->private_data);
+       kfree(snd_soc_codec_get_drvdata(codec));
        kfree(codec);
 
        return 0;
index 81b8c9d..a1c7ca8 100644 (file)
@@ -409,7 +409,7 @@ reset_err:
 pcm_err:
        snd_soc_free_ac97_codec(codec);
 codec_err:
-       kfree(codec->private_data);
+       kfree(snd_soc_codec_get_drvdata(codec));
 cache_err:
        kfree(socdev->card->codec);
        socdev->card->codec = NULL;
index e4b946a..556123b 100644 (file)
@@ -763,7 +763,7 @@ static int aic3x_hw_params(struct snd_pcm_substream *substream,
        struct snd_soc_pcm_runtime *rtd = substream->private_data;
        struct snd_soc_device *socdev = rtd->socdev;
        struct snd_soc_codec *codec = socdev->card->codec;
-       struct aic3x_priv *aic3x = codec->private_data;
+       struct aic3x_priv *aic3x = snd_soc_codec_get_drvdata(codec);
        int codec_clk = 0, bypass_pll = 0, fsref, last_clk = 0;
        u8 data, j, r, p, pll_q, pll_p = 1, pll_r = 1, pll_j = 1;
        u16 d, pll_d = 1;
@@ -930,7 +930,7 @@ static int aic3x_set_dai_sysclk(struct snd_soc_dai *codec_dai,
                                int clk_id, unsigned int freq, int dir)
 {
        struct snd_soc_codec *codec = codec_dai->codec;
-       struct aic3x_priv *aic3x = codec->private_data;
+       struct aic3x_priv *aic3x = snd_soc_codec_get_drvdata(codec);
 
        aic3x->sysclk = freq;
        return 0;
@@ -940,7 +940,7 @@ static int aic3x_set_dai_fmt(struct snd_soc_dai *codec_dai,
                             unsigned int fmt)
 {
        struct snd_soc_codec *codec = codec_dai->codec;
-       struct aic3x_priv *aic3x = codec->private_data;
+       struct aic3x_priv *aic3x = snd_soc_codec_get_drvdata(codec);
        u8 iface_areg, iface_breg;
        int delay = 0;
 
@@ -994,7 +994,7 @@ static int aic3x_set_dai_fmt(struct snd_soc_dai *codec_dai,
 static int aic3x_set_bias_level(struct snd_soc_codec *codec,
                                enum snd_soc_bias_level level)
 {
-       struct aic3x_priv *aic3x = codec->private_data;
+       struct aic3x_priv *aic3x = snd_soc_codec_get_drvdata(codec);
        u8 reg;
 
        switch (level) {
@@ -1338,7 +1338,7 @@ static int aic3x_i2c_probe(struct i2c_client *i2c,
 
        codec = &aic3x->codec;
        codec->dev = &i2c->dev;
-       codec->private_data = aic3x;
+       snd_soc_codec_set_drvdata(codec, aic3x);
        codec->control_data = i2c;
        codec->hw_write = (hw_write_t) i2c_master_send;
 
index ee2e1e3..824bb35 100644 (file)
@@ -167,7 +167,7 @@ static inline void dac33_write_reg_cache(struct snd_soc_codec *codec,
 static int dac33_read(struct snd_soc_codec *codec, unsigned int reg,
                      u8 *value)
 {
-       struct tlv320dac33_priv *dac33 = codec->private_data;
+       struct tlv320dac33_priv *dac33 = snd_soc_codec_get_drvdata(codec);
        int val;
 
        *value = reg & 0xff;
@@ -192,7 +192,7 @@ static int dac33_read(struct snd_soc_codec *codec, unsigned int reg,
 static int dac33_write(struct snd_soc_codec *codec, unsigned int reg,
                       unsigned int value)
 {
-       struct tlv320dac33_priv *dac33 = codec->private_data;
+       struct tlv320dac33_priv *dac33 = snd_soc_codec_get_drvdata(codec);
        u8 data[2];
        int ret = 0;
 
@@ -219,7 +219,7 @@ static int dac33_write(struct snd_soc_codec *codec, unsigned int reg,
 static int dac33_write_locked(struct snd_soc_codec *codec, unsigned int reg,
                       unsigned int value)
 {
-       struct tlv320dac33_priv *dac33 = codec->private_data;
+       struct tlv320dac33_priv *dac33 = snd_soc_codec_get_drvdata(codec);
        int ret;
 
        mutex_lock(&dac33->mutex);
@@ -233,7 +233,7 @@ static int dac33_write_locked(struct snd_soc_codec *codec, unsigned int reg,
 static int dac33_write16(struct snd_soc_codec *codec, unsigned int reg,
                       unsigned int value)
 {
-       struct tlv320dac33_priv *dac33 = codec->private_data;
+       struct tlv320dac33_priv *dac33 = snd_soc_codec_get_drvdata(codec);
        u8 data[3];
        int ret = 0;
 
@@ -265,7 +265,7 @@ static int dac33_write16(struct snd_soc_codec *codec, unsigned int reg,
 
 static void dac33_restore_regs(struct snd_soc_codec *codec)
 {
-       struct tlv320dac33_priv *dac33 = codec->private_data;
+       struct tlv320dac33_priv *dac33 = snd_soc_codec_get_drvdata(codec);
        u8 *cache = codec->reg_cache;
        u8 data[2];
        int i, ret;
@@ -319,7 +319,7 @@ static inline void dac33_soft_power(struct snd_soc_codec *codec, int power)
 
 static int dac33_hard_power(struct snd_soc_codec *codec, int power)
 {
-       struct tlv320dac33_priv *dac33 = codec->private_data;
+       struct tlv320dac33_priv *dac33 = snd_soc_codec_get_drvdata(codec);
        int ret;
 
        mutex_lock(&dac33->mutex);
@@ -366,7 +366,7 @@ static int dac33_get_nsample(struct snd_kcontrol *kcontrol,
                         struct snd_ctl_elem_value *ucontrol)
 {
        struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
-       struct tlv320dac33_priv *dac33 = codec->private_data;
+       struct tlv320dac33_priv *dac33 = snd_soc_codec_get_drvdata(codec);
 
        ucontrol->value.integer.value[0] = dac33->nsample;
 
@@ -377,7 +377,7 @@ static int dac33_set_nsample(struct snd_kcontrol *kcontrol,
                         struct snd_ctl_elem_value *ucontrol)
 {
        struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
-       struct tlv320dac33_priv *dac33 = codec->private_data;
+       struct tlv320dac33_priv *dac33 = snd_soc_codec_get_drvdata(codec);
        int ret = 0;
 
        if (dac33->nsample == ucontrol->value.integer.value[0])
@@ -396,7 +396,7 @@ static int dac33_get_fifo_mode(struct snd_kcontrol *kcontrol,
                         struct snd_ctl_elem_value *ucontrol)
 {
        struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
-       struct tlv320dac33_priv *dac33 = codec->private_data;
+       struct tlv320dac33_priv *dac33 = snd_soc_codec_get_drvdata(codec);
 
        ucontrol->value.integer.value[0] = dac33->fifo_mode;
 
@@ -407,7 +407,7 @@ static int dac33_set_fifo_mode(struct snd_kcontrol *kcontrol,
                         struct snd_ctl_elem_value *ucontrol)
 {
        struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
-       struct tlv320dac33_priv *dac33 = codec->private_data;
+       struct tlv320dac33_priv *dac33 = snd_soc_codec_get_drvdata(codec);
        int ret = 0;
 
        if (dac33->fifo_mode == ucontrol->value.integer.value[0])
@@ -630,7 +630,7 @@ static void dac33_work(struct work_struct *work)
 static irqreturn_t dac33_interrupt_handler(int irq, void *dev)
 {
        struct snd_soc_codec *codec = dev;
-       struct tlv320dac33_priv *dac33 = codec->private_data;
+       struct tlv320dac33_priv *dac33 = snd_soc_codec_get_drvdata(codec);
 
        queue_work(dac33->dac33_wq, &dac33->work);
 
@@ -697,7 +697,7 @@ static int dac33_prepare_chip(struct snd_pcm_substream *substream)
        struct snd_soc_pcm_runtime *rtd = substream->private_data;
        struct snd_soc_device *socdev = rtd->socdev;
        struct snd_soc_codec *codec = socdev->card->codec;
-       struct tlv320dac33_priv *dac33 = codec->private_data;
+       struct tlv320dac33_priv *dac33 = snd_soc_codec_get_drvdata(codec);
        unsigned int oscset, ratioset, pwr_ctrl, reg_tmp;
        u8 aictrl_a, aictrl_b, fifoctrl_a;
 
@@ -883,7 +883,7 @@ static void dac33_calculate_times(struct snd_pcm_substream *substream)
        struct snd_soc_pcm_runtime *rtd = substream->private_data;
        struct snd_soc_device *socdev = rtd->socdev;
        struct snd_soc_codec *codec = socdev->card->codec;
-       struct tlv320dac33_priv *dac33 = codec->private_data;
+       struct tlv320dac33_priv *dac33 = snd_soc_codec_get_drvdata(codec);
        unsigned int nsample_limit;
 
        /* Number of samples (16bit, stereo) in one period */
@@ -936,7 +936,7 @@ static int dac33_pcm_trigger(struct snd_pcm_substream *substream, int cmd,
        struct snd_soc_pcm_runtime *rtd = substream->private_data;
        struct snd_soc_device *socdev = rtd->socdev;
        struct snd_soc_codec *codec = socdev->card->codec;
-       struct tlv320dac33_priv *dac33 = codec->private_data;
+       struct tlv320dac33_priv *dac33 = snd_soc_codec_get_drvdata(codec);
        int ret = 0;
 
        switch (cmd) {
@@ -967,7 +967,7 @@ static int dac33_set_dai_sysclk(struct snd_soc_dai *codec_dai,
                int clk_id, unsigned int freq, int dir)
 {
        struct snd_soc_codec *codec = codec_dai->codec;
-       struct tlv320dac33_priv *dac33 = codec->private_data;
+       struct tlv320dac33_priv *dac33 = snd_soc_codec_get_drvdata(codec);
        u8 ioc_reg, asrcb_reg;
 
        ioc_reg = dac33_read_reg_cache(codec, DAC33_INT_OSC_CTRL);
@@ -997,7 +997,7 @@ static int dac33_set_dai_fmt(struct snd_soc_dai *codec_dai,
                             unsigned int fmt)
 {
        struct snd_soc_codec *codec = codec_dai->codec;
-       struct tlv320dac33_priv *dac33 = codec->private_data;
+       struct tlv320dac33_priv *dac33 = snd_soc_codec_get_drvdata(codec);
        u8 aictrl_a, aictrl_b;
 
        aictrl_a = dac33_read_reg_cache(codec, DAC33_SER_AUDIOIF_CTRL_A);
@@ -1088,7 +1088,7 @@ static int dac33_soc_probe(struct platform_device *pdev)
 
        codec = tlv320dac33_codec;
        socdev->card->codec = codec;
-       dac33 = codec->private_data;
+       dac33 = snd_soc_codec_get_drvdata(codec);
 
        /* Power up the codec */
        dac33_hard_power(codec, 1);
@@ -1209,7 +1209,7 @@ static int __devinit dac33_i2c_probe(struct i2c_client *client,
                return -ENOMEM;
 
        codec = &dac33->codec;
-       codec->private_data = dac33;
+       snd_soc_codec_set_drvdata(codec, dac33);
        codec->control_data = client;
 
        mutex_init(&codec->mutex);
index bf59b8a..4eb5a2e 100644 (file)
@@ -175,7 +175,7 @@ static inline void twl4030_write_reg_cache(struct snd_soc_codec *codec,
 static int twl4030_write(struct snd_soc_codec *codec,
                        unsigned int reg, unsigned int value)
 {
-       struct twl4030_priv *twl4030 = codec->private_data;
+       struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(codec);
        int write_to_reg = 0;
 
        twl4030_write_reg_cache(codec, reg, value);
@@ -220,7 +220,7 @@ static int twl4030_write(struct snd_soc_codec *codec,
 
 static void twl4030_codec_enable(struct snd_soc_codec *codec, int enable)
 {
-       struct twl4030_priv *twl4030 = codec->private_data;
+       struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(codec);
        int mode;
 
        if (enable == twl4030->codec_powered)
@@ -258,7 +258,7 @@ static void twl4030_init_chip(struct snd_soc_codec *codec)
 
 static void twl4030_apll_enable(struct snd_soc_codec *codec, int enable)
 {
-       struct twl4030_priv *twl4030 = codec->private_data;
+       struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(codec);
        int status;
 
        if (enable == twl4030->apll_enabled)
@@ -279,7 +279,7 @@ static void twl4030_apll_enable(struct snd_soc_codec *codec, int enable)
 
 static void twl4030_power_up(struct snd_soc_codec *codec)
 {
-       struct twl4030_priv *twl4030 = codec->private_data;
+       struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(codec);
        u8 anamicl, regmisc1, byte;
        int i = 0;
 
@@ -570,7 +570,7 @@ static int micpath_event(struct snd_soc_dapm_widget *w,
 static int pin_name##pga_event(struct snd_soc_dapm_widget *w,          \
                struct snd_kcontrol *kcontrol, int event)               \
 {                                                                      \
-       struct twl4030_priv *twl4030 = w->codec->private_data;          \
+       struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(w->codec); \
                                                                        \
        switch (event) {                                                \
        case SND_SOC_DAPM_POST_PMU:                                     \
@@ -678,7 +678,7 @@ static void headset_ramp(struct snd_soc_codec *codec, int ramp)
        struct twl4030_setup_data *setup = socdev->codec_data;
 
        unsigned char hs_gain, hs_pop;
-       struct twl4030_priv *twl4030 = codec->private_data;
+       struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(codec);
        /* Base values for ramp delay calculation: 2^19 - 2^26 */
        unsigned int ramp_base[] = {524288, 1048576, 2097152, 4194304,
                                    8388608, 16777216, 33554432, 67108864};
@@ -741,7 +741,7 @@ static void headset_ramp(struct snd_soc_codec *codec, int ramp)
 static int headsetlpga_event(struct snd_soc_dapm_widget *w,
                struct snd_kcontrol *kcontrol, int event)
 {
-       struct twl4030_priv *twl4030 = w->codec->private_data;
+       struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(w->codec);
 
        switch (event) {
        case SND_SOC_DAPM_POST_PMU:
@@ -765,7 +765,7 @@ static int headsetlpga_event(struct snd_soc_dapm_widget *w,
 static int headsetrpga_event(struct snd_soc_dapm_widget *w,
                struct snd_kcontrol *kcontrol, int event)
 {
-       struct twl4030_priv *twl4030 = w->codec->private_data;
+       struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(w->codec);
 
        switch (event) {
        case SND_SOC_DAPM_POST_PMU:
@@ -957,7 +957,7 @@ static int snd_soc_put_twl4030_opmode_enum_double(struct snd_kcontrol *kcontrol,
        struct snd_ctl_elem_value *ucontrol)
 {
        struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
-       struct twl4030_priv *twl4030 = codec->private_data;
+       struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(codec);
        struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
        unsigned short val;
        unsigned short mask, bitmask;
@@ -1627,7 +1627,7 @@ static int twl4030_startup(struct snd_pcm_substream *substream,
        struct snd_soc_pcm_runtime *rtd = substream->private_data;
        struct snd_soc_device *socdev = rtd->socdev;
        struct snd_soc_codec *codec = socdev->card->codec;
-       struct twl4030_priv *twl4030 = codec->private_data;
+       struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(codec);
 
        if (twl4030->master_substream) {
                twl4030->slave_substream = substream;
@@ -1658,7 +1658,7 @@ static void twl4030_shutdown(struct snd_pcm_substream *substream,
        struct snd_soc_pcm_runtime *rtd = substream->private_data;
        struct snd_soc_device *socdev = rtd->socdev;
        struct snd_soc_codec *codec = socdev->card->codec;
-       struct twl4030_priv *twl4030 = codec->private_data;
+       struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(codec);
 
        if (twl4030->master_substream == substream)
                twl4030->master_substream = twl4030->slave_substream;
@@ -1684,7 +1684,7 @@ static int twl4030_hw_params(struct snd_pcm_substream *substream,
        struct snd_soc_pcm_runtime *rtd = substream->private_data;
        struct snd_soc_device *socdev = rtd->socdev;
        struct snd_soc_codec *codec = socdev->card->codec;
-       struct twl4030_priv *twl4030 = codec->private_data;
+       struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(codec);
        u8 mode, old_mode, format, old_format;
 
         /* If the substream has 4 channel, do the necessary setup */
@@ -1804,7 +1804,7 @@ static int twl4030_set_dai_sysclk(struct snd_soc_dai *codec_dai,
                int clk_id, unsigned int freq, int dir)
 {
        struct snd_soc_codec *codec = codec_dai->codec;
-       struct twl4030_priv *twl4030 = codec->private_data;
+       struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(codec);
 
        switch (freq) {
        case 19200000:
@@ -1919,7 +1919,7 @@ static int twl4030_voice_startup(struct snd_pcm_substream *substream,
        struct snd_soc_pcm_runtime *rtd = substream->private_data;
        struct snd_soc_device *socdev = rtd->socdev;
        struct snd_soc_codec *codec = socdev->card->codec;
-       struct twl4030_priv *twl4030 = codec->private_data;
+       struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(codec);
        u8 mode;
 
        /* If the system master clock is not 26MHz, the voice PCM interface is
@@ -2164,7 +2164,7 @@ static int twl4030_soc_probe(struct platform_device *pdev)
        BUG_ON(!twl4030_codec);
 
        codec = twl4030_codec;
-       twl4030 = codec->private_data;
+       twl4030 = snd_soc_codec_get_drvdata(codec);
        socdev->card->codec = codec;
 
        /* Configuration for headset ramp delay from setup data */
@@ -2227,7 +2227,7 @@ static int __devinit twl4030_codec_probe(struct platform_device *pdev)
        }
 
        codec = &twl4030->codec;
-       codec->private_data = twl4030;
+       snd_soc_codec_set_drvdata(codec, twl4030);
        codec->dev = &pdev->dev;
        twl4030_dai[0].dev = &pdev->dev;
        twl4030_dai[1].dev = &pdev->dev;
index 3e99fe5..20deaca 100644 (file)
@@ -174,7 +174,7 @@ static int uda134x_startup(struct snd_pcm_substream *substream,
        struct snd_soc_pcm_runtime *rtd = substream->private_data;
        struct snd_soc_device *socdev = rtd->socdev;
        struct snd_soc_codec *codec = socdev->card->codec;
-       struct uda134x_priv *uda134x = codec->private_data;
+       struct uda134x_priv *uda134x = snd_soc_codec_get_drvdata(codec);
        struct snd_pcm_runtime *master_runtime;
 
        if (uda134x->master_substream) {
@@ -207,7 +207,7 @@ static void uda134x_shutdown(struct snd_pcm_substream *substream,
        struct snd_soc_pcm_runtime *rtd = substream->private_data;
        struct snd_soc_device *socdev = rtd->socdev;
        struct snd_soc_codec *codec = socdev->card->codec;
-       struct uda134x_priv *uda134x = codec->private_data;
+       struct uda134x_priv *uda134x = snd_soc_codec_get_drvdata(codec);
 
        if (uda134x->master_substream == substream)
                uda134x->master_substream = uda134x->slave_substream;
@@ -222,7 +222,7 @@ static int uda134x_hw_params(struct snd_pcm_substream *substream,
        struct snd_soc_pcm_runtime *rtd = substream->private_data;
        struct snd_soc_device *socdev = rtd->socdev;
        struct snd_soc_codec *codec = socdev->card->codec;
-       struct uda134x_priv *uda134x = codec->private_data;
+       struct uda134x_priv *uda134x = snd_soc_codec_get_drvdata(codec);
        u8 hw_params;
 
        if (substream == uda134x->slave_substream) {
@@ -294,7 +294,7 @@ static int uda134x_set_dai_sysclk(struct snd_soc_dai *codec_dai,
                                  int clk_id, unsigned int freq, int dir)
 {
        struct snd_soc_codec *codec = codec_dai->codec;
-       struct uda134x_priv *uda134x = codec->private_data;
+       struct uda134x_priv *uda134x = snd_soc_codec_get_drvdata(codec);
 
        pr_debug("%s clk_id: %d, freq: %u, dir: %d\n", __func__,
                 clk_id, freq, dir);
@@ -316,7 +316,7 @@ static int uda134x_set_dai_fmt(struct snd_soc_dai *codec_dai,
                               unsigned int fmt)
 {
        struct snd_soc_codec *codec = codec_dai->codec;
-       struct uda134x_priv *uda134x = codec->private_data;
+       struct uda134x_priv *uda134x = snd_soc_codec_get_drvdata(codec);
 
        pr_debug("%s fmt: %08X\n", __func__, fmt);
 
@@ -503,7 +503,7 @@ static int uda134x_soc_probe(struct platform_device *pdev)
        uda134x = kzalloc(sizeof(struct uda134x_priv), GFP_KERNEL);
        if (uda134x == NULL)
                goto priv_err;
-       codec->private_data = uda134x;
+       snd_soc_codec_set_drvdata(codec, uda134x);
 
        codec->reg_cache = kmemdup(uda134x_reg, sizeof(uda134x_reg),
                                   GFP_KERNEL);
@@ -567,7 +567,7 @@ static int uda134x_soc_probe(struct platform_device *pdev)
 pcm_err:
        kfree(codec->reg_cache);
 reg_err:
-       kfree(codec->private_data);
+       kfree(snd_soc_codec_get_drvdata(codec));
 priv_err:
        kfree(codec);
        return ret;
@@ -585,7 +585,7 @@ static int uda134x_soc_remove(struct platform_device *pdev)
        snd_soc_free_pcms(socdev);
        snd_soc_dapm_free(socdev);
 
-       kfree(codec->private_data);
+       kfree(snd_soc_codec_get_drvdata(codec));
        kfree(codec->reg_cache);
        kfree(codec);
 
index 9cd0a66..ecba686 100644 (file)
@@ -476,7 +476,7 @@ static int uda1380_trigger(struct snd_pcm_substream *substream, int cmd,
        struct snd_soc_pcm_runtime *rtd = substream->private_data;
        struct snd_soc_device *socdev = rtd->socdev;
        struct snd_soc_codec *codec = socdev->card->codec;
-       struct uda1380_priv *uda1380 = codec->private_data;
+       struct uda1380_priv *uda1380 = snd_soc_codec_get_drvdata(codec);
        int mixer = uda1380_read_reg_cache(codec, UDA1380_MIXER);
 
        switch (cmd) {
@@ -774,7 +774,7 @@ static int uda1380_register(struct uda1380_priv *uda1380)
        INIT_LIST_HEAD(&codec->dapm_widgets);
        INIT_LIST_HEAD(&codec->dapm_paths);
 
-       codec->private_data = uda1380;
+       snd_soc_codec_set_drvdata(codec, uda1380);
        codec->name = "UDA1380";
        codec->owner = THIS_MODULE;
        codec->read = uda1380_read_reg_cache;
index 8ac92f5..145467d 100644 (file)
@@ -95,7 +95,7 @@ static int wm8350_codec_write(struct snd_soc_codec *codec, unsigned int reg,
  */
 static inline int wm8350_out1_ramp_step(struct snd_soc_codec *codec)
 {
-       struct wm8350_data *wm8350_data = codec->private_data;
+       struct wm8350_data *wm8350_data = snd_soc_codec_get_drvdata(codec);
        struct wm8350_output *out1 = &wm8350_data->out1;
        struct wm8350 *wm8350 = codec->control_data;
        int left_complete = 0, right_complete = 0;
@@ -161,7 +161,7 @@ static inline int wm8350_out1_ramp_step(struct snd_soc_codec *codec)
  */
 static inline int wm8350_out2_ramp_step(struct snd_soc_codec *codec)
 {
-       struct wm8350_data *wm8350_data = codec->private_data;
+       struct wm8350_data *wm8350_data = snd_soc_codec_get_drvdata(codec);
        struct wm8350_output *out2 = &wm8350_data->out2;
        struct wm8350 *wm8350 = codec->control_data;
        int left_complete = 0, right_complete = 0;
@@ -231,7 +231,7 @@ static void wm8350_pga_work(struct work_struct *work)
 {
        struct snd_soc_codec *codec =
            container_of(work, struct snd_soc_codec, delayed_work.work);
-       struct wm8350_data *wm8350_data = codec->private_data;
+       struct wm8350_data *wm8350_data = snd_soc_codec_get_drvdata(codec);
        struct wm8350_output *out1 = &wm8350_data->out1,
            *out2 = &wm8350_data->out2;
        int i, out1_complete, out2_complete;
@@ -278,7 +278,7 @@ static int pga_event(struct snd_soc_dapm_widget *w,
                     struct snd_kcontrol *kcontrol, int event)
 {
        struct snd_soc_codec *codec = w->codec;
-       struct wm8350_data *wm8350_data = codec->private_data;
+       struct wm8350_data *wm8350_data = snd_soc_codec_get_drvdata(codec);
        struct wm8350_output *out;
 
        switch (w->shift) {
@@ -323,7 +323,7 @@ static int wm8350_put_volsw_2r_vu(struct snd_kcontrol *kcontrol,
                                  struct snd_ctl_elem_value *ucontrol)
 {
        struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
-       struct wm8350_data *wm8350_priv = codec->private_data;
+       struct wm8350_data *wm8350_priv = snd_soc_codec_get_drvdata(codec);
        struct wm8350_output *out = NULL;
        struct soc_mixer_control *mc =
                (struct soc_mixer_control *)kcontrol->private_value;
@@ -366,7 +366,7 @@ static int wm8350_get_volsw_2r(struct snd_kcontrol *kcontrol,
                               struct snd_ctl_elem_value *ucontrol)
 {
        struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
-       struct wm8350_data *wm8350_priv = codec->private_data;
+       struct wm8350_data *wm8350_priv = snd_soc_codec_get_drvdata(codec);
        struct wm8350_output *out1 = &wm8350_priv->out1;
        struct wm8350_output *out2 = &wm8350_priv->out2;
        struct soc_mixer_control *mc =
@@ -1108,7 +1108,7 @@ static int wm8350_set_fll(struct snd_soc_dai *codec_dai,
 {
        struct snd_soc_codec *codec = codec_dai->codec;
        struct wm8350 *wm8350 = codec->control_data;
-       struct wm8350_data *priv = codec->private_data;
+       struct wm8350_data *priv = snd_soc_codec_get_drvdata(codec);
        struct _fll_div fll_div;
        int ret = 0;
        u16 fll_1, fll_4;
@@ -1160,7 +1160,7 @@ static int wm8350_set_bias_level(struct snd_soc_codec *codec,
                                 enum snd_soc_bias_level level)
 {
        struct wm8350 *wm8350 = codec->control_data;
-       struct wm8350_data *priv = codec->private_data;
+       struct wm8350_data *priv = snd_soc_codec_get_drvdata(codec);
        struct wm8350_audio_platform_data *platform =
                wm8350->codec.platform_data;
        u16 pm1;
@@ -1399,7 +1399,7 @@ static irqreturn_t wm8350_hp_jack_handler(int irq, void *data)
 int wm8350_hp_jack_detect(struct snd_soc_codec *codec, enum wm8350_jack which,
                          struct snd_soc_jack *jack, int report)
 {
-       struct wm8350_data *priv = codec->private_data;
+       struct wm8350_data *priv = snd_soc_codec_get_drvdata(codec);
        struct wm8350 *wm8350 = codec->control_data;
        int irq;
        int ena;
@@ -1471,7 +1471,7 @@ int wm8350_mic_jack_detect(struct snd_soc_codec *codec,
                           struct snd_soc_jack *jack,
                           int detect_report, int short_report)
 {
-       struct wm8350_data *priv = codec->private_data;
+       struct wm8350_data *priv = snd_soc_codec_get_drvdata(codec);
        struct wm8350 *wm8350 = codec->control_data;
 
        priv->mic.jack = jack;
@@ -1508,7 +1508,7 @@ static int wm8350_probe(struct platform_device *pdev)
        socdev->card->codec = wm8350_codec;
        codec = socdev->card->codec;
        wm8350 = codec->control_data;
-       priv = codec->private_data;
+       priv = snd_soc_codec_get_drvdata(codec);
 
        /* Enable the codec */
        wm8350_set_bits(wm8350, WM8350_POWER_MGMT_5, WM8350_CODEC_ENA);
@@ -1579,7 +1579,7 @@ static int wm8350_remove(struct platform_device *pdev)
        struct snd_soc_device *socdev = platform_get_drvdata(pdev);
        struct snd_soc_codec *codec = socdev->card->codec;
        struct wm8350 *wm8350 = codec->control_data;
-       struct wm8350_data *priv = codec->private_data;
+       struct wm8350_data *priv = snd_soc_codec_get_drvdata(codec);
        int ret;
 
        wm8350_clear_bits(wm8350, WM8350_JACK_DETECT,
@@ -1698,7 +1698,7 @@ static __devinit int wm8350_codec_probe(struct platform_device *pdev)
        codec->dai = &wm8350_dai;
        codec->num_dai = 1;
        codec->reg_cache_size = WM8350_MAX_REGISTER;
-       codec->private_data = priv;
+       snd_soc_codec_set_drvdata(codec, priv);
        codec->control_data = wm8350;
 
        /* Put the codec into reset if it wasn't already */
@@ -1730,7 +1730,7 @@ static int __devexit wm8350_codec_remove(struct platform_device *pdev)
 {
        struct wm8350 *wm8350 = platform_get_drvdata(pdev);
        struct snd_soc_codec *codec = wm8350->codec.codec;
-       struct wm8350_data *priv = codec->private_data;
+       struct wm8350_data *priv = snd_soc_codec_get_drvdata(codec);
 
        snd_soc_unregister_dai(&wm8350_dai);
        snd_soc_unregister_codec(codec);
index b432f4d..a7506ae 100644 (file)
@@ -76,7 +76,7 @@ struct wm8400_priv {
 static inline unsigned int wm8400_read(struct snd_soc_codec *codec,
                                       unsigned int reg)
 {
-       struct wm8400_priv *wm8400 = codec->private_data;
+       struct wm8400_priv *wm8400 = snd_soc_codec_get_drvdata(codec);
 
        if (reg == WM8400_INTDRIVBITS)
                return wm8400->fake_register;
@@ -90,7 +90,7 @@ static inline unsigned int wm8400_read(struct snd_soc_codec *codec,
 static int wm8400_write(struct snd_soc_codec *codec, unsigned int reg,
        unsigned int value)
 {
-       struct wm8400_priv *wm8400 = codec->private_data;
+       struct wm8400_priv *wm8400 = snd_soc_codec_get_drvdata(codec);
 
        if (reg == WM8400_INTDRIVBITS) {
                wm8400->fake_register = value;
@@ -101,7 +101,7 @@ static int wm8400_write(struct snd_soc_codec *codec, unsigned int reg,
 
 static void wm8400_codec_reset(struct snd_soc_codec *codec)
 {
-       struct wm8400_priv *wm8400 = codec->private_data;
+       struct wm8400_priv *wm8400 = snd_soc_codec_get_drvdata(codec);
 
        wm8400_reset_codec_reg_cache(wm8400->wm8400);
 }
@@ -925,7 +925,7 @@ static int wm8400_set_dai_sysclk(struct snd_soc_dai *codec_dai,
                int clk_id, unsigned int freq, int dir)
 {
        struct snd_soc_codec *codec = codec_dai->codec;
-       struct wm8400_priv *wm8400 = codec->private_data;
+       struct wm8400_priv *wm8400 = snd_soc_codec_get_drvdata(codec);
 
        wm8400->sysclk = freq;
        return 0;
@@ -1014,7 +1014,7 @@ static int wm8400_set_dai_pll(struct snd_soc_dai *codec_dai, int pll_id,
                              unsigned int freq_out)
 {
        struct snd_soc_codec *codec = codec_dai->codec;
-       struct wm8400_priv *wm8400 = codec->private_data;
+       struct wm8400_priv *wm8400 = snd_soc_codec_get_drvdata(codec);
        struct fll_factors factors;
        int ret;
        u16 reg;
@@ -1203,7 +1203,7 @@ static int wm8400_mute(struct snd_soc_dai *dai, int mute)
 static int wm8400_set_bias_level(struct snd_soc_codec *codec,
                                 enum snd_soc_bias_level level)
 {
-       struct wm8400_priv *wm8400 = codec->private_data;
+       struct wm8400_priv *wm8400 = snd_soc_codec_get_drvdata(codec);
        u16 val;
        int ret;
 
@@ -1466,7 +1466,7 @@ static int wm8400_codec_probe(struct platform_device *dev)
                return -ENOMEM;
 
        codec = &priv->codec;
-       codec->private_data = priv;
+       snd_soc_codec_set_drvdata(codec, priv);
        codec->control_data = dev_get_drvdata(&dev->dev);
        priv->wm8400 = dev_get_drvdata(&dev->dev);
 
@@ -1529,7 +1529,7 @@ err:
 
 static int __exit wm8400_codec_remove(struct platform_device *dev)
 {
-       struct wm8400_priv *priv = wm8400_codec->private_data;
+       struct wm8400_priv *priv = snd_soc_codec_get_drvdata(wm8400_codec);
        u16 reg;
 
        snd_soc_unregister_dai(&wm8400_dai);
index d3a61d7..2cdffb0 100644 (file)
@@ -137,7 +137,7 @@ static int wm8523_startup(struct snd_pcm_substream *substream,
                          struct snd_soc_dai *dai)
 {
        struct snd_soc_codec *codec = dai->codec;
-       struct wm8523_priv *wm8523 = codec->private_data;
+       struct wm8523_priv *wm8523 = snd_soc_codec_get_drvdata(codec);
 
        /* The set of sample rates that can be supported depends on the
         * MCLK supplied to the CODEC - enforce this.
@@ -163,7 +163,7 @@ static int wm8523_hw_params(struct snd_pcm_substream *substream,
        struct snd_soc_pcm_runtime *rtd = substream->private_data;
        struct snd_soc_device *socdev = rtd->socdev;
        struct snd_soc_codec *codec = socdev->card->codec;
-       struct wm8523_priv *wm8523 = codec->private_data;
+       struct wm8523_priv *wm8523 = snd_soc_codec_get_drvdata(codec);
        int i;
        u16 aifctrl1 = snd_soc_read(codec, WM8523_AIF_CTRL1);
        u16 aifctrl2 = snd_soc_read(codec, WM8523_AIF_CTRL2);
@@ -210,7 +210,7 @@ static int wm8523_set_dai_sysclk(struct snd_soc_dai *codec_dai,
                int clk_id, unsigned int freq, int dir)
 {
        struct snd_soc_codec *codec = codec_dai->codec;
-       struct wm8523_priv *wm8523 = codec->private_data;
+       struct wm8523_priv *wm8523 = snd_soc_codec_get_drvdata(codec);
        unsigned int val;
        int i;
 
@@ -317,7 +317,7 @@ static int wm8523_set_dai_fmt(struct snd_soc_dai *codec_dai,
 static int wm8523_set_bias_level(struct snd_soc_codec *codec,
                                 enum snd_soc_bias_level level)
 {
-       struct wm8523_priv *wm8523 = codec->private_data;
+       struct wm8523_priv *wm8523 = snd_soc_codec_get_drvdata(codec);
        int ret, i;
 
        switch (level) {
@@ -488,7 +488,7 @@ static int wm8523_register(struct wm8523_priv *wm8523,
        INIT_LIST_HEAD(&codec->dapm_widgets);
        INIT_LIST_HEAD(&codec->dapm_paths);
 
-       codec->private_data = wm8523;
+       snd_soc_codec_set_drvdata(codec, wm8523);
        codec->name = "WM8523";
        codec->owner = THIS_MODULE;
        codec->bias_level = SND_SOC_BIAS_OFF;
index d077df6..94b3f4c 100644 (file)
@@ -411,7 +411,7 @@ static int wm8580_set_dai_pll(struct snd_soc_dai *codec_dai, int pll_id,
 {
        int offset;
        struct snd_soc_codec *codec = codec_dai->codec;
-       struct wm8580_priv *wm8580 = codec->private_data;
+       struct wm8580_priv *wm8580 = snd_soc_codec_get_drvdata(codec);
        struct pll_state *state;
        struct _pll_div pll_div;
        unsigned int reg;
@@ -839,7 +839,7 @@ static int wm8580_register(struct wm8580_priv *wm8580,
        INIT_LIST_HEAD(&codec->dapm_widgets);
        INIT_LIST_HEAD(&codec->dapm_paths);
 
-       codec->private_data = wm8580;
+       snd_soc_codec_set_drvdata(codec, wm8580);
        codec->name = "WM8580";
        codec->owner = THIS_MODULE;
        codec->bias_level = SND_SOC_BIAS_OFF;
index 24a3560..f350c5e 100644 (file)
@@ -162,7 +162,7 @@ static int wm8711_hw_params(struct snd_pcm_substream *substream,
        struct snd_soc_dai *dai)
 {
        struct snd_soc_codec *codec = dai->codec;
-       struct wm8711_priv *wm8711 = codec->private_data;
+       struct wm8711_priv *wm8711 = snd_soc_codec_get_drvdata(codec);
        u16 iface = snd_soc_read(codec, WM8711_IFACE) & 0xfffc;
        int i = get_coeff(wm8711->sysclk, params_rate(params));
        u16 srate = (coeff_div[i].sr << 2) |
@@ -226,7 +226,7 @@ static int wm8711_set_dai_sysclk(struct snd_soc_dai *codec_dai,
                int clk_id, unsigned int freq, int dir)
 {
        struct snd_soc_codec *codec = codec_dai->codec;
-       struct wm8711_priv *wm8711 = codec->private_data;
+       struct wm8711_priv *wm8711 = snd_soc_codec_get_drvdata(codec);
 
        switch (freq) {
        case 11289600:
@@ -445,7 +445,7 @@ static int wm8711_register(struct wm8711_priv *wm8711,
        INIT_LIST_HEAD(&codec->dapm_widgets);
        INIT_LIST_HEAD(&codec->dapm_paths);
 
-       codec->private_data = wm8711;
+       snd_soc_codec_set_drvdata(codec, wm8711);
        codec->name = "WM8711";
        codec->owner = THIS_MODULE;
        codec->bias_level = SND_SOC_BIAS_OFF;
index d5e1c5b..63f90c4 100644 (file)
@@ -224,7 +224,7 @@ static int wm8731_hw_params(struct snd_pcm_substream *substream,
        struct snd_soc_pcm_runtime *rtd = substream->private_data;
        struct snd_soc_device *socdev = rtd->socdev;
        struct snd_soc_codec *codec = socdev->card->codec;
-       struct wm8731_priv *wm8731 = codec->private_data;
+       struct wm8731_priv *wm8731 = snd_soc_codec_get_drvdata(codec);
        u16 iface = snd_soc_read(codec, WM8731_IFACE) & 0xfff3;
        int i = get_coeff(wm8731->sysclk, params_rate(params));
        u16 srate = (coeff_div[i].sr << 2) |
@@ -291,7 +291,7 @@ static int wm8731_set_dai_sysclk(struct snd_soc_dai *codec_dai,
                int clk_id, unsigned int freq, int dir)
 {
        struct snd_soc_codec *codec = codec_dai->codec;
-       struct wm8731_priv *wm8731 = codec->private_data;
+       struct wm8731_priv *wm8731 = snd_soc_codec_get_drvdata(codec);
 
        switch (freq) {
        case 11289600:
@@ -427,7 +427,7 @@ static int wm8731_suspend(struct platform_device *pdev, pm_message_t state)
 {
        struct snd_soc_device *socdev = platform_get_drvdata(pdev);
        struct snd_soc_codec *codec = socdev->card->codec;
-       struct wm8731_priv *wm8731 = codec->private_data;
+       struct wm8731_priv *wm8731 = snd_soc_codec_get_drvdata(codec);
 
        snd_soc_write(codec, WM8731_ACTIVE, 0x0);
        wm8731_set_bias_level(codec, SND_SOC_BIAS_OFF);
@@ -440,7 +440,7 @@ static int wm8731_resume(struct platform_device *pdev)
 {
        struct snd_soc_device *socdev = platform_get_drvdata(pdev);
        struct snd_soc_codec *codec = socdev->card->codec;
-       struct wm8731_priv *wm8731 = codec->private_data;
+       struct wm8731_priv *wm8731 = snd_soc_codec_get_drvdata(codec);
        int i, ret;
        u8 data[2];
        u16 *cache = codec->reg_cache;
@@ -535,7 +535,7 @@ static int wm8731_register(struct wm8731_priv *wm8731,
        INIT_LIST_HEAD(&codec->dapm_widgets);
        INIT_LIST_HEAD(&codec->dapm_paths);
 
-       codec->private_data = wm8731;
+       snd_soc_codec_set_drvdata(codec, wm8731);
        codec->name = "WM8731";
        codec->owner = THIS_MODULE;
        codec->bias_level = SND_SOC_BIAS_OFF;
index 4bbc512..60d7cf8 100644 (file)
@@ -482,7 +482,7 @@ static int wm8750_set_dai_sysclk(struct snd_soc_dai *codec_dai,
                int clk_id, unsigned int freq, int dir)
 {
        struct snd_soc_codec *codec = codec_dai->codec;
-       struct wm8750_priv *wm8750 = codec->private_data;
+       struct wm8750_priv *wm8750 = snd_soc_codec_get_drvdata(codec);
 
        switch (freq) {
        case 11289600:
@@ -561,7 +561,7 @@ static int wm8750_pcm_hw_params(struct snd_pcm_substream *substream,
        struct snd_soc_pcm_runtime *rtd = substream->private_data;
        struct snd_soc_device *socdev = rtd->socdev;
        struct snd_soc_codec *codec = socdev->card->codec;
-       struct wm8750_priv *wm8750 = codec->private_data;
+       struct wm8750_priv *wm8750 = snd_soc_codec_get_drvdata(codec);
        u16 iface = snd_soc_read(codec, WM8750_IFACE) & 0x1f3;
        u16 srate = snd_soc_read(codec, WM8750_SRATE) & 0x1c0;
        int coeff = get_coeff(wm8750->sysclk, params_rate(params));
@@ -775,10 +775,9 @@ static int wm8750_register(struct wm8750_priv *wm8750,
        codec->set_bias_level = wm8750_set_bias_level;
        codec->dai = &wm8750_dai;
        codec->num_dai = 1;
-       codec->private_data = wm8750;
        codec->reg_cache_size = ARRAY_SIZE(wm8750->reg_cache) + 1;
        codec->reg_cache = &wm8750->reg_cache;
-       codec->private_data = wm8750;
+       snd_soc_codec_set_drvdata(codec, wm8750);
 
        memcpy(codec->reg_cache, wm8750_reg, sizeof(wm8750->reg_cache));
 
index c2444e7..f9e56a1 100644 (file)
@@ -850,7 +850,7 @@ static int wm8753_set_dai_sysclk(struct snd_soc_dai *codec_dai,
                int clk_id, unsigned int freq, int dir)
 {
        struct snd_soc_codec *codec = codec_dai->codec;
-       struct wm8753_priv *wm8753 = codec->private_data;
+       struct wm8753_priv *wm8753 = snd_soc_codec_get_drvdata(codec);
 
        switch (freq) {
        case 11289600:
@@ -913,7 +913,7 @@ static int wm8753_pcm_hw_params(struct snd_pcm_substream *substream,
        struct snd_soc_pcm_runtime *rtd = substream->private_data;
        struct snd_soc_device *socdev = rtd->socdev;
        struct snd_soc_codec *codec = socdev->card->codec;
-       struct wm8753_priv *wm8753 = codec->private_data;
+       struct wm8753_priv *wm8753 = snd_soc_codec_get_drvdata(codec);
        u16 voice = wm8753_read_reg_cache(codec, WM8753_PCM) & 0x01f3;
        u16 srate = wm8753_read_reg_cache(codec, WM8753_SRATE1) & 0x017f;
 
@@ -1147,7 +1147,7 @@ static int wm8753_i2s_hw_params(struct snd_pcm_substream *substream,
        struct snd_soc_pcm_runtime *rtd = substream->private_data;
        struct snd_soc_device *socdev = rtd->socdev;
        struct snd_soc_codec *codec = socdev->card->codec;
-       struct wm8753_priv *wm8753 = codec->private_data;
+       struct wm8753_priv *wm8753 = snd_soc_codec_get_drvdata(codec);
        u16 srate = wm8753_read_reg_cache(codec, WM8753_SRATE1) & 0x01c0;
        u16 hifi = wm8753_read_reg_cache(codec, WM8753_HIFI) & 0x01f3;
        int coeff;
@@ -1645,7 +1645,7 @@ static int wm8753_register(struct wm8753_priv *wm8753)
        codec->num_dai = 2;
        codec->reg_cache_size = ARRAY_SIZE(wm8753->reg_cache) + 1;
        codec->reg_cache = &wm8753->reg_cache;
-       codec->private_data = wm8753;
+       snd_soc_codec_set_drvdata(codec, wm8753);
 
        memcpy(codec->reg_cache, wm8753_reg, sizeof(wm8753->reg_cache));
        INIT_DELAYED_WORK(&codec->delayed_work, wm8753_work);
index 44e7d9d..6946009 100644 (file)
@@ -226,7 +226,7 @@ static int wm8776_hw_params(struct snd_pcm_substream *substream,
                            struct snd_soc_dai *dai)
 {
        struct snd_soc_codec *codec = dai->codec;
-       struct wm8776_priv *wm8776 = codec->private_data;
+       struct wm8776_priv *wm8776 = snd_soc_codec_get_drvdata(codec);
        int iface_reg, iface;
        int ratio_shift, master;
        int i;
@@ -303,7 +303,7 @@ static int wm8776_set_sysclk(struct snd_soc_dai *dai,
                             int clk_id, unsigned int freq, int dir)
 {
        struct snd_soc_codec *codec = dai->codec;
-       struct wm8776_priv *wm8776 = codec->private_data;
+       struct wm8776_priv *wm8776 = snd_soc_codec_get_drvdata(codec);
 
        BUG_ON(dai->id >= ARRAY_SIZE(wm8776->sysclk));
 
@@ -490,7 +490,7 @@ static int wm8776_register(struct wm8776_priv *wm8776,
        INIT_LIST_HEAD(&codec->dapm_widgets);
        INIT_LIST_HEAD(&codec->dapm_paths);
 
-       codec->private_data = wm8776;
+       snd_soc_codec_set_drvdata(codec, wm8776);
        codec->name = "WM8776";
        codec->owner = THIS_MODULE;
        codec->bias_level = SND_SOC_BIAS_OFF;
index dbc368c..19a6b25 100644 (file)
@@ -744,7 +744,7 @@ static int fll_factors(struct _fll_div *fll_div, unsigned int Fref,
 static int wm8900_set_fll(struct snd_soc_codec *codec,
        int fll_id, unsigned int freq_in, unsigned int freq_out)
 {
-       struct wm8900_priv *wm8900 = codec->private_data;
+       struct wm8900_priv *wm8900 = snd_soc_codec_get_drvdata(codec);
        struct _fll_div fll_div;
        unsigned int reg;
 
@@ -1131,7 +1131,7 @@ static int wm8900_suspend(struct platform_device *pdev, pm_message_t state)
 {
        struct snd_soc_device *socdev = platform_get_drvdata(pdev);
        struct snd_soc_codec *codec = socdev->card->codec;
-       struct wm8900_priv *wm8900 = codec->private_data;
+       struct wm8900_priv *wm8900 = snd_soc_codec_get_drvdata(codec);
        int fll_out = wm8900->fll_out;
        int fll_in  = wm8900->fll_in;
        int ret;
@@ -1155,7 +1155,7 @@ static int wm8900_resume(struct platform_device *pdev)
 {
        struct snd_soc_device *socdev = platform_get_drvdata(pdev);
        struct snd_soc_codec *codec = socdev->card->codec;
-       struct wm8900_priv *wm8900 = codec->private_data;
+       struct wm8900_priv *wm8900 = snd_soc_codec_get_drvdata(codec);
        u16 *cache;
        int i, ret;
 
@@ -1205,7 +1205,7 @@ static __devinit int wm8900_i2c_probe(struct i2c_client *i2c,
                return -ENOMEM;
 
        codec = &wm8900->codec;
-       codec->private_data = wm8900;
+       snd_soc_codec_set_drvdata(codec, wm8900);
        codec->reg_cache = &wm8900->reg_cache[0];
        codec->reg_cache_size = WM8900_MAXREG;
 
@@ -1304,7 +1304,7 @@ static __devexit int wm8900_i2c_remove(struct i2c_client *client)
        wm8900_set_bias_level(wm8900_codec, SND_SOC_BIAS_OFF);
 
        wm8900_dai.dev = NULL;
-       kfree(wm8900_codec->private_data);
+       kfree(snd_soc_codec_get_drvdata(wm8900_codec));
        wm8900_codec = NULL;
 
        return 0;
index 134b175..5a2510c 100644 (file)
@@ -252,7 +252,7 @@ static int wm8903_run_sequence(struct snd_soc_codec *codec, unsigned int start)
 {
        u16 reg[5];
        struct i2c_client *i2c = codec->control_data;
-       struct wm8903_priv *wm8903 = codec->private_data;
+       struct wm8903_priv *wm8903 = snd_soc_codec_get_drvdata(codec);
 
        BUG_ON(start > 48);
 
@@ -420,7 +420,7 @@ static int wm8903_class_w_put(struct snd_kcontrol *kcontrol,
 {
        struct snd_soc_dapm_widget *widget = snd_kcontrol_chip(kcontrol);
        struct snd_soc_codec *codec = widget->codec;
-       struct wm8903_priv *wm8903 = codec->private_data;
+       struct wm8903_priv *wm8903 = snd_soc_codec_get_drvdata(codec);
        struct i2c_client *i2c = codec->control_data;
        u16 reg;
        int ret;
@@ -1001,7 +1001,7 @@ static int wm8903_set_dai_sysclk(struct snd_soc_dai *codec_dai,
                                 int clk_id, unsigned int freq, int dir)
 {
        struct snd_soc_codec *codec = codec_dai->codec;
-       struct wm8903_priv *wm8903 = codec->private_data;
+       struct wm8903_priv *wm8903 = snd_soc_codec_get_drvdata(codec);
 
        wm8903->sysclk = freq;
 
@@ -1229,7 +1229,7 @@ static int wm8903_startup(struct snd_pcm_substream *substream,
        struct snd_soc_pcm_runtime *rtd = substream->private_data;
        struct snd_soc_device *socdev = rtd->socdev;
        struct snd_soc_codec *codec = socdev->card->codec;
-       struct wm8903_priv *wm8903 = codec->private_data;
+       struct wm8903_priv *wm8903 = snd_soc_codec_get_drvdata(codec);
        struct i2c_client *i2c = codec->control_data;
        struct snd_pcm_runtime *master_runtime;
 
@@ -1265,7 +1265,7 @@ static void wm8903_shutdown(struct snd_pcm_substream *substream,
        struct snd_soc_pcm_runtime *rtd = substream->private_data;
        struct snd_soc_device *socdev = rtd->socdev;
        struct snd_soc_codec *codec = socdev->card->codec;
-       struct wm8903_priv *wm8903 = codec->private_data;
+       struct wm8903_priv *wm8903 = snd_soc_codec_get_drvdata(codec);
 
        if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
                wm8903->playback_active--;
@@ -1285,7 +1285,7 @@ static int wm8903_hw_params(struct snd_pcm_substream *substream,
        struct snd_soc_pcm_runtime *rtd = substream->private_data;
        struct snd_soc_device *socdev = rtd->socdev;
        struct snd_soc_codec *codec = socdev->card->codec;
-       struct wm8903_priv *wm8903 = codec->private_data;
+       struct wm8903_priv *wm8903 = snd_soc_codec_get_drvdata(codec);
        struct i2c_client *i2c = codec->control_data;
        int fs = params_rate(params);
        int bclk;
@@ -1464,7 +1464,7 @@ static int wm8903_hw_params(struct snd_pcm_substream *substream,
 int wm8903_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack,
                      int det, int shrt)
 {
-       struct wm8903_priv *wm8903 = codec->private_data;
+       struct wm8903_priv *wm8903 = snd_soc_codec_get_drvdata(codec);
        int irq_mask = WM8903_MICDET_EINT | WM8903_MICSHRT_EINT;
 
        dev_dbg(codec->dev, "Enabling microphone detection: %x %x\n",
@@ -1674,7 +1674,7 @@ static __devinit int wm8903_i2c_probe(struct i2c_client *i2c,
        codec->num_dai = 1;
        codec->reg_cache_size = ARRAY_SIZE(wm8903->reg_cache);
        codec->reg_cache = &wm8903->reg_cache[0];
-       codec->private_data = wm8903;
+       snd_soc_codec_set_drvdata(codec, wm8903);
        codec->volatile_register = wm8903_volatile_register;
        init_completion(&wm8903->wseq);
 
@@ -1812,7 +1812,7 @@ err:
 static __devexit int wm8903_i2c_remove(struct i2c_client *client)
 {
        struct snd_soc_codec *codec = i2c_get_clientdata(client);
-       struct wm8903_priv *priv = codec->private_data;
+       struct wm8903_priv *priv = snd_soc_codec_get_drvdata(codec);
 
        snd_soc_unregister_dai(&wm8903_dai);
        snd_soc_unregister_codec(codec);
@@ -1822,7 +1822,7 @@ static __devexit int wm8903_i2c_remove(struct i2c_client *client)
        if (client->irq)
                free_irq(client->irq, priv);
 
-       kfree(codec->private_data);
+       kfree(priv);
 
        wm8903_codec = NULL;
        wm8903_dai.dev = NULL;
index c5b50d7..a022ca7 100644 (file)
@@ -612,7 +612,7 @@ static int wm8904_reset(struct snd_soc_codec *codec)
 
 static int wm8904_configure_clocking(struct snd_soc_codec *codec)
 {
-       struct wm8904_priv *wm8904 = codec->private_data;
+       struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec);
        unsigned int clock0, clock2, rate;
 
        /* Gate the clock while we're updating to avoid misclocking */
@@ -668,7 +668,7 @@ static int wm8904_configure_clocking(struct snd_soc_codec *codec)
 
 static void wm8904_set_drc(struct snd_soc_codec *codec)
 {
-       struct wm8904_priv *wm8904 = codec->private_data;
+       struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec);
        struct wm8904_pdata *pdata = wm8904->pdata;
        int save, i;
 
@@ -688,7 +688,7 @@ static int wm8904_put_drc_enum(struct snd_kcontrol *kcontrol,
                               struct snd_ctl_elem_value *ucontrol)
 {
        struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
-       struct wm8904_priv *wm8904 = codec->private_data;       
+       struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec);  
        struct wm8904_pdata *pdata = wm8904->pdata;
        int value = ucontrol->value.integer.value[0];
 
@@ -706,7 +706,7 @@ static int wm8904_get_drc_enum(struct snd_kcontrol *kcontrol,
                               struct snd_ctl_elem_value *ucontrol)
 {
        struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
-       struct wm8904_priv *wm8904 = codec->private_data;
+       struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec);
 
        ucontrol->value.enumerated.item[0] = wm8904->drc_cfg;
 
@@ -715,7 +715,7 @@ static int wm8904_get_drc_enum(struct snd_kcontrol *kcontrol,
 
 static void wm8904_set_retune_mobile(struct snd_soc_codec *codec)
 {
-       struct wm8904_priv *wm8904 = codec->private_data;
+       struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec);
        struct wm8904_pdata *pdata = wm8904->pdata;
        int best, best_val, save, i, cfg;
 
@@ -759,7 +759,7 @@ static int wm8904_put_retune_mobile_enum(struct snd_kcontrol *kcontrol,
                                         struct snd_ctl_elem_value *ucontrol)
 {
        struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
-       struct wm8904_priv *wm8904 = codec->private_data;       
+       struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec);  
        struct wm8904_pdata *pdata = wm8904->pdata;
        int value = ucontrol->value.integer.value[0];
 
@@ -777,7 +777,7 @@ static int wm8904_get_retune_mobile_enum(struct snd_kcontrol *kcontrol,
                                         struct snd_ctl_elem_value *ucontrol)
 {
        struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
-       struct wm8904_priv *wm8904 = codec->private_data;
+       struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec);
 
        ucontrol->value.enumerated.item[0] = wm8904->retune_mobile_cfg;
 
@@ -788,7 +788,7 @@ static int deemph_settings[] = { 0, 32000, 44100, 48000 };
 
 static int wm8904_set_deemph(struct snd_soc_codec *codec)
 {
-       struct wm8904_priv *wm8904 = codec->private_data;
+       struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec);
        int val, i, best;
 
        /* If we're using deemphasis select the nearest available sample 
@@ -817,7 +817,7 @@ static int wm8904_get_deemph(struct snd_kcontrol *kcontrol,
                             struct snd_ctl_elem_value *ucontrol)
 {
        struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
-       struct wm8904_priv *wm8904 = codec->private_data;
+       struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec);
 
        return wm8904->deemph;
 }
@@ -826,7 +826,7 @@ static int wm8904_put_deemph(struct snd_kcontrol *kcontrol,
                              struct snd_ctl_elem_value *ucontrol)
 {
        struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
-       struct wm8904_priv *wm8904 = codec->private_data;
+       struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec);
        int deemph = ucontrol->value.enumerated.item[0];
 
        if (deemph > 1)
@@ -942,7 +942,7 @@ static int sysclk_event(struct snd_soc_dapm_widget *w,
                         struct snd_kcontrol *kcontrol, int event)
 {
        struct snd_soc_codec *codec = w->codec;
-       struct wm8904_priv *wm8904 = codec->private_data;
+       struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec);
 
        switch (event) {
        case SND_SOC_DAPM_PRE_PMU:
@@ -980,7 +980,7 @@ static int out_pga_event(struct snd_soc_dapm_widget *w,
                         struct snd_kcontrol *kcontrol, int event)
 {
        struct snd_soc_codec *codec = w->codec;
-       struct wm8904_priv *wm8904 = codec->private_data;
+       struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec);
        int reg, val;
        int dcs_mask;
        int dcs_l, dcs_r;
@@ -1428,7 +1428,7 @@ static const struct snd_soc_dapm_route wm8912_intercon[] = {
 
 static int wm8904_add_widgets(struct snd_soc_codec *codec)
 {
-       struct wm8904_priv *wm8904 = codec->private_data;
+       struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec);
 
        snd_soc_dapm_new_controls(codec, wm8904_core_dapm_widgets,
                                  ARRAY_SIZE(wm8904_core_dapm_widgets));
@@ -1542,7 +1542,7 @@ static int wm8904_hw_params(struct snd_pcm_substream *substream,
                            struct snd_soc_dai *dai)
 {
        struct snd_soc_codec *codec = dai->codec;
-       struct wm8904_priv *wm8904 = codec->private_data;
+       struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec);
        int ret, i, best, best_val, cur_val;
        unsigned int aif1 = 0;
        unsigned int aif2 = 0;
@@ -1669,7 +1669,7 @@ static int wm8904_set_sysclk(struct snd_soc_dai *dai, int clk_id,
                             unsigned int freq, int dir)
 {
        struct snd_soc_codec *codec = dai->codec;
-       struct wm8904_priv *priv = codec->private_data;
+       struct wm8904_priv *priv = snd_soc_codec_get_drvdata(codec);
 
        switch (clk_id) {
        case WM8904_CLK_MCLK:
@@ -1785,7 +1785,7 @@ static int wm8904_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask,
                               unsigned int rx_mask, int slots, int slot_width)
 {
        struct snd_soc_codec *codec = dai->codec;
-       struct wm8904_priv *wm8904 = codec->private_data;
+       struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec);
        int aif1 = 0;
 
        /* Don't need to validate anything if we're turning off TDM */
@@ -1942,7 +1942,7 @@ static int wm8904_set_fll(struct snd_soc_dai *dai, int fll_id, int source,
                          unsigned int Fref, unsigned int Fout)
 {
        struct snd_soc_codec *codec = dai->codec;
-       struct wm8904_priv *wm8904 = codec->private_data;
+       struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec);
        struct _fll_div fll_div;
        int ret, val;
        int clock2, fll1;
@@ -2094,7 +2094,7 @@ static int wm8904_digital_mute(struct snd_soc_dai *codec_dai, int mute)
 
 static void wm8904_sync_cache(struct snd_soc_codec *codec)
 {
-       struct wm8904_priv *wm8904 = codec->private_data;
+       struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec);
        int i;
 
        if (!codec->cache_sync)
@@ -2121,7 +2121,7 @@ static void wm8904_sync_cache(struct snd_soc_codec *codec)
 static int wm8904_set_bias_level(struct snd_soc_codec *codec,
                                 enum snd_soc_bias_level level)
 {
-       struct wm8904_priv *wm8904 = codec->private_data;
+       struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec);
        int ret;
 
        switch (level) {
@@ -2394,7 +2394,7 @@ static int wm8904_probe(struct platform_device *pdev)
                goto pcm_err;
        }
 
-       wm8904_handle_pdata(codec->private_data);
+       wm8904_handle_pdata(snd_soc_codec_get_drvdata(codec));
 
        wm8904_add_widgets(codec);
 
@@ -2439,7 +2439,7 @@ static int wm8904_register(struct wm8904_priv *wm8904,
        INIT_LIST_HEAD(&codec->dapm_widgets);
        INIT_LIST_HEAD(&codec->dapm_paths);
 
-       codec->private_data = wm8904;
+       snd_soc_codec_set_drvdata(codec, wm8904);
        codec->name = "WM8904";
        codec->owner = THIS_MODULE;
        codec->bias_level = SND_SOC_BIAS_OFF;
index 31e39ff..b2f1282 100644 (file)
@@ -580,7 +580,7 @@ static int wm8940_set_dai_sysclk(struct snd_soc_dai *codec_dai,
                                 int clk_id, unsigned int freq, int dir)
 {
        struct snd_soc_codec *codec = codec_dai->codec;
-       struct wm8940_priv *wm8940 = codec->private_data;
+       struct wm8940_priv *wm8940 = snd_soc_codec_get_drvdata(codec);
 
        switch (freq) {
        case 11289600:
@@ -772,7 +772,7 @@ static int wm8940_register(struct wm8940_priv *wm8940,
        INIT_LIST_HEAD(&codec->dapm_widgets);
        INIT_LIST_HEAD(&codec->dapm_paths);
 
-       codec->private_data = wm8940;
+       snd_soc_codec_set_drvdata(codec, wm8940);
        codec->name = "WM8940";
        codec->owner = THIS_MODULE;
        codec->bias_level = SND_SOC_BIAS_OFF;
index 615dab2..5f0bde5 100644 (file)
@@ -234,7 +234,7 @@ static struct {
 
 static int wm8955_configure_clocking(struct snd_soc_codec *codec)
 {
-       struct wm8955_priv *wm8955 = codec->private_data;
+       struct wm8955_priv *wm8955 = snd_soc_codec_get_drvdata(codec);
        int i, ret, val;
        int clocking = 0;
        int srate = 0;
@@ -352,7 +352,7 @@ static int deemph_settings[] = { 0, 32000, 44100, 48000 };
 
 static int wm8955_set_deemph(struct snd_soc_codec *codec)
 {
-       struct wm8955_priv *wm8955 = codec->private_data;
+       struct wm8955_priv *wm8955 = snd_soc_codec_get_drvdata(codec);
        int val, i, best;
 
        /* If we're using deemphasis select the nearest available sample
@@ -381,7 +381,7 @@ static int wm8955_get_deemph(struct snd_kcontrol *kcontrol,
                             struct snd_ctl_elem_value *ucontrol)
 {
        struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
-       struct wm8955_priv *wm8955 = codec->private_data;
+       struct wm8955_priv *wm8955 = snd_soc_codec_get_drvdata(codec);
 
        return wm8955->deemph;
 }
@@ -390,7 +390,7 @@ static int wm8955_put_deemph(struct snd_kcontrol *kcontrol,
                             struct snd_ctl_elem_value *ucontrol)
 {
        struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
-       struct wm8955_priv *wm8955 = codec->private_data;
+       struct wm8955_priv *wm8955 = snd_soc_codec_get_drvdata(codec);
        int deemph = ucontrol->value.enumerated.item[0];
 
        if (deemph > 1)
@@ -597,7 +597,7 @@ static int wm8955_hw_params(struct snd_pcm_substream *substream,
                            struct snd_soc_dai *dai)
 {
        struct snd_soc_codec *codec = dai->codec;
-       struct wm8955_priv *wm8955 = codec->private_data;
+       struct wm8955_priv *wm8955 = snd_soc_codec_get_drvdata(codec);
        int ret;
        int wl;
 
@@ -646,7 +646,7 @@ static int wm8955_set_sysclk(struct snd_soc_dai *dai, int clk_id,
                             unsigned int freq, int dir)
 {
        struct snd_soc_codec *codec = dai->codec;
-       struct wm8955_priv *priv = codec->private_data;
+       struct wm8955_priv *priv = snd_soc_codec_get_drvdata(codec);
        int div;
 
        switch (clk_id) {
@@ -769,7 +769,7 @@ static int wm8955_digital_mute(struct snd_soc_dai *codec_dai, int mute)
 static int wm8955_set_bias_level(struct snd_soc_codec *codec,
                                 enum snd_soc_bias_level level)
 {
-       struct wm8955_priv *wm8955 = codec->private_data;
+       struct wm8955_priv *wm8955 = snd_soc_codec_get_drvdata(codec);
        int ret, i;
 
        switch (level) {
@@ -970,7 +970,7 @@ static int wm8955_register(struct wm8955_priv *wm8955,
        INIT_LIST_HEAD(&codec->dapm_widgets);
        INIT_LIST_HEAD(&codec->dapm_paths);
 
-       codec->private_data = wm8955;
+       snd_soc_codec_set_drvdata(codec, wm8955);
        codec->name = "WM8955";
        codec->owner = THIS_MODULE;
        codec->bias_level = SND_SOC_BIAS_OFF;
index c2960d3..eba3ac0 100644 (file)
@@ -331,7 +331,7 @@ static const struct snd_soc_dapm_route audio_paths_capless[] = {
 static int wm8960_add_widgets(struct snd_soc_codec *codec)
 {
        struct wm8960_data *pdata = codec->dev->platform_data;
-       struct wm8960_priv *wm8960 = codec->private_data;
+       struct wm8960_priv *wm8960 = snd_soc_codec_get_drvdata(codec);
        struct snd_soc_dapm_widget *w;
 
        snd_soc_dapm_new_controls(codec, wm8960_dapm_widgets,
@@ -534,7 +534,7 @@ static int wm8960_set_bias_level_out3(struct snd_soc_codec *codec,
 static int wm8960_set_bias_level_capless(struct snd_soc_codec *codec,
                                         enum snd_soc_bias_level level)
 {
-       struct wm8960_priv *wm8960 = codec->private_data;
+       struct wm8960_priv *wm8960 = snd_soc_codec_get_drvdata(codec);
        int reg;
 
        switch (level) {
@@ -915,7 +915,7 @@ static int wm8960_register(struct wm8960_priv *wm8960,
        INIT_LIST_HEAD(&codec->dapm_widgets);
        INIT_LIST_HEAD(&codec->dapm_paths);
 
-       codec->private_data = wm8960;
+       snd_soc_codec_set_drvdata(codec, wm8960);
        codec->name = "WM8960";
        codec->owner = THIS_MODULE;
        codec->bias_level = SND_SOC_BIAS_OFF;
index d2342c5..bab393f 100644 (file)
@@ -630,7 +630,7 @@ static int wm8961_hw_params(struct snd_pcm_substream *substream,
                            struct snd_soc_dai *dai)
 {
        struct snd_soc_codec *codec = dai->codec;
-       struct wm8961_priv *wm8961 = codec->private_data;
+       struct wm8961_priv *wm8961 = snd_soc_codec_get_drvdata(codec);
        int i, best, target, fs;
        u16 reg;
 
@@ -721,7 +721,7 @@ static int wm8961_set_sysclk(struct snd_soc_dai *dai, int clk_id,
                             int dir)
 {
        struct snd_soc_codec *codec = dai->codec;
-       struct wm8961_priv *wm8961 = codec->private_data;
+       struct wm8961_priv *wm8961 = snd_soc_codec_get_drvdata(codec);
        u16 reg = snd_soc_read(codec, WM8961_CLOCKING1);
 
        if (freq > 33000000) {
@@ -1064,7 +1064,7 @@ static int wm8961_register(struct wm8961_priv *wm8961)
        INIT_LIST_HEAD(&codec->dapm_widgets);
        INIT_LIST_HEAD(&codec->dapm_paths);
 
-       codec->private_data = wm8961;
+       snd_soc_codec_set_drvdata(codec, wm8961);
        codec->name = "WM8961";
        codec->owner = THIS_MODULE;
        codec->dai = &wm8961_dai;
index d9540d5..95c9ec3 100644 (file)
@@ -414,7 +414,7 @@ static int wm8971_set_dai_sysclk(struct snd_soc_dai *codec_dai,
                int clk_id, unsigned int freq, int dir)
 {
        struct snd_soc_codec *codec = codec_dai->codec;
-       struct wm8971_priv *wm8971 = codec->private_data;
+       struct wm8971_priv *wm8971 = snd_soc_codec_get_drvdata(codec);
 
        switch (freq) {
        case 11289600:
@@ -493,7 +493,7 @@ static int wm8971_pcm_hw_params(struct snd_pcm_substream *substream,
        struct snd_soc_pcm_runtime *rtd = substream->private_data;
        struct snd_soc_device *socdev = rtd->socdev;
        struct snd_soc_codec *codec = socdev->card->codec;
-       struct wm8971_priv *wm8971 = codec->private_data;
+       struct wm8971_priv *wm8971 = snd_soc_codec_get_drvdata(codec);
        u16 iface = snd_soc_read(codec, WM8971_IFACE) & 0x1f3;
        u16 srate = snd_soc_read(codec, WM8971_SRATE) & 0x1c0;
        int coeff = get_coeff(wm8971->sysclk, params_rate(params));
@@ -819,7 +819,7 @@ static int wm8971_probe(struct platform_device *pdev)
                return -ENOMEM;
        }
 
-       codec->private_data = wm8971;
+       snd_soc_codec_set_drvdata(codec, wm8971);
        socdev->card->codec = codec;
        mutex_init(&codec->mutex);
        INIT_LIST_HEAD(&codec->dapm_widgets);
@@ -829,7 +829,7 @@ static int wm8971_probe(struct platform_device *pdev)
        INIT_DELAYED_WORK(&codec->delayed_work, wm8971_work);
        wm8971_workq = create_workqueue("wm8971");
        if (wm8971_workq == NULL) {
-               kfree(codec->private_data);
+               kfree(snd_soc_codec_get_drvdata(codec));
                kfree(codec);
                return -ENOMEM;
        }
@@ -843,7 +843,7 @@ static int wm8971_probe(struct platform_device *pdev)
 
        if (ret != 0) {
                destroy_workqueue(wm8971_workq);
-               kfree(codec->private_data);
+               kfree(snd_soc_codec_get_drvdata(codec));
                kfree(codec);
        }
 
@@ -866,7 +866,7 @@ static int wm8971_remove(struct platform_device *pdev)
        i2c_unregister_device(codec->control_data);
        i2c_del_driver(&wm8971_i2c_driver);
 #endif
-       kfree(codec->private_data);
+       kfree(snd_soc_codec_get_drvdata(codec));
        kfree(codec);
 
        return 0;
index ee637af..1e4da32 100644 (file)
@@ -676,7 +676,7 @@ static __devinit int wm8974_register(struct wm8974_priv *wm8974)
        INIT_LIST_HEAD(&codec->dapm_widgets);
        INIT_LIST_HEAD(&codec->dapm_paths);
 
-       codec->private_data = wm8974;
+       snd_soc_codec_set_drvdata(codec, wm8974);
        codec->name = "WM8974";
        codec->owner = THIS_MODULE;
        codec->bias_level = SND_SOC_BIAS_OFF;
index 28bb59e..6866a6a 100644 (file)
@@ -438,7 +438,7 @@ static int wm8978_enum_mclk(unsigned int f_out, unsigned int f_mclk,
  */
 static int wm8978_configure_pll(struct snd_soc_codec *codec)
 {
-       struct wm8978_priv *wm8978 = codec->private_data;
+       struct wm8978_priv *wm8978 = snd_soc_codec_get_drvdata(codec);
        struct wm8978_pll_div pll_div;
        unsigned int f_opclk = wm8978->f_opclk, f_mclk = wm8978->f_mclk,
                f_256fs = wm8978->f_256fs;
@@ -534,7 +534,7 @@ static int wm8978_set_dai_clkdiv(struct snd_soc_dai *codec_dai,
                                 int div_id, int div)
 {
        struct snd_soc_codec *codec = codec_dai->codec;
-       struct wm8978_priv *wm8978 = codec->private_data;
+       struct wm8978_priv *wm8978 = snd_soc_codec_get_drvdata(codec);
        int ret = 0;
 
        switch (div_id) {
@@ -579,7 +579,7 @@ static int wm8978_set_dai_sysclk(struct snd_soc_dai *codec_dai, int clk_id,
                                 unsigned int freq, int dir)
 {
        struct snd_soc_codec *codec = codec_dai->codec;
-       struct wm8978_priv *wm8978 = codec->private_data;
+       struct wm8978_priv *wm8978 = snd_soc_codec_get_drvdata(codec);
        int ret = 0;
 
        dev_dbg(codec->dev, "%s: ID %d, freq %u\n", __func__, clk_id, freq);
@@ -691,7 +691,7 @@ static int wm8978_hw_params(struct snd_pcm_substream *substream,
        struct snd_soc_pcm_runtime *rtd = substream->private_data;
        struct snd_soc_device *socdev = rtd->socdev;
        struct snd_soc_codec *codec = socdev->card->codec;
-       struct wm8978_priv *wm8978 = codec->private_data;
+       struct wm8978_priv *wm8978 = snd_soc_codec_get_drvdata(codec);
        /* Word length mask = 0x60 */
        u16 iface_ctl = snd_soc_read(codec, WM8978_AUDIO_INTERFACE) & ~0x60;
        /* Sampling rate mask = 0xe (for filters) */
@@ -911,7 +911,7 @@ static int wm8978_resume(struct platform_device *pdev)
 {
        struct snd_soc_device *socdev = platform_get_drvdata(pdev);
        struct snd_soc_codec *codec = socdev->card->codec;
-       struct wm8978_priv *wm8978 = codec->private_data;
+       struct wm8978_priv *wm8978 = snd_soc_codec_get_drvdata(codec);
        int i;
        u16 *cache = codec->reg_cache;
 
@@ -1019,7 +1019,7 @@ static __devinit int wm8978_register(struct wm8978_priv *wm8978)
        INIT_LIST_HEAD(&codec->dapm_widgets);
        INIT_LIST_HEAD(&codec->dapm_paths);
 
-       codec->private_data = wm8978;
+       snd_soc_codec_set_drvdata(codec, wm8978);
        codec->name = "WM8978";
        codec->owner = THIS_MODULE;
        codec->bias_level = SND_SOC_BIAS_OFF;
index 2862e4d..563cf89 100644 (file)
@@ -494,7 +494,7 @@ static int wm8988_set_dai_sysclk(struct snd_soc_dai *codec_dai,
                int clk_id, unsigned int freq, int dir)
 {
        struct snd_soc_codec *codec = codec_dai->codec;
-       struct wm8988_priv *wm8988 = codec->private_data;
+       struct wm8988_priv *wm8988 = snd_soc_codec_get_drvdata(codec);
 
        switch (freq) {
        case 11289600:
@@ -584,7 +584,7 @@ static int wm8988_pcm_startup(struct snd_pcm_substream *substream,
                              struct snd_soc_dai *dai)
 {
        struct snd_soc_codec *codec = dai->codec;
-       struct wm8988_priv *wm8988 = codec->private_data;
+       struct wm8988_priv *wm8988 = snd_soc_codec_get_drvdata(codec);
 
        /* The set of sample rates that can be supported depends on the
         * MCLK supplied to the CODEC - enforce this.
@@ -609,7 +609,7 @@ static int wm8988_pcm_hw_params(struct snd_pcm_substream *substream,
        struct snd_soc_pcm_runtime *rtd = substream->private_data;
        struct snd_soc_device *socdev = rtd->socdev;
        struct snd_soc_codec *codec = socdev->card->codec;
-       struct wm8988_priv *wm8988 = codec->private_data;
+       struct wm8988_priv *wm8988 = snd_soc_codec_get_drvdata(codec);
        u16 iface = snd_soc_read(codec, WM8988_IFACE) & 0x1f3;
        u16 srate = snd_soc_read(codec, WM8988_SRATE) & 0x180;
        int coeff;
@@ -832,7 +832,7 @@ static int wm8988_register(struct wm8988_priv *wm8988,
        INIT_LIST_HEAD(&codec->dapm_widgets);
        INIT_LIST_HEAD(&codec->dapm_paths);
 
-       codec->private_data = wm8988;
+       snd_soc_codec_set_drvdata(codec, wm8988);
        codec->name = "WM8988";
        codec->owner = THIS_MODULE;
        codec->dai = &wm8988_dai;
index 056b787..9a9528e 100644 (file)
@@ -1011,7 +1011,7 @@ static int wm8990_set_dai_sysclk(struct snd_soc_dai *codec_dai,
                int clk_id, unsigned int freq, int dir)
 {
        struct snd_soc_codec *codec = codec_dai->codec;
-       struct wm8990_priv *wm8990 = codec->private_data;
+       struct wm8990_priv *wm8990 = snd_soc_codec_get_drvdata(codec);
 
        wm8990->sysclk = freq;
        return 0;
@@ -1523,7 +1523,7 @@ static int wm8990_probe(struct platform_device *pdev)
                return -ENOMEM;
        }
 
-       codec->private_data = wm8990;
+       snd_soc_codec_set_drvdata(codec, wm8990);
        socdev->card->codec = codec;
        mutex_init(&codec->mutex);
        INIT_LIST_HEAD(&codec->dapm_widgets);
@@ -1540,7 +1540,7 @@ static int wm8990_probe(struct platform_device *pdev)
 #endif
 
        if (ret != 0) {
-               kfree(codec->private_data);
+               kfree(snd_soc_codec_get_drvdata(codec));
                kfree(codec);
        }
        return ret;
@@ -1560,7 +1560,7 @@ static int wm8990_remove(struct platform_device *pdev)
        i2c_unregister_device(codec->control_data);
        i2c_del_driver(&wm8990_i2c_driver);
 #endif
-       kfree(codec->private_data);
+       kfree(snd_soc_codec_get_drvdata(codec));
        kfree(codec);
 
        return 0;
index bf022f6..e739c50 100644 (file)
@@ -370,7 +370,7 @@ static int wm8993_set_fll(struct snd_soc_dai *dai, int fll_id, int source,
                          unsigned int Fref, unsigned int Fout)
 {
        struct snd_soc_codec *codec = dai->codec;
-       struct wm8993_priv *wm8993 = codec->private_data;
+       struct wm8993_priv *wm8993 = snd_soc_codec_get_drvdata(codec);
        u16 reg1, reg4, reg5;
        struct _fll_div fll_div;
        int ret;
@@ -457,7 +457,7 @@ static int wm8993_set_fll(struct snd_soc_dai *dai, int fll_id, int source,
 
 static int configure_clock(struct snd_soc_codec *codec)
 {
-       struct wm8993_priv *wm8993 = codec->private_data;
+       struct wm8993_priv *wm8993 = snd_soc_codec_get_drvdata(codec);
        unsigned int reg;
 
        /* This should be done on init() for bypass paths */
@@ -716,7 +716,7 @@ static int class_w_put(struct snd_kcontrol *kcontrol,
 {
        struct snd_soc_dapm_widget *widget = snd_kcontrol_chip(kcontrol);
        struct snd_soc_codec *codec = widget->codec;
-       struct wm8993_priv *wm8993 = codec->private_data;
+       struct wm8993_priv *wm8993 = snd_soc_codec_get_drvdata(codec);
        int ret;
 
        /* Turn it off if we're using the main output mixer */
@@ -948,7 +948,7 @@ static void wm8993_cache_restore(struct snd_soc_codec *codec)
 static int wm8993_set_bias_level(struct snd_soc_codec *codec,
                                 enum snd_soc_bias_level level)
 {
-       struct wm8993_priv *wm8993 = codec->private_data;
+       struct wm8993_priv *wm8993 = snd_soc_codec_get_drvdata(codec);
        int ret;
 
        switch (level) {
@@ -1046,7 +1046,7 @@ static int wm8993_set_sysclk(struct snd_soc_dai *codec_dai,
                             int clk_id, unsigned int freq, int dir)
 {
        struct snd_soc_codec *codec = codec_dai->codec;
-       struct wm8993_priv *wm8993 = codec->private_data;
+       struct wm8993_priv *wm8993 = snd_soc_codec_get_drvdata(codec);
 
        switch (clk_id) {
        case WM8993_SYSCLK_MCLK:
@@ -1066,7 +1066,7 @@ static int wm8993_set_dai_fmt(struct snd_soc_dai *dai,
                              unsigned int fmt)
 {
        struct snd_soc_codec *codec = dai->codec;
-       struct wm8993_priv *wm8993 = codec->private_data;
+       struct wm8993_priv *wm8993 = snd_soc_codec_get_drvdata(codec);
        unsigned int aif1 = snd_soc_read(codec, WM8993_AUDIO_INTERFACE_1);
        unsigned int aif4 = snd_soc_read(codec, WM8993_AUDIO_INTERFACE_4);
 
@@ -1162,7 +1162,7 @@ static int wm8993_hw_params(struct snd_pcm_substream *substream,
                            struct snd_soc_dai *dai)
 {
        struct snd_soc_codec *codec = dai->codec;
-       struct wm8993_priv *wm8993 = codec->private_data;
+       struct wm8993_priv *wm8993 = snd_soc_codec_get_drvdata(codec);
        int ret, i, best, best_val, cur_val;
        unsigned int clocking1, clocking3, aif1, aif4;
 
@@ -1327,7 +1327,7 @@ static int wm8993_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask,
                               unsigned int rx_mask, int slots, int slot_width)
 {
        struct snd_soc_codec *codec = dai->codec;
-       struct wm8993_priv *wm8993 = codec->private_data;
+       struct wm8993_priv *wm8993 = snd_soc_codec_get_drvdata(codec);
        int aif1 = 0;
        int aif2 = 0;
 
@@ -1430,7 +1430,7 @@ static int wm8993_probe(struct platform_device *pdev)
 
        socdev->card->codec = wm8993_codec;
        codec = wm8993_codec;
-       wm8993 = codec->private_data;
+       wm8993 = snd_soc_codec_get_drvdata(codec);
 
        ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1);
        if (ret < 0) {
@@ -1477,7 +1477,7 @@ static int wm8993_suspend(struct platform_device *pdev, pm_message_t state)
 {
        struct snd_soc_device *socdev = platform_get_drvdata(pdev);
        struct snd_soc_codec *codec = socdev->card->codec;
-       struct wm8993_priv *wm8993 = codec->private_data;
+       struct wm8993_priv *wm8993 = snd_soc_codec_get_drvdata(codec);
        int fll_fout = wm8993->fll_fout;
        int fll_fref  = wm8993->fll_fref;
        int ret;
@@ -1501,7 +1501,7 @@ static int wm8993_resume(struct platform_device *pdev)
 {
        struct snd_soc_device *socdev = platform_get_drvdata(pdev);
        struct snd_soc_codec *codec = socdev->card->codec;
-       struct wm8993_priv *wm8993 = codec->private_data;
+       struct wm8993_priv *wm8993 = snd_soc_codec_get_drvdata(codec);
        int ret;
 
        wm8993_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
@@ -1570,7 +1570,7 @@ static int wm8993_i2c_probe(struct i2c_client *i2c,
        codec->set_bias_level = wm8993_set_bias_level;
        codec->dai = &wm8993_dai;
        codec->num_dai = 1;
-       codec->private_data = wm8993;
+       snd_soc_codec_set_drvdata(codec, wm8993);
 
        wm8993->hubs_data.hp_startup_mode = 1;
        wm8993->hubs_data.dcs_codes = -2;
index e00201e..29c4cfc 100644 (file)
@@ -1703,7 +1703,7 @@ static int wm8994_volatile(unsigned int reg)
 static int wm8994_write(struct snd_soc_codec *codec, unsigned int reg,
        unsigned int value)
 {
-       struct wm8994_priv *wm8994 = codec->private_data;
+       struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
 
        BUG_ON(reg > WM8994_MAX_REGISTER);
 
@@ -1728,7 +1728,7 @@ static unsigned int wm8994_read(struct snd_soc_codec *codec,
 
 static int configure_aif_clock(struct snd_soc_codec *codec, int aif)
 {
-       struct wm8994_priv *wm8994 = codec->private_data;
+       struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
        int rate;
        int reg1 = 0;
        int offset;
@@ -1780,7 +1780,7 @@ static int configure_aif_clock(struct snd_soc_codec *codec, int aif)
 
 static int configure_clock(struct snd_soc_codec *codec)
 {
-       struct wm8994_priv *wm8994 = codec->private_data;
+       struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
        int old, new;
 
        /* Bring up the AIF clocks first */
@@ -1877,7 +1877,7 @@ static int wm8994_put_drc_sw(struct snd_kcontrol *kcontrol,
 
 static void wm8994_set_drc(struct snd_soc_codec *codec, int drc)
 {
-       struct wm8994_priv *wm8994 = codec->private_data;
+       struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
        struct wm8994_pdata *pdata = wm8994->pdata;
        int base = wm8994_drc_base[drc];
        int cfg = wm8994->drc_cfg[drc];
@@ -1913,7 +1913,7 @@ static int wm8994_put_drc_enum(struct snd_kcontrol *kcontrol,
                               struct snd_ctl_elem_value *ucontrol)
 {
        struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
-       struct wm8994_priv *wm8994 = codec->private_data;       
+       struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);  
        struct wm8994_pdata *pdata = wm8994->pdata;
        int drc = wm8994_get_drc(kcontrol->id.name);
        int value = ucontrol->value.integer.value[0];
@@ -1935,7 +1935,7 @@ static int wm8994_get_drc_enum(struct snd_kcontrol *kcontrol,
                               struct snd_ctl_elem_value *ucontrol)
 {
        struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
-       struct wm8994_priv *wm8994 = codec->private_data;
+       struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
        int drc = wm8994_get_drc(kcontrol->id.name);
 
        ucontrol->value.enumerated.item[0] = wm8994->drc_cfg[drc];
@@ -1945,7 +1945,7 @@ static int wm8994_get_drc_enum(struct snd_kcontrol *kcontrol,
 
 static void wm8994_set_retune_mobile(struct snd_soc_codec *codec, int block)
 {
-       struct wm8994_priv *wm8994 = codec->private_data;
+       struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
        struct wm8994_pdata *pdata = wm8994->pdata;
        int base = wm8994_retune_mobile_base[block];
        int iface, best, best_val, save, i, cfg;
@@ -2016,7 +2016,7 @@ static int wm8994_put_retune_mobile_enum(struct snd_kcontrol *kcontrol,
                                         struct snd_ctl_elem_value *ucontrol)
 {
        struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
-       struct wm8994_priv *wm8994 = codec->private_data;       
+       struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);  
        struct wm8994_pdata *pdata = wm8994->pdata;
        int block = wm8994_get_retune_mobile_block(kcontrol->id.name);
        int value = ucontrol->value.integer.value[0];
@@ -2038,7 +2038,7 @@ static int wm8994_get_retune_mobile_enum(struct snd_kcontrol *kcontrol,
                                         struct snd_ctl_elem_value *ucontrol)
 {
        struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
-       struct wm8994_priv *wm8994 = codec->private_data;
+       struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
        int block = wm8994_get_retune_mobile_block(kcontrol->id.name);
 
        ucontrol->value.enumerated.item[0] = wm8994->retune_mobile_cfg[block];
@@ -2819,7 +2819,7 @@ static int wm8994_set_fll(struct snd_soc_dai *dai, int id, int src,
                          unsigned int freq_in, unsigned int freq_out)
 {
        struct snd_soc_codec *codec = dai->codec;
-       struct wm8994_priv *wm8994 = codec->private_data;
+       struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
        int reg_offset, ret;
        struct fll_div fll;
        u16 reg, aif1, aif2;
@@ -2915,7 +2915,7 @@ static int wm8994_set_dai_sysclk(struct snd_soc_dai *dai,
                int clk_id, unsigned int freq, int dir)
 {
        struct snd_soc_codec *codec = dai->codec;
-       struct wm8994_priv *wm8994 = codec->private_data;
+       struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
 
        switch (dai->id) {
        case 1:
@@ -3181,7 +3181,7 @@ static int wm8994_hw_params(struct snd_pcm_substream *substream,
                            struct snd_soc_dai *dai)
 {
        struct snd_soc_codec *codec = dai->codec;
-       struct wm8994_priv *wm8994 = codec->private_data;
+       struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
        int aif1_reg;
        int bclk_reg;
        int lrclk_reg;
@@ -3468,7 +3468,7 @@ static int wm8994_suspend(struct platform_device *pdev, pm_message_t state)
 {
        struct snd_soc_device *socdev = platform_get_drvdata(pdev);
        struct snd_soc_codec *codec = socdev->card->codec;
-       struct wm8994_priv *wm8994 = codec->private_data;
+       struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
        int i, ret;
 
        for (i = 0; i < ARRAY_SIZE(wm8994->fll); i++) {
@@ -3489,7 +3489,7 @@ static int wm8994_resume(struct platform_device *pdev)
 {
        struct snd_soc_device *socdev = platform_get_drvdata(pdev);
        struct snd_soc_codec *codec = socdev->card->codec;
-       struct wm8994_priv *wm8994 = codec->private_data;
+       struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
        u16 *reg_cache = codec->reg_cache;
        int i, ret;
 
@@ -3684,7 +3684,7 @@ static int wm8994_probe(struct platform_device *pdev)
                return ret;
        }
 
-       wm8994_handle_pdata(codec->private_data);
+       wm8994_handle_pdata(snd_soc_codec_get_drvdata(codec));
 
        wm_hubs_add_analogue_controls(codec);
        snd_soc_add_controls(codec, wm8994_snd_controls,
@@ -3735,7 +3735,7 @@ EXPORT_SYMBOL_GPL(soc_codec_dev_wm8994);
 int wm8994_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack,
                      int micbias, int det, int shrt)
 {
-       struct wm8994_priv *wm8994 = codec->private_data;
+       struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
        struct wm8994_micdet *micdet;
        int reg;
 
@@ -3830,7 +3830,7 @@ static int wm8994_codec_probe(struct platform_device *pdev)
        INIT_LIST_HEAD(&codec->dapm_widgets);
        INIT_LIST_HEAD(&codec->dapm_paths);
 
-       codec->private_data = wm8994;
+       snd_soc_codec_set_drvdata(codec, wm8994);
        codec->control_data = dev_get_drvdata(pdev->dev.parent);
        codec->name = "WM8994";
        codec->owner = THIS_MODULE;
index c468497..87a8748 100644 (file)
@@ -520,7 +520,7 @@ static int fll_factors(struct _fll_div *fll_div, unsigned int Fref,
 static int wm9081_set_fll(struct snd_soc_codec *codec, int fll_id,
                          unsigned int Fref, unsigned int Fout)
 {
-       struct wm9081_priv *wm9081 = codec->private_data;
+       struct wm9081_priv *wm9081 = snd_soc_codec_get_drvdata(codec);
        u16 reg1, reg4, reg5;
        struct _fll_div fll_div;
        int ret;
@@ -606,7 +606,7 @@ static int wm9081_set_fll(struct snd_soc_codec *codec, int fll_id,
 
 static int configure_clock(struct snd_soc_codec *codec)
 {
-       struct wm9081_priv *wm9081 = codec->private_data;
+       struct wm9081_priv *wm9081 = snd_soc_codec_get_drvdata(codec);
        int new_sysclk, i, target;
        unsigned int reg;
        int ret = 0;
@@ -701,7 +701,7 @@ static int clk_sys_event(struct snd_soc_dapm_widget *w,
                         struct snd_kcontrol *kcontrol, int event)
 {
        struct snd_soc_codec *codec = w->codec;
-       struct wm9081_priv *wm9081 = codec->private_data;
+       struct wm9081_priv *wm9081 = snd_soc_codec_get_drvdata(codec);
 
        /* This should be done on init() for bypass paths */
        switch (wm9081->sysclk_source) {
@@ -872,7 +872,7 @@ static int wm9081_set_dai_fmt(struct snd_soc_dai *dai,
                              unsigned int fmt)
 {
        struct snd_soc_codec *codec = dai->codec;
-       struct wm9081_priv *wm9081 = codec->private_data;
+       struct wm9081_priv *wm9081 = snd_soc_codec_get_drvdata(codec);
        unsigned int aif2 = snd_soc_read(codec, WM9081_AUDIO_INTERFACE_2);
 
        aif2 &= ~(WM9081_AIF_BCLK_INV | WM9081_AIF_LRCLK_INV |
@@ -964,7 +964,7 @@ static int wm9081_hw_params(struct snd_pcm_substream *substream,
                            struct snd_soc_dai *dai)
 {
        struct snd_soc_codec *codec = dai->codec;
-       struct wm9081_priv *wm9081 = codec->private_data;
+       struct wm9081_priv *wm9081 = snd_soc_codec_get_drvdata(codec);
        int ret, i, best, best_val, cur_val;
        unsigned int clk_ctrl2, aif1, aif2, aif3, aif4;
 
@@ -1138,7 +1138,7 @@ static int wm9081_set_sysclk(struct snd_soc_dai *codec_dai,
                             int clk_id, unsigned int freq, int dir)
 {
        struct snd_soc_codec *codec = codec_dai->codec;
-       struct wm9081_priv *wm9081 = codec->private_data;
+       struct wm9081_priv *wm9081 = snd_soc_codec_get_drvdata(codec);
 
        switch (clk_id) {
        case WM9081_SYSCLK_MCLK:
@@ -1158,7 +1158,7 @@ static int wm9081_set_tdm_slot(struct snd_soc_dai *dai,
        unsigned int tx_mask, unsigned int rx_mask, int slots, int slot_width)
 {
        struct snd_soc_codec *codec = dai->codec;
-       struct wm9081_priv *wm9081 = codec->private_data;
+       struct wm9081_priv *wm9081 = snd_soc_codec_get_drvdata(codec);
        unsigned int aif1 = snd_soc_read(codec, WM9081_AUDIO_INTERFACE_1);
 
        aif1 &= ~(WM9081_AIFDAC_TDM_SLOT_MASK | WM9081_AIFDAC_TDM_MODE_MASK);
@@ -1241,7 +1241,7 @@ static int wm9081_probe(struct platform_device *pdev)
 
        socdev->card->codec = wm9081_codec;
        codec = wm9081_codec;
-       wm9081 = codec->private_data;
+       wm9081 = snd_soc_codec_get_drvdata(codec);
 
        /* register pcms */
        ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1);
@@ -1338,7 +1338,7 @@ static int wm9081_register(struct wm9081_priv *wm9081,
        INIT_LIST_HEAD(&codec->dapm_widgets);
        INIT_LIST_HEAD(&codec->dapm_paths);
 
-       codec->private_data = wm9081;
+       snd_soc_codec_set_drvdata(codec, wm9081);
        codec->name = "WM9081";
        codec->owner = THIS_MODULE;
        codec->dai = &wm9081_dai;
index ceb86b4..d2244c9 100644 (file)
@@ -763,7 +763,7 @@ static void pll_factors(struct _pll_div *pll_div, unsigned int source)
 static int wm9713_set_pll(struct snd_soc_codec *codec,
        int pll_id, unsigned int freq_in, unsigned int freq_out)
 {
-       struct wm9713_priv *wm9713 = codec->private_data;
+       struct wm9713_priv *wm9713 = snd_soc_codec_get_drvdata(codec);
        u16 reg, reg2;
        struct _pll_div pll_div;
 
@@ -1174,7 +1174,7 @@ static int wm9713_soc_resume(struct platform_device *pdev)
 {
        struct snd_soc_device *socdev = platform_get_drvdata(pdev);
        struct snd_soc_codec *codec = socdev->card->codec;
-       struct wm9713_priv *wm9713 = codec->private_data;
+       struct wm9713_priv *wm9713 = snd_soc_codec_get_drvdata(codec);
        int i, ret;
        u16 *cache = codec->reg_cache;
 
@@ -1227,8 +1227,9 @@ static int wm9713_soc_probe(struct platform_device *pdev)
        codec->reg_cache_size = sizeof(wm9713_reg);
        codec->reg_cache_step = 2;
 
-       codec->private_data = kzalloc(sizeof(struct wm9713_priv), GFP_KERNEL);
-       if (codec->private_data == NULL) {
+       snd_soc_codec_set_drvdata(codec, kzalloc(sizeof(struct wm9713_priv),
+                                                GFP_KERNEL));
+       if (snd_soc_codec_get_drvdata(codec) == NULL) {
                ret = -ENOMEM;
                goto priv_err;
        }
@@ -1279,7 +1280,7 @@ pcm_err:
        snd_soc_free_ac97_codec(codec);
 
 codec_err:
-       kfree(codec->private_data);
+       kfree(snd_soc_codec_get_drvdata(codec));
 
 priv_err:
        kfree(codec->reg_cache);
@@ -1301,7 +1302,7 @@ static int wm9713_soc_remove(struct platform_device *pdev)
        snd_soc_dapm_free(socdev);
        snd_soc_free_pcms(socdev);
        snd_soc_free_ac97_codec(codec);
-       kfree(codec->private_data);
+       kfree(snd_soc_codec_get_drvdata(codec));
        kfree(codec->reg_cache);
        kfree(codec);
        return 0;
index e1f225a..defdbd0 100644 (file)
@@ -91,7 +91,7 @@ static void wait_for_dc_servo(struct snd_soc_codec *codec, unsigned int op)
  */
 static void calibrate_dc_servo(struct snd_soc_codec *codec)
 {
-       struct wm_hubs_data *hubs = codec->private_data;
+       struct wm_hubs_data *hubs = snd_soc_codec_get_drvdata(codec);
        u16 reg, reg_l, reg_r, dcs_cfg;
 
        /* Set for 32 series updates */
@@ -154,7 +154,7 @@ static int wm8993_put_dc_servo(struct snd_kcontrol *kcontrol,
                               struct snd_ctl_elem_value *ucontrol)
 {
        struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
-       struct wm_hubs_data *hubs = codec->private_data;
+       struct wm_hubs_data *hubs = snd_soc_codec_get_drvdata(codec);
        int ret;
 
        ret = snd_soc_put_volsw_2r(kcontrol, ucontrol);
@@ -327,7 +327,7 @@ static int hp_supply_event(struct snd_soc_dapm_widget *w,
                           struct snd_kcontrol *kcontrol, int event)
 {
        struct snd_soc_codec *codec = w->codec;
-       struct wm_hubs_data *hubs = codec->private_data;
+       struct wm_hubs_data *hubs = snd_soc_codec_get_drvdata(codec);
 
        switch (event) {
        case SND_SOC_DAPM_PRE_PMU: