ASoC: Add indirection for CODEC private data

One of the features of the multi CODEC work is that it embeds a struct
device in the CODEC to provide diagnostics via a sysfs class rather than
via the device tree, at which point it's much better to use the struct
device private data rather than having two places to store it. Provide
an accessor function to allow this change to be made more easily, and
update all the CODEC drivers are updated.

To ensure use of the accessor the private data structure member is
renamed, meaning that if code developed with older an older core that
still uses private_data is merged it will fail to build.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
diff --git a/sound/soc/codecs/wm8904.c b/sound/soc/codecs/wm8904.c
index c5b50d7..a022ca7 100644
--- a/sound/soc/codecs/wm8904.c
+++ b/sound/soc/codecs/wm8904.c
@@ -612,7 +612,7 @@
 
 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 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 @@
 			       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 @@
 			       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 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 @@
 					 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 @@
 					 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 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 @@
 			     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 @@
 			      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 @@
 			 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 @@
 			 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 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 @@
 			    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 @@
 			     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 @@
 			       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 @@
 			  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 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 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 @@
 		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 @@
 	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;