Index: linux-2.6.15-rc2/include/sound/soc.h
===================================================================
--- linux-2.6.15-rc2.orig/include/sound/soc.h	2005-12-03 13:49:43.000000000 +0000
+++ linux-2.6.15-rc2/include/sound/soc.h	2005-12-03 15:41:58.000000000 +0000
@@ -275,12 +275,10 @@
 };
 
 struct snd_soc_codec_device {
-	struct platform_device *pdev;
 	int (*probe)(struct platform_device *pdev);
 	int (*remove)(struct platform_device *pdev);
 	int (*suspend)(struct platform_device *pdev, pm_message_t state);
 	int (*resume)(struct platform_device *pdev);
-	void *codec_data;
 };
 
 
@@ -333,6 +331,7 @@
 	struct snd_soc_platform *platform;
 	struct snd_soc_codec *codec;
 	struct snd_soc_codec_device *codec_dev;
+	void *codec_data;
 };
 
 /* enamerated kcontrol */
Index: linux-2.6.15-rc2/sound/soc/codecs/wm8731.c
===================================================================
--- linux-2.6.15-rc2.orig/sound/soc/codecs/wm8731.c	2005-12-03 13:05:36.000000000 +0000
+++ linux-2.6.15-rc2/sound/soc/codecs/wm8731.c	2005-12-03 16:44:24.000000000 +0000
@@ -491,14 +491,19 @@
 static struct i2c_driver wm8731_i2c_driver;
 static struct i2c_client client_template;
 
+/* If the i2c layer weren't so broken, we could pass this kind of data
+   around */
+static struct platform_device *wm8731_device;
+
 static int corgi_codec_probe(struct i2c_adapter *adap, int addr, int kind)
 {
-	struct snd_soc_platdev_data *devdata = platform_get_drvdata(soc_codec_dev_wm8731.pdev);
+	struct snd_soc_platdev_data *devdata = platform_get_drvdata(wm8731_device);
+	struct wm8731_setup_data *setup = devdata->codec_data;
 	struct snd_soc_codec* codec = devdata->codec;
 	struct i2c_client *i2c;
 	int ret;
 
-	if (addr != (int)soc_codec_dev_wm8731.codec_data)
+	if (addr != setup->i2c_address)
 		return -ENODEV;
 
 	client_template.adapter = adap;
@@ -561,8 +566,8 @@
 static int wm8731_probe(struct platform_device *pdev)
 {
 	struct snd_soc_platdev_data *devdata = platform_get_drvdata(pdev);
+	struct wm8731_setup_data *setup = devdata->codec_data;
 	struct snd_soc_codec* codec;
-	int codec_data = (int) soc_codec_dev_wm8731.codec_data;
 	int ret = 0;
 
 	info("WM8731 Audio Codec %s", WM8731_VERSION);
@@ -577,8 +582,10 @@
 	INIT_LIST_HEAD(&codec->dpm_widgets);
 	INIT_LIST_HEAD(&codec->dpm_paths);
 
-	if (codec_data) {
-		normal_i2c[0] = (int)codec_data;
+	wm8731_device = pdev;
+
+	if (setup->i2c_address) {
+		normal_i2c[0] = setup->i2c_address;
 		codec->hw_write = (hw_write_t)i2c_master_send;
 		if ((ret = i2c_add_driver(&wm8731_i2c_driver)) != 0)
 			printk(KERN_ERR "can't add i2c driver");
@@ -597,10 +604,11 @@
 	struct snd_soc_platdev_data *devdata = platform_get_drvdata(pdev);
 	struct snd_soc_codec* codec = devdata->codec;
 
-	i2c_del_driver(&wm8731_i2c_driver);
+	if (codec->control_data)
+		wm8731_dpm_event(codec, SNDRV_CTL_POWER_D3cold);
 
-	wm8731_dpm_event(codec, SNDRV_CTL_POWER_D3cold);
 	snd_soc_free_pcms(codec);
+	i2c_del_driver(&wm8731_i2c_driver);
 	kfree(codec);
 
 	return 0;
Index: linux-2.6.15-rc2/sound/soc/codecs/wm8731.h
===================================================================
--- linux-2.6.15-rc2.orig/sound/soc/codecs/wm8731.h	2005-12-03 01:10:04.000000000 +0000
+++ linux-2.6.15-rc2/sound/soc/codecs/wm8731.h	2005-12-03 16:44:24.000000000 +0000
@@ -31,6 +31,11 @@
 
 #define WM8731_CACHEREGNUM 	10
 
+struct wm8731_setup_data {
+	unsigned short i2c_address;
+};
+
+
 extern struct snd_soc_codec_device soc_codec_dev_wm8731;
 
 #endif
Index: linux-2.6.15-rc2/sound/soc/pxa/corgi.c
===================================================================
--- linux-2.6.15-rc2.orig/sound/soc/pxa/corgi.c	2005-12-03 13:05:36.000000000 +0000
+++ linux-2.6.15-rc2/sound/soc/pxa/corgi.c	2005-12-03 16:44:24.000000000 +0000
@@ -216,7 +216,7 @@
 static struct snd_soc_machine_config codecs[] = {
 {
 	.name = "WM8731", 
-	.sname = "WM8731 HiFi", 
+	.sname = "WM8731",
 	.iface = &pxa_i2s_interface,
 //	.init = corgi_wm8731_init, -- see above
 },
@@ -234,10 +234,15 @@
 	.nconfigs = ARRAY_SIZE(codecs),
 };
 
+static struct wm8731_setup_data corgi_wm8731_setup = {
+	.i2c_address = 0x1b,
+};
+
 static struct snd_soc_platdev_data corgi_snd_devdata = {
 	.machine = &snd_soc_machine_corgi,
 	.platform = &pxa2xx_soc_platform,
 	.codec_dev = &soc_codec_dev_wm8731,
+	.codec_data = &corgi_wm8731_setup,
 };
 
 static struct platform_device *corgi_snd_device;
@@ -247,14 +252,12 @@
 	int ret;
 
 	pxa_i2s_interface.machine = &corgi;
-	soc_codec_dev_wm8731.pdev = corgi_snd_device;
-	soc_codec_dev_wm8731.codec_data = (void *) 0x1a;
 
 	corgi_snd_device = platform_device_alloc("soc-audio", -1);
 	if (!corgi_snd_device)
 		return -ENOMEM;
 
-	corgi_snd_device->dev.platform_data = &corgi_snd_devdata;
+	platform_set_drvdata(corgi_snd_device, &corgi_snd_devdata);
 	ret = platform_device_add(corgi_snd_device);
 
 	if (ret)
