aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/synclink_gt.c
diff options
context:
space:
mode:
authorAlan Cox <alan@linux.intel.com>2010-06-01 16:52:46 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2010-08-10 16:47:40 -0400
commitf602501d90e0da28c8e6f5e4569b8bf5d40a9d9c (patch)
treeae0bfcf04f6ef9f4a374b5105d59c1830776d209 /drivers/char/synclink_gt.c
parent417b6e0e146ba38eec5d79777433e38c73d4feb1 (diff)
synclink: kill the big kernel lock
We don't need it while waiting and we can lock the ioctls using the port mutex. While at it eliminate use of the hangup mutex and switch to the port mutex. 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/synclink_gt.c')
-rw-r--r--drivers/char/synclink_gt.c78
1 files changed, 34 insertions, 44 deletions
diff --git a/drivers/char/synclink_gt.c b/drivers/char/synclink_gt.c
index 334cf5c8c8b6..3c7ac6a3ff80 100644
--- a/drivers/char/synclink_gt.c
+++ b/drivers/char/synclink_gt.c
@@ -40,8 +40,8 @@
40#define DBGBH(fmt) if (debug_level >= DEBUG_LEVEL_BH) printk fmt 40#define DBGBH(fmt) if (debug_level >= DEBUG_LEVEL_BH) printk fmt
41#define DBGISR(fmt) if (debug_level >= DEBUG_LEVEL_ISR) printk fmt 41#define DBGISR(fmt) if (debug_level >= DEBUG_LEVEL_ISR) printk fmt
42#define DBGDATA(info, buf, size, label) if (debug_level >= DEBUG_LEVEL_DATA) trace_block((info), (buf), (size), (label)) 42#define DBGDATA(info, buf, size, label) if (debug_level >= DEBUG_LEVEL_DATA) trace_block((info), (buf), (size), (label))
43//#define DBGTBUF(info) dump_tbufs(info) 43/*#define DBGTBUF(info) dump_tbufs(info)*/
44//#define DBGRBUF(info) dump_rbufs(info) 44/*#define DBGRBUF(info) dump_rbufs(info)*/
45 45
46 46
47#include <linux/module.h> 47#include <linux/module.h>
@@ -62,7 +62,6 @@
62#include <linux/mm.h> 62#include <linux/mm.h>
63#include <linux/seq_file.h> 63#include <linux/seq_file.h>
64#include <linux/slab.h> 64#include <linux/slab.h>
65#include <linux/smp_lock.h>
66#include <linux/netdevice.h> 65#include <linux/netdevice.h>
67#include <linux/vmalloc.h> 66#include <linux/vmalloc.h>
68#include <linux/init.h> 67#include <linux/init.h>
@@ -901,8 +900,6 @@ static void wait_until_sent(struct tty_struct *tty, int timeout)
901 * Note: use tight timings here to satisfy the NIST-PCTS. 900 * Note: use tight timings here to satisfy the NIST-PCTS.
902 */ 901 */
903 902
904 lock_kernel();
905
906 if (info->params.data_rate) { 903 if (info->params.data_rate) {
907 char_time = info->timeout/(32 * 5); 904 char_time = info->timeout/(32 * 5);
908 if (!char_time) 905 if (!char_time)
@@ -920,8 +917,6 @@ static void wait_until_sent(struct tty_struct *tty, int timeout)
920 if (timeout && time_after(jiffies, orig_jiffies + timeout)) 917 if (timeout && time_after(jiffies, orig_jiffies + timeout))
921 break; 918 break;
922 } 919 }
923 unlock_kernel();
924
925exit: 920exit:
926 DBGINFO(("%s wait_until_sent exit\n", info->device_name)); 921 DBGINFO(("%s wait_until_sent exit\n", info->device_name));
927} 922}
@@ -1041,8 +1036,37 @@ static int ioctl(struct tty_struct *tty, struct file *file,
1041 return -EIO; 1036 return -EIO;
1042 } 1037 }
1043 1038
1044 lock_kernel(); 1039 switch (cmd) {
1045 1040 case MGSL_IOCWAITEVENT:
1041 return wait_mgsl_event(info, argp);
1042 case TIOCMIWAIT:
1043 return modem_input_wait(info,(int)arg);
1044 case TIOCGICOUNT:
1045 spin_lock_irqsave(&info->lock,flags);
1046 cnow = info->icount;
1047 spin_unlock_irqrestore(&info->lock,flags);
1048 p_cuser = argp;
1049 if (put_user(cnow.cts, &p_cuser->cts) ||
1050 put_user(cnow.dsr, &p_cuser->dsr) ||
1051 put_user(cnow.rng, &p_cuser->rng) ||
1052 put_user(cnow.dcd, &p_cuser->dcd) ||
1053 put_user(cnow.rx, &p_cuser->rx) ||
1054 put_user(cnow.tx, &p_cuser->tx) ||
1055 put_user(cnow.frame, &p_cuser->frame) ||
1056 put_user(cnow.overrun, &p_cuser->overrun) ||
1057 put_user(cnow.parity, &p_cuser->parity) ||
1058 put_user(cnow.brk, &p_cuser->brk) ||
1059 put_user(cnow.buf_overrun, &p_cuser->buf_overrun))
1060 return -EFAULT;
1061 return 0;
1062 case MGSL_IOCSGPIO:
1063 return set_gpio(info, argp);
1064 case MGSL_IOCGGPIO:
1065 return get_gpio(info, argp);
1066 case MGSL_IOCWAITGPIO:
1067 return wait_gpio(info, argp);
1068 }
1069 mutex_lock(&info->port.mutex);
1046 switch (cmd) { 1070 switch (cmd) {
1047 case MGSL_IOCGPARAMS: 1071 case MGSL_IOCGPARAMS:
1048 ret = get_params(info, argp); 1072 ret = get_params(info, argp);
@@ -1068,50 +1092,16 @@ static int ioctl(struct tty_struct *tty, struct file *file,
1068 case MGSL_IOCGSTATS: 1092 case MGSL_IOCGSTATS:
1069 ret = get_stats(info, argp); 1093 ret = get_stats(info, argp);
1070 break; 1094 break;
1071 case MGSL_IOCWAITEVENT:
1072 ret = wait_mgsl_event(info, argp);
1073 break;
1074 case TIOCMIWAIT:
1075 ret = modem_input_wait(info,(int)arg);
1076 break;
1077 case MGSL_IOCGIF: 1095 case MGSL_IOCGIF:
1078 ret = get_interface(info, argp); 1096 ret = get_interface(info, argp);
1079 break; 1097 break;
1080 case MGSL_IOCSIF: 1098 case MGSL_IOCSIF:
1081 ret = set_interface(info,(int)arg); 1099 ret = set_interface(info,(int)arg);
1082 break; 1100 break;
1083 case MGSL_IOCSGPIO:
1084 ret = set_gpio(info, argp);
1085 break;
1086 case MGSL_IOCGGPIO:
1087 ret = get_gpio(info, argp);
1088 break;
1089 case MGSL_IOCWAITGPIO:
1090 ret = wait_gpio(info, argp);
1091 break;
1092 case TIOCGICOUNT:
1093 spin_lock_irqsave(&info->lock,flags);
1094 cnow = info->icount;
1095 spin_unlock_irqrestore(&info->lock,flags);
1096 p_cuser = argp;
1097 if (put_user(cnow.cts, &p_cuser->cts) ||
1098 put_user(cnow.dsr, &p_cuser->dsr) ||
1099 put_user(cnow.rng, &p_cuser->rng) ||
1100 put_user(cnow.dcd, &p_cuser->dcd) ||
1101 put_user(cnow.rx, &p_cuser->rx) ||
1102 put_user(cnow.tx, &p_cuser->tx) ||
1103 put_user(cnow.frame, &p_cuser->frame) ||
1104 put_user(cnow.overrun, &p_cuser->overrun) ||
1105 put_user(cnow.parity, &p_cuser->parity) ||
1106 put_user(cnow.brk, &p_cuser->brk) ||
1107 put_user(cnow.buf_overrun, &p_cuser->buf_overrun))
1108 ret = -EFAULT;
1109 ret = 0;
1110 break;
1111 default: 1101 default:
1112 ret = -ENOIOCTLCMD; 1102 ret = -ENOIOCTLCMD;
1113 } 1103 }
1114 unlock_kernel(); 1104 mutex_unlock(&info->port.mutex);
1115 return ret; 1105 return ret;
1116} 1106}
1117 1107