ASoC: Add indirection for CODEC private data
[safe/jmp/linux-2.6] / sound / soc / codecs / wm8904.c
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;