]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[PATCH] Char: mxser_new, lock count and flags
authorJiri Slaby <jirislaby@gmail.com>
Sat, 10 Feb 2007 09:45:23 +0000 (01:45 -0800)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Sun, 11 Feb 2007 18:51:29 +0000 (10:51 -0800)
Both open count and INITIALIZED flag should be changed under lock.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Cc: <osv@javad.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/char/mxser_new.c

index 1c8e00c4caad0a1aeb8023475f6b7b150e4a9d43..d52ecff7320ac5ea1a0445cb7625b48ea623c9c9 100644 (file)
@@ -853,9 +853,9 @@ static int mxser_startup(struct mxser_port *info)
         * and set the speed of the serial port
         */
        mxser_change_speed(info, NULL);
+       info->flags |= ASYNC_INITIALIZED;
        spin_unlock_irqrestore(&info->slock, flags);
 
-       info->flags |= ASYNC_INITIALIZED;
        return 0;
 }
 
@@ -925,6 +925,7 @@ static void mxser_shutdown(struct mxser_port *info)
 static int mxser_open(struct tty_struct *tty, struct file *filp)
 {
        struct mxser_port *info;
+       unsigned long flags;
        int retval, line;
 
        line = tty->index;
@@ -941,7 +942,9 @@ static int mxser_open(struct tty_struct *tty, struct file *filp)
        /*
         * Start up serial port
         */
+       spin_lock_irqsave(&info->slock, flags);
        info->count++;
+       spin_unlock_irqrestore(&info->slock, flags);
        retval = mxser_startup(info);
        if (retval)
                return retval;