[PATCH 2/3] Char: mxser_new, lock count and flags

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



mxser_new, lock count and flags

Both open count and INITIALIZED flag should be changed under lock.

Signed-off-by: Jiri Slaby <[email protected]>
Cc: <[email protected]>

---
commit 76b3ee2d5737395df62553cec1b8193252476147
tree dfc50c164ddde6b73a954f694dfdcb98ed921629
parent f49b6914c3113f930a31ff7b8f811744f2d8f339
author Jiri Slaby <[email protected]> Sat, 20 Jan 2007 17:18:24 +0059
committer Jiri Slaby <[email protected]> Sat, 20 Jan 2007 17:18:24 +0059

 drivers/char/mxser_new.c |    5 ++++-
 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;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux