atm: nicstar: remove interruptible_sleep_on_timeout
authorArnd Bergmann <arnd@arndb.de>
Thu, 27 Feb 2014 18:51:54 +0000 (19:51 +0100)
committerDavid S. Miller <davem@davemloft.net>
Thu, 27 Feb 2014 20:22:46 +0000 (15:22 -0500)
We are trying to finally kill off interruptible_sleep_on_timeout.
the two uses in the nicstar driver can be trivially replaced
with wait_event_interruptible_lock_irq_timeout, which prevents the
wake-up race and is able to check the buffer state with scq->lock
held.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Chas Williams <chas@cmf.nrl.navy.mil>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/atm/nicstar.c

index 13ed54cf2c31c174e3d0695b702c15a546385270..9988ac98b6d83ee58fa2774f1c4ced4559dcee74 100644 (file)
@@ -1739,10 +1739,10 @@ static int push_scqe(ns_dev * card, vc_map * vc, scq_info * scq, ns_scqe * tbd,
                }
 
                scq->full = 1;
-               spin_unlock_irqrestore(&scq->lock, flags);
-               interruptible_sleep_on_timeout(&scq->scqfull_waitq,
-                                              SCQFULL_TIMEOUT);
-               spin_lock_irqsave(&scq->lock, flags);
+               wait_event_interruptible_lock_irq_timeout(scq->scqfull_waitq,
+                                                         scq->tail != scq->next,
+                                                         scq->lock,
+                                                         SCQFULL_TIMEOUT);
 
                if (scq->full) {
                        spin_unlock_irqrestore(&scq->lock, flags);
@@ -1789,10 +1789,10 @@ static int push_scqe(ns_dev * card, vc_map * vc, scq_info * scq, ns_scqe * tbd,
                        scq->full = 1;
                        if (has_run++)
                                break;
-                       spin_unlock_irqrestore(&scq->lock, flags);
-                       interruptible_sleep_on_timeout(&scq->scqfull_waitq,
-                                                      SCQFULL_TIMEOUT);
-                       spin_lock_irqsave(&scq->lock, flags);
+                       wait_event_interruptible_lock_irq_timeout(scq->scqfull_waitq,
+                                                                 scq->tail != scq->next,
+                                                                 scq->lock,
+                                                                 SCQFULL_TIMEOUT);
                }
 
                if (!scq->full) {