ASoC: Only unregister drivers we registered for WM8753

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Thursday, March 26, 2009 - 12:08 pm

Gitweb:     http://git.kernel.org/linus/93e051d2771e6bf70e86b8265bfbf296a457d044
Commit:     93e051d2771e6bf70e86b8265bfbf296a457d044
Parent:     eeb1080b29a0fa00e426ba77eb96f3a157b335ab
Author:     Mark Brown <broonie@opensource.wolfsonmicro.com>
AuthorDate: Sun Feb 22 14:24:00 2009 +0000
Committer:  Mark Brown <broonie@opensource.wolfsonmicro.com>
CommitDate: Sun Feb 22 14:24:00 2009 +0000

    ASoC: Only unregister drivers we registered for WM8753
    
    Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
 sound/soc/codecs/wm8753.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/sound/soc/codecs/wm8753.c b/sound/soc/codecs/wm8753.c
index 180ec94..93c22c4 100644
--- a/sound/soc/codecs/wm8753.c
+++ b/sound/soc/codecs/wm8753.c
@@ -1845,6 +1845,7 @@ static int wm8753_remove(struct platform_device *pdev)
 {
 	struct snd_soc_device *socdev = platform_get_drvdata(pdev);
 	struct snd_soc_codec *codec = socdev->card->codec;
+	struct wm8753_setup_data *setup = socdev->codec_data;
 
 	if (codec->control_data)
 		wm8753_set_bias_level(codec, SND_SOC_BIAS_OFF);
@@ -1852,11 +1853,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_unregister_device(codec->control_data);
-	i2c_del_driver(&wm8753_i2c_driver);
+	if (setup->i2c_address) {
+		i2c_unregister_device(codec->control_data);
+		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);
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
ASoC: Only unregister drivers we registered for WM8753, Linux Kernel Mailing ..., (Thu Mar 26, 12:08 pm)