diff options
author | Takashi Iwai <tiwai@suse.de> | 2006-06-23 08:38:23 -0400 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2006-09-23 04:36:58 -0400 |
commit | c461482c8072bb073e6146db320d3da85cdc89ad (patch) | |
tree | 3b69cfd292a488a8cb57ac9b040bd2b1b1a1e26d /sound/pci | |
parent | 746d4a02e68499fc6c1f8d0c43d2271853ade181 (diff) |
[ALSA] Unregister device files at disconnection
Orignally proposed by Sam Revitch <sam.revitch@gmail.com>.
Unregister device files at disconnection to avoid the futher accesses.
Also, the dev_unregister callback is removed and replaced with the
combination of disconnect + free.
A new function snd_card_free_when_closed() is introduced, which is
used in USB disconnect callback.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Diffstat (limited to 'sound/pci')
-rw-r--r-- | sound/pci/ac97/ac97_codec.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c index 51e83d7a839a..b35280ca2465 100644 --- a/sound/pci/ac97/ac97_codec.c +++ b/sound/pci/ac97/ac97_codec.c | |||
@@ -1817,13 +1817,13 @@ static int snd_ac97_dev_register(struct snd_device *device) | |||
1817 | return 0; | 1817 | return 0; |
1818 | } | 1818 | } |
1819 | 1819 | ||
1820 | /* unregister ac97 codec */ | 1820 | /* disconnect ac97 codec */ |
1821 | static int snd_ac97_dev_unregister(struct snd_device *device) | 1821 | static int snd_ac97_dev_disconnect(struct snd_device *device) |
1822 | { | 1822 | { |
1823 | struct snd_ac97 *ac97 = device->device_data; | 1823 | struct snd_ac97 *ac97 = device->device_data; |
1824 | if (ac97->dev.bus) | 1824 | if (ac97->dev.bus) |
1825 | device_unregister(&ac97->dev); | 1825 | device_unregister(&ac97->dev); |
1826 | return snd_ac97_free(ac97); | 1826 | return 0; |
1827 | } | 1827 | } |
1828 | 1828 | ||
1829 | /* build_ops to do nothing */ | 1829 | /* build_ops to do nothing */ |
@@ -1860,7 +1860,7 @@ int snd_ac97_mixer(struct snd_ac97_bus *bus, struct snd_ac97_template *template, | |||
1860 | static struct snd_device_ops ops = { | 1860 | static struct snd_device_ops ops = { |
1861 | .dev_free = snd_ac97_dev_free, | 1861 | .dev_free = snd_ac97_dev_free, |
1862 | .dev_register = snd_ac97_dev_register, | 1862 | .dev_register = snd_ac97_dev_register, |
1863 | .dev_unregister = snd_ac97_dev_unregister, | 1863 | .dev_disconnect = snd_ac97_dev_disconnect, |
1864 | }; | 1864 | }; |
1865 | 1865 | ||
1866 | snd_assert(rac97 != NULL, return -EINVAL); | 1866 | snd_assert(rac97 != NULL, return -EINVAL); |