[PATCH 1/2] Fix WM8753 codec device unloading
Paul Fertser
fercerpav at gmail.com
Sun Feb 15 23:59:03 CET 2009
WM8753 can be connected by either I2C or SPI; do not try to unregister from
the buses that are not used.
Signed-off-by: Paul Fertser <fercerpav at gmail.com>
---
sound/soc/codecs/wm8753.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/sound/soc/codecs/wm8753.c b/sound/soc/codecs/wm8753.c
index 3a1b001..93e87d9 100644
--- a/sound/soc/codecs/wm8753.c
+++ b/sound/soc/codecs/wm8753.c
@@ -1873,6 +1873,7 @@ static int wm8753_remove(struct platform_device *pdev)
{
struct snd_soc_device *socdev = platform_get_drvdata(pdev);
struct snd_soc_codec *codec = socdev->codec;
+ struct wm8753_setup_data *setup = socdev->codec_data;
if (codec->control_data)
wm8753_set_bias_level(codec, SND_SOC_BIAS_OFF);
@@ -1880,10 +1881,14 @@ static int wm8753_remove(struct platform_device *pdev)
snd_soc_free_pcms(socdev);
snd_soc_dapm_free(socdev);
#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
- i2c_del_driver(&wm8753_i2c_driver);
+ if (setup->i2c_address) {
+ i2c_del_driver(&wm8753_i2c_driver);
+ }
#endif
#if defined(CONFIG_SPI_MASTER)
- spi_unregister_driver(&wm8753_spi_driver);
+ if (setup->spi) {
+ spi_unregister_driver(&wm8753_spi_driver);
+ }
#endif
kfree(codec->private_data);
kfree(codec);
--
1.5.2.2
More information about the openmoko-kernel
mailing list