From f24640648186b59bd39f8cd640d631bdb61a3197 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Wed, 29 Jan 2014 12:13:43 +0100 Subject: ALSA: Use standard device refcount for card accounting Drop the own refcount but use the standard device refcounting via get_device() and put_device(). Introduce a new completion to snd_card instead of the wait queue for syncing the last release, which is used in snd_card_free(). Signed-off-by: Takashi Iwai --- include/sound/core.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'include/sound/core.h') diff --git a/include/sound/core.h b/include/sound/core.h index 7e4fb3e93fc7..4519dac98363 100644 --- a/include/sound/core.h +++ b/include/sound/core.h @@ -42,6 +42,7 @@ /* forward declarations */ struct pci_dev; struct module; +struct completion; /* device allocation stuff */ @@ -130,9 +131,7 @@ struct snd_card { state */ spinlock_t files_lock; /* lock the files for this card */ int shutdown; /* this card is going down */ - int free_on_last_close; /* free in context of file_release */ - wait_queue_head_t shutdown_sleep; - atomic_t refcount; /* refcount for disconnection */ + struct completion *release_completion; struct device *dev; /* device assigned to this card */ struct device card_dev; /* cardX object for sysfs */ bool registered; /* card_dev is registered? */ @@ -306,7 +305,7 @@ int snd_card_info_done(void); int snd_component_add(struct snd_card *card, const char *component); int snd_card_file_add(struct snd_card *card, struct file *file); int snd_card_file_remove(struct snd_card *card, struct file *file); -void snd_card_unref(struct snd_card *card); +#define snd_card_unref(card) put_device(&(card)->card_dev) #define snd_card_set_dev(card, devptr) ((card)->dev = (devptr)) -- cgit v1.2.3