aboutsummaryrefslogtreecommitdiffstats
path: root/sound/core/oss/pcm_oss.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2006-06-23 08:38:23 -0400
committerJaroslav Kysela <perex@suse.cz>2006-09-23 04:36:58 -0400
commitc461482c8072bb073e6146db320d3da85cdc89ad (patch)
tree3b69cfd292a488a8cb57ac9b040bd2b1b1a1e26d /sound/core/oss/pcm_oss.c
parent746d4a02e68499fc6c1f8d0c43d2271853ade181 (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/core/oss/pcm_oss.c')
-rw-r--r--sound/core/oss/pcm_oss.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c
index a92b93e5ebd..505b23ec405 100644
--- a/sound/core/oss/pcm_oss.c
+++ b/sound/core/oss/pcm_oss.c
@@ -2929,25 +2929,23 @@ static int snd_pcm_oss_disconnect_minor(struct snd_pcm *pcm)
2929 snd_unregister_oss_device(SNDRV_OSS_DEVICE_TYPE_PCM, 2929 snd_unregister_oss_device(SNDRV_OSS_DEVICE_TYPE_PCM,
2930 pcm->card, 1); 2930 pcm->card, 1);
2931 } 2931 }
2932 }
2933 return 0;
2934}
2935
2936static int snd_pcm_oss_unregister_minor(struct snd_pcm *pcm)
2937{
2938 snd_pcm_oss_disconnect_minor(pcm);
2939 if (pcm->oss.reg) {
2940 if (dsp_map[pcm->card->number] == (int)pcm->device) { 2932 if (dsp_map[pcm->card->number] == (int)pcm->device) {
2941#ifdef SNDRV_OSS_INFO_DEV_AUDIO 2933#ifdef SNDRV_OSS_INFO_DEV_AUDIO
2942 snd_oss_info_unregister(SNDRV_OSS_INFO_DEV_AUDIO, pcm->card->number); 2934 snd_oss_info_unregister(SNDRV_OSS_INFO_DEV_AUDIO, pcm->card->number);
2943#endif 2935#endif
2944 } 2936 }
2945 pcm->oss.reg = 0; 2937 pcm->oss.reg = 0;
2946 snd_pcm_oss_proc_done(pcm);
2947 } 2938 }
2948 return 0; 2939 return 0;
2949} 2940}
2950 2941
2942static int snd_pcm_oss_unregister_minor(struct snd_pcm *pcm)
2943{
2944 snd_pcm_oss_disconnect_minor(pcm);
2945 snd_pcm_oss_proc_done(pcm);
2946 return 0;
2947}
2948
2951static struct snd_pcm_notify snd_pcm_oss_notify = 2949static struct snd_pcm_notify snd_pcm_oss_notify =
2952{ 2950{
2953 .n_register = snd_pcm_oss_register_minor, 2951 .n_register = snd_pcm_oss_register_minor,