Commit 533a7ed9 authored by Takashi Iwai's avatar Takashi Iwai

ALSA: core: Use READ_ONCE() / WRITE_ONCE() for power state change

We need proper barriers to handle the power state change of the card
from different CPUs.
Reviewed-by: default avatarJaroslav Kysela <perex@perex.cz>
Link: https://lore.kernel.org/r/20210523090920.15345-2-tiwai@suse.deSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 6efb943b
......@@ -142,12 +142,12 @@ struct snd_card {
#ifdef CONFIG_PM
static inline unsigned int snd_power_get_state(struct snd_card *card)
{
return card->power_state;
return READ_ONCE(card->power_state);
}
static inline void snd_power_change_state(struct snd_card *card, unsigned int state)
{
card->power_state = state;
WRITE_ONCE(card->power_state, state);
wake_up(&card->power_sleep);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment