public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Alan Cox <alan@linux.intel.com>
To: linux-kernel@vger.kernel.org
Subject: [PATCH 08/14] isicom: kill off the BKL
Date: Thu, 01 Apr 2010 17:05:50 +0100	[thread overview]
Message-ID: <20100401160548.8882.26940.stgit@localhost.localdomain> (raw)
In-Reply-To: <20100401155513.8882.54006.stgit@localhost.localdomain>

As with the others we can use the port mutex to get the needed locking
properties and fix the race with open.

Signed-off-by: Alan Cox <alan@linux.intel.com>
---

 drivers/char/isicom.c |   12 +++++-------
 1 files changed, 5 insertions(+), 7 deletions(-)


diff --git a/drivers/char/isicom.c b/drivers/char/isicom.c
index 0fa2e4a..989dd4b 100644
--- a/drivers/char/isicom.c
+++ b/drivers/char/isicom.c
@@ -124,7 +124,6 @@
 #include <linux/fs.h>
 #include <linux/sched.h>
 #include <linux/serial.h>
-#include <linux/smp_lock.h>
 #include <linux/mm.h>
 #include <linux/interrupt.h>
 #include <linux/timer.h>
@@ -1113,8 +1112,7 @@ static int isicom_set_serial_info(struct tty_struct *tty,
 	if (copy_from_user(&newinfo, info, sizeof(newinfo)))
 		return -EFAULT;
 
-	lock_kernel();
-
+	mutex_lock(&port->port.mutex);
 	reconfig_port = ((port->port.flags & ASYNC_SPD_MASK) !=
 		(newinfo.flags & ASYNC_SPD_MASK));
 
@@ -1123,7 +1121,7 @@ static int isicom_set_serial_info(struct tty_struct *tty,
 				(newinfo.closing_wait != port->port.closing_wait) ||
 				((newinfo.flags & ~ASYNC_USR_MASK) !=
 				(port->port.flags & ~ASYNC_USR_MASK))) {
-			unlock_kernel();
+			mutex_unlock(&port->port.mutex);
 			return -EPERM;
 		}
 		port->port.flags = ((port->port.flags & ~ASYNC_USR_MASK) |
@@ -1140,7 +1138,7 @@ static int isicom_set_serial_info(struct tty_struct *tty,
 		isicom_config_port(tty);
 		spin_unlock_irqrestore(&port->card->card_lock, flags);
 	}
-	unlock_kernel();
+	mutex_unlock(&port->port.mutex);
 	return 0;
 }
 
@@ -1149,7 +1147,7 @@ static int isicom_get_serial_info(struct isi_port *port,
 {
 	struct serial_struct out_info;
 
-	lock_kernel();
+	mutex_lock(&port->port.mutex);
 	memset(&out_info, 0, sizeof(out_info));
 /*	out_info.type = ? */
 	out_info.line = port - isi_ports;
@@ -1159,7 +1157,7 @@ static int isicom_get_serial_info(struct isi_port *port,
 /*	out_info.baud_base = ? */
 	out_info.close_delay = port->port.close_delay;
 	out_info.closing_wait = port->port.closing_wait;
-	unlock_kernel();
+	mutex_unlock(&port->port.mutex);
 	if (copy_to_user(info, &out_info, sizeof(out_info)))
 		return -EFAULT;
 	return 0;


  parent reply	other threads:[~2010-04-01 16:34 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-01 16:04 [RFC PATCH 00/14] Some BKL killing in the serial drivers Alan Cox
2010-04-01 16:04 ` [PATCH 01/14] tty: serial - fix tty referencing in set_ldisc Alan Cox
2010-04-01 16:04 ` [PATCH 02/14] tty: serial - fix tty back references in termios Alan Cox
2010-04-01 16:04 ` [PATCH 03/14] tty: serial - fix various misuses/mishandlings of port->tty Alan Cox
2010-04-01 16:04 ` [PATCH 04/14] vc: Locking clean up Alan Cox
2010-04-30 20:30   ` Arnd Bergmann
2010-04-01 16:05 ` [PATCH 05/14] stallion: prune lock_kernel calls Alan Cox
2010-04-29 21:29   ` Arnd Bergmann
2010-04-30 19:32     ` Alan Cox
2010-04-01 16:05 ` [PATCH 06/14] istallion: use bit ops for the board flags Alan Cox
2010-04-01 16:05 ` [PATCH 07/14] riscom8: kill use of lock_kernel Alan Cox
2010-04-01 16:05 ` Alan Cox [this message]
2010-04-01 16:06 ` [PATCH 09/14] rocket: kill BKL Alan Cox
2010-04-01 16:06 ` [PATCH 10/14] synclink: kill the big kernel lock Alan Cox
2010-04-01 16:06 ` [PATCH 11/14] cyclades: Kill off BKL usage Alan Cox
2010-04-01 16:06 ` [PATCH 12/14] epca: Kill the big kernel lock Alan Cox
2010-04-01 16:07 ` [PATCH 13/14] specialix; Kill the BKL Alan Cox
2010-04-01 16:07 ` [PATCH 14/14] synclink: reworking locking a bit Alan Cox

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100401160548.8882.26940.stgit@localhost.localdomain \
    --to=alan@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox