From 74fff81da4c009e47ff2cd65a6b7b55b3a384e3d Mon Sep 17 00:00:00 2001 From: Shaun Ruffell Date: Tue, 21 Dec 2010 16:09:17 +0000 Subject: [PATCH] dahdi: Remove interruptible_sleep_on() calls for WINK/FLASH. Makes it a little more clear what it is we're really waiting for. Signed-off-by: Shaun Ruffell Acked-by: Russ Meyerreicks git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9547 a0bf4364-ded3-4de4-8d8a-66a801d63aff --- drivers/dahdi/dahdi-base.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/drivers/dahdi/dahdi-base.c b/drivers/dahdi/dahdi-base.c index a29a63f..b1b09ec 100644 --- a/drivers/dahdi/dahdi-base.c +++ b/drivers/dahdi/dahdi-base.c @@ -5574,6 +5574,18 @@ static void set_echocan_fax_mode(struct dahdi_chan *chan, unsigned int channo, c } } +static inline bool +is_txstate(struct dahdi_chan *const chan, const int txstate) +{ + bool ret; + unsigned long flags; + + spin_lock_irqsave(&chan->lock, flags); + ret = (txstate == chan->txstate); + spin_unlock_irqrestore(&chan->lock, flags); + return ret; +} + static int dahdi_chan_ioctl(struct file *file, unsigned int cmd, unsigned long data) { struct dahdi_chan *const chan = chan_from_file(file); @@ -5905,7 +5917,8 @@ static int dahdi_chan_ioctl(struct file *file, unsigned int cmd, unsigned long d spin_unlock_irqrestore(&chan->lock, flags); if (file->f_flags & O_NONBLOCK) return -EINPROGRESS; - interruptible_sleep_on(&chan->txstateq); + wait_event_interruptible(chan->txstateq, + is_txstate(chan, DAHDI_TXSIG_ONHOOK)); if (signal_pending(current)) return -ERESTARTSYS; break; @@ -5919,7 +5932,8 @@ static int dahdi_chan_ioctl(struct file *file, unsigned int cmd, unsigned long d spin_unlock_irqrestore(&chan->lock, flags); if (file->f_flags & O_NONBLOCK) return -EINPROGRESS; - interruptible_sleep_on(&chan->txstateq); + wait_event_interruptible(chan->txstateq, + is_txstate(chan, DAHDI_TXSIG_OFFHOOK)); if (signal_pending(current)) return -ERESTARTSYS; break;