ASoC: msm: Add support for multiple module unload and load

Check for gpio pin validity before calling
gpio_free. deregister audio notifier so that
while unloading and loading module again, the
old client of notifier is removed cleanly and
new one is added.

CRs-fixed: 2039099
Change-Id: I9a05c5705695d29601d65d1b9cc086515ac480f0
Signed-off-by: Karthikeyan Mani <kmani@codeaurora.org>
This commit is contained in:
Karthikeyan Mani
2017-04-25 18:40:04 -07:00
parent bb8a119b3c
commit f1504ccbde

View File

@@ -7413,10 +7413,12 @@ static int msm_asoc_machine_remove(struct platform_device *pdev)
struct msm_asoc_mach_data *pdata =
snd_soc_card_get_drvdata(card);
gpio_free(pdata->us_euro_gpio);
if (gpio_is_valid(pdata->us_euro_gpio))
gpio_free(pdata->us_euro_gpio);
i2s_auxpcm_deinit();
snd_soc_unregister_card(card);
audio_notifier_deregister("msm8998");
return 0;
}