summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2026-06-10 18:45:32 +0300
committerTakashi Iwai <tiwai@suse.de>2026-06-11 10:34:09 +0300
commit2fa8d8b6c18b3443b65d42ced33bc9e36683e886 (patch)
tree5b14a1afe27ff99d18d257531d4fa0ed09525668 /include
parentdcca9b6064c33c84fbeb9f09814178a206321249 (diff)
downloadlinux-2fa8d8b6c18b3443b65d42ced33bc9e36683e886.tar.xz
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
Diffstat (limited to 'include')
-rw-r--r--include/sound/core.h10
1 files changed, 4 insertions, 6 deletions
diff --git a/include/sound/core.h b/include/sound/core.h
index a3f10294e834..404785b7d885 100644
--- a/include/sound/core.h
+++ b/include/sound/core.h
@@ -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 */