@@ -109,14 +109,14 @@ mISDN_read(struct file *filep, char __user *buf, size_t count, loff_t *off)
109109 spin_unlock_irq (& dev -> lock );
110110 if (filep -> f_flags & O_NONBLOCK )
111111 return - EAGAIN ;
112- wait_event_interruptible (dev -> wait , (dev -> work ||
112+ wait_event_interruptible (dev -> wait , (READ_ONCE ( dev -> work ) ||
113113 !list_empty (list )));
114114 if (signal_pending (current ))
115115 return - ERESTARTSYS ;
116116 spin_lock_irq (& dev -> lock );
117117 }
118118 if (dev -> work )
119- dev -> work = 0 ;
119+ WRITE_ONCE ( dev -> work , 0 ) ;
120120 if (!list_empty (list )) {
121121 timer = list_first_entry (list , struct mISDNtimer , list );
122122 list_del (& timer -> list );
@@ -141,13 +141,16 @@ mISDN_poll(struct file *filep, poll_table *wait)
141141 if (* debug & DEBUG_TIMER )
142142 printk (KERN_DEBUG "%s(%p, %p)\n" , __func__ , filep , wait );
143143 if (dev ) {
144+ u32 work ;
145+
144146 poll_wait (filep , & dev -> wait , wait );
145147 mask = 0 ;
146- if (dev -> work || !list_empty (& dev -> expired ))
148+ work = READ_ONCE (dev -> work );
149+ if (work || !list_empty (& dev -> expired ))
147150 mask |= (EPOLLIN | EPOLLRDNORM );
148151 if (* debug & DEBUG_TIMER )
149152 printk (KERN_DEBUG "%s work(%d) empty(%d)\n" , __func__ ,
150- dev -> work , list_empty (& dev -> expired ));
153+ work , list_empty (& dev -> expired ));
151154 }
152155 return mask ;
153156}
@@ -172,7 +175,7 @@ misdn_add_timer(struct mISDNtimerdev *dev, int timeout)
172175 struct mISDNtimer * timer ;
173176
174177 if (!timeout ) {
175- dev -> work = 1 ;
178+ WRITE_ONCE ( dev -> work , 1 ) ;
176179 wake_up_interruptible (& dev -> wait );
177180 id = 0 ;
178181 } else {
0 commit comments