Skip to content

Commit

Permalink
[PATCH] Char: mxser_new, lock count and flags
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jiri Slaby authored and Linus Torvalds committed Feb 11, 2007
1 parent 722d5e4 commit 5ff7205
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/char/mxser_new.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit 5ff7205

Please sign in to comment.