Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=fc83815c3afe1bd8d0f0961a668a96caabb049be
Commit:     fc83815c3afe1bd8d0f0961a668a96caabb049be
Parent:     b446a4a5757fe1287bf3472efcdde6b59dfd63ad
Author:     Jiri Slaby <[EMAIL PROTECTED]>
AuthorDate: Mon Apr 23 14:41:04 2007 -0700
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Tue Apr 24 08:23:08 2007 -0700

    Char: mxser, fix TIOCMIWAIT
    
    There was schedule() missing in the TIOCMIWAIT ioctl. Solve it by moving
    the code to the wait_event_interruptible.
    
    Signed-off-by: Jiri Slaby <[EMAIL PROTECTED]>
    Cc: Jan Yenya Kasprzak <[EMAIL PROTECTED]>
    Cc: Alan Cox <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 drivers/char/mxser.c |   48 ++++++++++++++----------------------------------
 1 files changed, 14 insertions(+), 34 deletions(-)

diff --git a/drivers/char/mxser.c b/drivers/char/mxser.c
index a61fb6d..80a0115 100644
--- a/drivers/char/mxser.c
+++ b/drivers/char/mxser.c
@@ -1338,43 +1338,23 @@ static int mxser_ioctl(struct tty_struct *tty, struct 
file *file, unsigned int c
                 *   (use |'ed TIOCM_RNG/DSR/CD/CTS for masking)
                 * Caller should use TIOCGICOUNT to see which one it was
                 */
-       case TIOCMIWAIT: {
-                       DECLARE_WAITQUEUE(wait, current);
-                       int ret;
+       case TIOCMIWAIT:
+               spin_lock_irqsave(&info->slock, flags);
+               cnow = info->icount;    /* note the counters on entry */
+               spin_unlock_irqrestore(&info->slock, flags);
+
+               wait_event_interruptible(info->delta_msr_wait, ({
+                       cprev = cnow;
                        spin_lock_irqsave(&info->slock, flags);
-                       cprev = info->icount;   /* note the counters on entry */
+                       cnow = info->icount;    /* atomic copy */
                        spin_unlock_irqrestore(&info->slock, flags);
 
-                       add_wait_queue(&info->delta_msr_wait, &wait);
-                       while (1) {
-                               spin_lock_irqsave(&info->slock, flags);
-                               cnow = info->icount;    /* atomic copy */
-                               spin_unlock_irqrestore(&info->slock, flags);
-
-                               set_current_state(TASK_INTERRUPTIBLE);
-                               if (((arg & TIOCM_RNG) &&
-                                               (cnow.rng != cprev.rng)) ||
-                                               ((arg & TIOCM_DSR) &&
-                                               (cnow.dsr != cprev.dsr)) ||
-                                               ((arg & TIOCM_CD) &&
-                                               (cnow.dcd != cprev.dcd)) ||
-                                               ((arg & TIOCM_CTS) &&
-                                               (cnow.cts != cprev.cts))) {
-                                       ret = 0;
-                                       break;
-                               }
-                               /* see if a signal did it */
-                               if (signal_pending(current)) {
-                                       ret = -ERESTARTSYS;
-                                       break;
-                               }
-                               cprev = cnow;
-                       }
-                       current->state = TASK_RUNNING;
-                       remove_wait_queue(&info->delta_msr_wait, &wait);
-                       break;
-               }
-               /* NOTREACHED */
+                       ((arg & TIOCM_RNG) && (cnow.rng != cprev.rng)) ||
+                       ((arg & TIOCM_DSR) && (cnow.dsr != cprev.dsr)) ||
+                       ((arg & TIOCM_CD)  && (cnow.dcd != cprev.dcd)) ||
+                       ((arg & TIOCM_CTS) && (cnow.cts != cprev.cts));
+               }));
+               break;
                /*
                 * Get counter of input serial line interrupts (DCD,RI,DSR,CTS)
                 * Return: write counters to the user passed counter struct
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to