mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 17:47:41 +02:00
ALSA: core: Use the new helper for the power refcount
Replace the open code for managing the power refcount in the snd_card object with the new helper functions. Only a code cleanup, no functional changes. Signed-off-by: Takashi Iwai <tiwai@suse.de> Link: https://patch.msgid.link/20260610154538.51076-3-tiwai@suse.de
This commit is contained in:
parent
dcca9b6064
commit
2fa8d8b6c1
|
|
@ -160,9 +160,8 @@ struct snd_card {
|
|||
|
||||
#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)
|
||||
|
|
@ -197,7 +196,7 @@ static inline void snd_power_change_state(struct snd_card *card, unsigned int st
|
|||
*/
|
||||
static inline void snd_power_ref(struct snd_card *card)
|
||||
{
|
||||
atomic_inc(&card->power_ref);
|
||||
snd_refcount_get(&card->power_ref);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -206,8 +205,7 @@ static inline void snd_power_ref(struct snd_card *card)
|
|||
*/
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -219,7 +217,7 @@ static inline void snd_power_unref(struct snd_card *card)
|
|||
*/
|
||||
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 */
|
||||
|
|
|
|||
|
|
@ -328,8 +328,7 @@ static int snd_card_init(struct snd_card *card, struct device *parent,
|
|||
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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user