#ifdef CONFIG_PM
unsigned int power_state; /* power state */
- atomic_t power_ref;
wait_queue_head_t power_sleep;
- wait_queue_head_t power_ref_sleep;
+ struct snd_refcount power_ref;
#endif
#if IS_ENABLED(CONFIG_SND_MIXER_OSS)
*/
static inline void snd_power_ref(struct snd_card *card)
{
- atomic_inc(&card->power_ref);
+ snd_refcount_get(&card->power_ref);
}
/**
*/
static inline void snd_power_unref(struct snd_card *card)
{
- if (atomic_dec_and_test(&card->power_ref))
- wake_up(&card->power_ref_sleep);
+ snd_refcount_put(&card->power_ref);
}
/**
*/
static inline void snd_power_sync_ref(struct snd_card *card)
{
- wait_event(card->power_ref_sleep, !atomic_read(&card->power_ref));
+ snd_refcount_sync(&card->power_ref);
}
/* init.c */
mutex_init(&card->memory_mutex);
#ifdef CONFIG_PM
init_waitqueue_head(&card->power_sleep);
- init_waitqueue_head(&card->power_ref_sleep);
- atomic_set(&card->power_ref, 0);
+ snd_refcount_init(&card->power_ref);
#endif
init_waitqueue_head(&card->remove_sleep);
card->sync_irq = -1;