[alsa-devel] [PATCH] ASoC: cs4271: free reset gpio in cs4271_remove()

Daniel Mack zonque at gmail.com
Wed Feb 19 12:07:12 CET 2014


The reset GPIO line is acquired in cs4271_probe(), so it should be
freed from cs4271_remove() as well. This way, the driver can unloaded
and reloaded more than once.

Signed-off-by: Daniel Mack <zonque at gmail.com>
---
 sound/soc/codecs/cs4271.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/sound/soc/codecs/cs4271.c b/sound/soc/codecs/cs4271.c
index ce05fd9..aeaa5c6 100644
--- a/sound/soc/codecs/cs4271.c
+++ b/sound/soc/codecs/cs4271.c
@@ -604,9 +604,11 @@ static int cs4271_remove(struct snd_soc_codec *codec)
 {
 	struct cs4271_private *cs4271 = snd_soc_codec_get_drvdata(codec);
 
-	if (gpio_is_valid(cs4271->gpio_nreset))
+	if (gpio_is_valid(cs4271->gpio_nreset)) {
 		/* Set codec to the reset state */
 		gpio_set_value(cs4271->gpio_nreset, 0);
+		devm_gpio_free(codec->dev, cs4271->gpio_nreset);
+	}
 
 	return 0;
 };
-- 
1.8.5.3



More information about the Alsa-devel mailing list