aboutsummaryrefslogtreecommitdiffstats
path: root/include/sound/core.h
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2014-01-29 06:13:43 -0500
committerTakashi Iwai <tiwai@suse.de>2014-02-14 02:14:13 -0500
commitf24640648186b59bd39f8cd640d631bdb61a3197 (patch)
treea73d73fd6d100ace77a0f67d7af3df367251d1bc /include/sound/core.h
parent34356dbdb64e9f12cc8ce1bb0d9e38a75b1e4638 (diff)
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 <tiwai@suse.de>
Diffstat (limited to 'include/sound/core.h')
-rw-r--r--include/sound/core.h7
1 files changed, 3 insertions, 4 deletions
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 @@
42/* forward declarations */ 42/* forward declarations */
43struct pci_dev; 43struct pci_dev;
44struct module; 44struct module;
45struct completion;
45 46
46/* device allocation stuff */ 47/* device allocation stuff */
47 48
@@ -130,9 +131,7 @@ struct snd_card {
130 state */ 131 state */
131 spinlock_t files_lock; /* lock the files for this card */ 132 spinlock_t files_lock; /* lock the files for this card */
132 int shutdown; /* this card is going down */ 133 int shutdown; /* this card is going down */
133 int free_on_last_close; /* free in context of file_release */ 134 struct completion *release_completion;
134 wait_queue_head_t shutdown_sleep;
135 atomic_t refcount; /* refcount for disconnection */
136 struct device *dev; /* device assigned to this card */ 135 struct device *dev; /* device assigned to this card */
137 struct device card_dev; /* cardX object for sysfs */ 136 struct device card_dev; /* cardX object for sysfs */
138 bool registered; /* card_dev is registered? */ 137 bool registered; /* card_dev is registered? */
@@ -306,7 +305,7 @@ int snd_card_info_done(void);
306int snd_component_add(struct snd_card *card, const char *component); 305int snd_component_add(struct snd_card *card, const char *component);
307int snd_card_file_add(struct snd_card *card, struct file *file); 306int snd_card_file_add(struct snd_card *card, struct file *file);
308int snd_card_file_remove(struct snd_card *card, struct file *file); 307int snd_card_file_remove(struct snd_card *card, struct file *file);
309void snd_card_unref(struct snd_card *card); 308#define snd_card_unref(card) put_device(&(card)->card_dev)
310 309
311#define snd_card_set_dev(card, devptr) ((card)->dev = (devptr)) 310#define snd_card_set_dev(card, devptr) ((card)->dev = (devptr))
312 311