linux/sound
Stephen Warren e1d4d3c854 ASoC: free jack GPIOs before the sound card is freed
This is the same change as commit fb6b8e7144 "ASoC: tegra: free jack
GPIOs before the sound card is freed", but applied to all other ASoC
machine drivers where code inspection indicates the same problem exists.

That commit's description is:
==========
snd_soc_jack_add_gpios() schedules a work queue item to poll the GPIO to
generate an initial jack status report. If sound card initialization
fails, that work item needs to be cancelled, so it doesn't run after the
card has been freed. Specifically, freeing the card calls
snd_jack_dev_free() which calls snd_jack_dev_disconnect() which sets
jack->input_dev = NULL, and input_dev is used by snd_jack_report(), which
is called from the work queue item.

snd_soc_jack_free_gpios() cancels the work item. The Tegra ASoC machine
drivers do call this function in the platform driver remove() callback.
However, this happens after the sound card is freed, at least when the
card is freed due to errors late during snd_soc_instantiate_card(). This
leaves a window where the work item can execute after the card is freed.
In next-20140522, sound card initialization does fail for unrelated
reasons, and hits the problem described above.

To solve this, fix the Tegra ASoC machine drivers to clean up the Jack
GPIOs during the snd_soc_card's .remove() callback, which is executed
before the overall card object is freed. also, guard the cleanup call
based on whether we actually setup up the GPIOs in the first place.
Ideally, we'd do the cleanup in a struct snd_soc_dai_link .fini/remove
function to match where the GPIOs get set up. However, there is no such
callback.
==========

Note that I have not even compile-tested this in most cases, since most
of the drivers rely on specific mach-* support I don't have enabled, and
don't support COMPILE_TEST. Testing by the relevant board maintainers
would be useful.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-06-03 10:41:16 +01:00
..
aoa ALSA: Drop __bitwise and typedefs for snd_device attributes 2014-02-14 08:20:24 +01:00
arm ASoC: pxa: remove mach header dependency 2014-05-20 23:14:49 +01:00
atmel ALSA: atmel: Convert to snd_card_new() with a device pointer 2014-02-14 08:14:04 +01:00
core Merge branch 'for-next' into for-linus 2014-03-31 12:16:31 +02:00
drivers ALSA: drivers: Convert to snd_card_new() with a device pointer 2014-02-12 10:58:20 +01:00
firewire ALSA: firewire: Convert to snd_card_new() with a device pointer 2014-02-14 08:13:31 +01:00
i2c ALSA: cs8427: separate HW initialization 2014-04-03 14:59:48 +02:00
isa ALSA: es18xx driver should use udelay error 2014-04-14 14:27:27 +02:00
mips ALSA: au1x00: use module_platform_driver() 2014-04-09 10:02:14 +02:00
oss sound fixes for 3.15-rc1 2014-04-10 09:19:44 -07:00
parisc ALSA: parisc: Convert to snd_card_new() with a device pointer 2014-02-14 08:14:05 +01:00
pci ALSA: hda - hdmi: Set converter channel count even without sink 2014-05-05 16:28:10 +02:00
pcmcia ALSA: pcmcia: Convert to snd_card_new() with a device pointer 2014-02-14 08:14:06 +01:00
ppc ALSA: ppc: Convert to snd_card_new() with a device pointer 2014-02-14 08:14:06 +01:00
sh ALSA: sh: Convert to snd_card_new() with a device pointer 2014-02-14 08:14:07 +01:00
soc ASoC: free jack GPIOs before the sound card is freed 2014-06-03 10:41:16 +01:00
sparc ALSA: sparc: Convert to snd_card_new() with a device pointer 2014-02-14 08:14:07 +01:00
spi ALSA: spi: Convert to snd_card_new() with a device pointer 2014-02-14 08:14:08 +01:00
synth
usb ALSA: usb-audio: work around corrupted TEAC UD-H01 feedback data 2014-05-02 18:21:55 +02:00
ac97_bus.c
Kconfig
last.c
Makefile
sound_core.c
sound_firmware.c