ALSA: core: Use READ_ONCE() / WRITE_ONCE() for power state change
[linux-2.6-microblaze.git] / include / sound / core.h
index 2e24f19..d69dfc6 100644 (file)
@@ -100,7 +100,7 @@ struct snd_card {
        struct rw_semaphore controls_rwsem;     /* controls list lock */
        rwlock_t ctl_files_rwlock;      /* ctl_files list lock */
        int controls_count;             /* count of all controls */
-       int user_ctl_count;             /* count of all user controls */
+       size_t user_ctl_alloc_size;     // current memory allocation by user controls.
        struct list_head controls;      /* all controls for this card */
        struct list_head ctl_files;     /* active control files */
 
@@ -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);
 }