aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
authorAlan Cox <alan@linux.intel.com>2010-06-01 16:52:44 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2010-08-10 16:47:40 -0400
commitec82db129e94c7896e732d21f2bb9ab8e7312fe0 (patch)
treecf9118042698dd3b1448f4f90d3d39a23a051a84 /drivers/char
parentbf936f92a7a564a2cdb44bbe3bc797cd811bf625 (diff)
isicom: kill off the BKL
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> Cc: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/isicom.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/drivers/char/isicom.c b/drivers/char/isicom.c
index 98310e1aae30..c27e9d21fea9 100644
--- a/drivers/char/isicom.c
+++ b/drivers/char/isicom.c
@@ -124,7 +124,6 @@
124#include <linux/fs.h> 124#include <linux/fs.h>
125#include <linux/sched.h> 125#include <linux/sched.h>
126#include <linux/serial.h> 126#include <linux/serial.h>
127#include <linux/smp_lock.h>
128#include <linux/mm.h> 127#include <linux/mm.h>
129#include <linux/interrupt.h> 128#include <linux/interrupt.h>
130#include <linux/timer.h> 129#include <linux/timer.h>
@@ -872,7 +871,6 @@ static struct tty_port *isicom_find_port(struct tty_struct *tty)
872static int isicom_open(struct tty_struct *tty, struct file *filp) 871static int isicom_open(struct tty_struct *tty, struct file *filp)
873{ 872{
874 struct isi_port *port; 873 struct isi_port *port;
875 struct isi_board *card;
876 struct tty_port *tport; 874 struct tty_port *tport;
877 875
878 tport = isicom_find_port(tty); 876 tport = isicom_find_port(tty);
@@ -1118,8 +1116,7 @@ static int isicom_set_serial_info(struct tty_struct *tty,
1118 if (copy_from_user(&newinfo, info, sizeof(newinfo))) 1116 if (copy_from_user(&newinfo, info, sizeof(newinfo)))
1119 return -EFAULT; 1117 return -EFAULT;
1120 1118
1121 lock_kernel(); 1119 mutex_lock(&port->port.mutex);
1122
1123 reconfig_port = ((port->port.flags & ASYNC_SPD_MASK) != 1120 reconfig_port = ((port->port.flags & ASYNC_SPD_MASK) !=
1124 (newinfo.flags & ASYNC_SPD_MASK)); 1121 (newinfo.flags & ASYNC_SPD_MASK));
1125 1122
@@ -1128,7 +1125,7 @@ static int isicom_set_serial_info(struct tty_struct *tty,
1128 (newinfo.closing_wait != port->port.closing_wait) || 1125 (newinfo.closing_wait != port->port.closing_wait) ||
1129 ((newinfo.flags & ~ASYNC_USR_MASK) != 1126 ((newinfo.flags & ~ASYNC_USR_MASK) !=
1130 (port->port.flags & ~ASYNC_USR_MASK))) { 1127 (port->port.flags & ~ASYNC_USR_MASK))) {
1131 unlock_kernel(); 1128 mutex_unlock(&port->port.mutex);
1132 return -EPERM; 1129 return -EPERM;
1133 } 1130 }
1134 port->port.flags = ((port->port.flags & ~ASYNC_USR_MASK) | 1131 port->port.flags = ((port->port.flags & ~ASYNC_USR_MASK) |
@@ -1145,7 +1142,7 @@ static int isicom_set_serial_info(struct tty_struct *tty,
1145 isicom_config_port(tty); 1142 isicom_config_port(tty);
1146 spin_unlock_irqrestore(&port->card->card_lock, flags); 1143 spin_unlock_irqrestore(&port->card->card_lock, flags);
1147 } 1144 }
1148 unlock_kernel(); 1145 mutex_unlock(&port->port.mutex);
1149 return 0; 1146 return 0;
1150} 1147}
1151 1148
@@ -1154,7 +1151,7 @@ static int isicom_get_serial_info(struct isi_port *port,
1154{ 1151{
1155 struct serial_struct out_info; 1152 struct serial_struct out_info;
1156 1153
1157 lock_kernel(); 1154 mutex_lock(&port->port.mutex);
1158 memset(&out_info, 0, sizeof(out_info)); 1155 memset(&out_info, 0, sizeof(out_info));
1159/* out_info.type = ? */ 1156/* out_info.type = ? */
1160 out_info.line = port - isi_ports; 1157 out_info.line = port - isi_ports;
@@ -1164,7 +1161,7 @@ static int isicom_get_serial_info(struct isi_port *port,
1164/* out_info.baud_base = ? */ 1161/* out_info.baud_base = ? */
1165 out_info.close_delay = port->port.close_delay; 1162 out_info.close_delay = port->port.close_delay;
1166 out_info.closing_wait = port->port.closing_wait; 1163 out_info.closing_wait = port->port.closing_wait;
1167 unlock_kernel(); 1164 mutex_unlock(&port->port.mutex);
1168 if (copy_to_user(info, &out_info, sizeof(out_info))) 1165 if (copy_to_user(info, &out_info, sizeof(out_info)))
1169 return -EFAULT; 1166 return -EFAULT;
1170 return 0; 1167 return 0;