summaryrefslogtreecommitdiff
path: root/include/sound
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2021-05-23 12:09:15 +0300
committerTakashi Iwai <tiwai@suse.de>2021-05-25 09:48:03 +0300
commit533a7ed9d541674e815c7f31c933015e257df3e5 (patch)
tree65d7a30150793d5e2ced2099ed314b4c55c877a3 /include/sound
parent6efb943b8616ec53a5e444193dccf1af9ad627b5 (diff)
downloadlinux-533a7ed9d541674e815c7f31c933015e257df3e5.tar.xz
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: Jaroslav Kysela <perex@perex.cz> Link: https://lore.kernel.org/r/20210523090920.15345-2-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'include/sound')
-rw-r--r--include/sound/core.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/include/sound/core.h b/include/sound/core.h
index 1f9aef0adbc9..d69dfc6c4953 100644
--- a/include/sound/core.h
+++ b/include/sound/core.h
@@ -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);
}