diff options
author | Clemens Ladisch <clemens@ladisch.de> | 2005-10-12 17:12:31 +0200 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2005-11-04 13:18:43 +0100 |
commit | de24214d0c8e78134875752619f99b9e5824c196 (patch) | |
tree | 147f8cdcf5dfb3be2d95409f7ac44af101d2e0a5 /sound/core/timer.c | |
parent | 2fd43d1159d22395aae01836c4b13ee5265a9b6b (diff) | |
download | linux-de24214d0c8e78134875752619f99b9e5824c196.tar.gz linux-de24214d0c8e78134875752619f99b9e5824c196.tar.bz2 linux-de24214d0c8e78134875752619f99b9e5824c196.zip |
[ALSA] timers: add module refcounting for global timers
Modules: RTC timer driver,Timer Midlevel
Add a module pointer to the timer structure and use it for refcounting
instead of the card's module pointer to prevent the global timer
modules (rtctimer and hpetimer) from being removed while in use.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Diffstat (limited to 'sound/core/timer.c')
-rw-r--r-- | sound/core/timer.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/sound/core/timer.c b/sound/core/timer.c index b02681eaea75..c8496c7b8df8 100644 --- a/sound/core/timer.c +++ b/sound/core/timer.c @@ -113,7 +113,7 @@ static snd_timer_instance_t *snd_timer_instance_new(char *owner, snd_timer_t *ti INIT_LIST_HEAD(&timeri->slave_active_head); timeri->timer = timer; - if (timer && timer->card && !try_module_get(timer->card->module)) { + if (timer && !try_module_get(timer->module)) { kfree(timeri->owner); kfree(timeri); return NULL; @@ -363,8 +363,8 @@ int snd_timer_close(snd_timer_instance_t * timeri) timeri->private_free(timeri); kfree(timeri->owner); kfree(timeri); - if (timer && timer->card) - module_put(timer->card->module); + if (timer) + module_put(timer->module); return 0; } @@ -787,6 +787,7 @@ int snd_timer_new(snd_card_t *card, char *id, snd_timer_id_t *tid, snd_timer_t * spin_lock_init(&timer->lock); tasklet_init(&timer->task_queue, snd_timer_tasklet, (unsigned long)timer); if (card != NULL) { + timer->module = card->module; if ((err = snd_device_new(card, SNDRV_DEV_TIMER, timer, &ops)) < 0) { snd_timer_free(timer); return err; |