Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ASoC: tegra+alc5632: unconditionally free jack GPIOs in remove

The headphone jack GPIOs are added/initialized in the DAI link's init()
method, and hence in theory may not always have been added before remove()
is called in some unusual cases. In order to prevent calling
snd_soc_jack_free_gpios() if snd_soc_jack_add_gpios() had not been, the
code kept track of the initialization state to avoid the free call when
necessary.

However, it appears that snd_soc_jack_free_gpios() is robust in the face
of being called without snd_soc_jack_add_gpios() first succeeding, so
there is little point manually tracking this information. Hence, remove
the tracking code. All other machine drivers already operate this way.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>

authored by

Stephen Warren and committed by
Mark Brown
9f6328d9 aef9a37c

+2 -9
+2 -9
sound/soc/tegra/tegra_alc5632.c
··· 33 33 34 34 #define DRV_NAME "tegra-alc5632" 35 35 36 - #define GPIO_HP_DET BIT(0) 37 - 38 36 struct tegra_alc5632 { 39 37 struct tegra_asoc_utils_data util_data; 40 - int gpio_requested; 41 38 int gpio_hp_det; 42 39 }; 43 40 ··· 120 123 snd_soc_jack_add_gpios(&tegra_alc5632_hs_jack, 121 124 1, 122 125 &tegra_alc5632_hp_jack_gpio); 123 - machine->gpio_requested |= GPIO_HP_DET; 124 126 } 125 127 126 128 snd_soc_dapm_force_enable_pin(dapm, "MICBIAS1"); ··· 232 236 struct snd_soc_card *card = platform_get_drvdata(pdev); 233 237 struct tegra_alc5632 *machine = snd_soc_card_get_drvdata(card); 234 238 235 - if (machine->gpio_requested & GPIO_HP_DET) 236 - snd_soc_jack_free_gpios(&tegra_alc5632_hs_jack, 237 - 1, 238 - &tegra_alc5632_hp_jack_gpio); 239 - machine->gpio_requested = 0; 239 + snd_soc_jack_free_gpios(&tegra_alc5632_hs_jack, 1, 240 + &tegra_alc5632_hp_jack_gpio); 240 241 241 242 snd_soc_unregister_card(card); 242 243