summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiri Slaby <jirislaby@gmail.com>2007-02-10 09:45:23 (GMT)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-11 18:51:29 (GMT)
commit5ff7205dd9084c96cf2bedc4d0481790c5a7a635 (patch)
tree6669cf9dba51753349b355d8928e0707d08239ea
parent722d5e4ae89f061582cc46ccbbd3b5ae87a6e165 (diff)
downloadlinux-fsl-qoriq-5ff7205dd9084c96cf2bedc4d0481790c5a7a635.tar.xz
[PATCH] Char: mxser_new, lock count and flags
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>
-rw-r--r--drivers/char/mxser_new.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/char/mxser_new.c b/drivers/char/mxser_new.c
index 1c8e00c..d52ecff 100644
--- a/drivers/char/mxser_new.c
+++ b/drivers/char/mxser_new.c
@@ -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;