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/core/hwdep.c | |
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/core/hwdep.c')
-rw-r--r-- | sound/core/hwdep.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/sound/core/hwdep.c b/sound/core/hwdep.c index cbd8a63282b6..9aa9d94891f0 100644 --- a/sound/core/hwdep.c +++ b/sound/core/hwdep.c | |||
@@ -42,7 +42,7 @@ static DEFINE_MUTEX(register_mutex); | |||
42 | static int snd_hwdep_free(struct snd_hwdep *hwdep); | 42 | static int snd_hwdep_free(struct snd_hwdep *hwdep); |
43 | static int snd_hwdep_dev_free(struct snd_device *device); | 43 | static int snd_hwdep_dev_free(struct snd_device *device); |
44 | static int snd_hwdep_dev_register(struct snd_device *device); | 44 | static int snd_hwdep_dev_register(struct snd_device *device); |
45 | static int snd_hwdep_dev_unregister(struct snd_device *device); | 45 | static int snd_hwdep_dev_disconnect(struct snd_device *device); |
46 | 46 | ||
47 | 47 | ||
48 | static struct snd_hwdep *snd_hwdep_search(struct snd_card *card, int device) | 48 | static struct snd_hwdep *snd_hwdep_search(struct snd_card *card, int device) |
@@ -353,7 +353,7 @@ int snd_hwdep_new(struct snd_card *card, char *id, int device, | |||
353 | static struct snd_device_ops ops = { | 353 | static struct snd_device_ops ops = { |
354 | .dev_free = snd_hwdep_dev_free, | 354 | .dev_free = snd_hwdep_dev_free, |
355 | .dev_register = snd_hwdep_dev_register, | 355 | .dev_register = snd_hwdep_dev_register, |
356 | .dev_unregister = snd_hwdep_dev_unregister | 356 | .dev_disconnect = snd_hwdep_dev_disconnect, |
357 | }; | 357 | }; |
358 | 358 | ||
359 | snd_assert(rhwdep != NULL, return -EINVAL); | 359 | snd_assert(rhwdep != NULL, return -EINVAL); |
@@ -439,7 +439,7 @@ static int snd_hwdep_dev_register(struct snd_device *device) | |||
439 | return 0; | 439 | return 0; |
440 | } | 440 | } |
441 | 441 | ||
442 | static int snd_hwdep_dev_unregister(struct snd_device *device) | 442 | static int snd_hwdep_dev_disconnect(struct snd_device *device) |
443 | { | 443 | { |
444 | struct snd_hwdep *hwdep = device->device_data; | 444 | struct snd_hwdep *hwdep = device->device_data; |
445 | 445 | ||
@@ -454,9 +454,9 @@ static int snd_hwdep_dev_unregister(struct snd_device *device) | |||
454 | snd_unregister_oss_device(hwdep->oss_type, hwdep->card, hwdep->device); | 454 | snd_unregister_oss_device(hwdep->oss_type, hwdep->card, hwdep->device); |
455 | #endif | 455 | #endif |
456 | snd_unregister_device(SNDRV_DEVICE_TYPE_HWDEP, hwdep->card, hwdep->device); | 456 | snd_unregister_device(SNDRV_DEVICE_TYPE_HWDEP, hwdep->card, hwdep->device); |
457 | list_del(&hwdep->list); | 457 | list_del_init(&hwdep->list); |
458 | mutex_unlock(®ister_mutex); | 458 | mutex_unlock(®ister_mutex); |
459 | return snd_hwdep_free(hwdep); | 459 | return 0; |
460 | } | 460 | } |
461 | 461 | ||
462 | #ifdef CONFIG_PROC_FS | 462 | #ifdef CONFIG_PROC_FS |