diff options
Diffstat (limited to 'drivers/char/synclinkmp.c')
-rw-r--r-- | drivers/char/synclinkmp.c | 32 |
1 files changed, 12 insertions, 20 deletions
diff --git a/drivers/char/synclinkmp.c b/drivers/char/synclinkmp.c index 2b18adc4ee19..8da976bd7314 100644 --- a/drivers/char/synclinkmp.c +++ b/drivers/char/synclinkmp.c | |||
@@ -52,7 +52,6 @@ | |||
52 | #include <linux/mm.h> | 52 | #include <linux/mm.h> |
53 | #include <linux/seq_file.h> | 53 | #include <linux/seq_file.h> |
54 | #include <linux/slab.h> | 54 | #include <linux/slab.h> |
55 | #include <linux/smp_lock.h> | ||
56 | #include <linux/netdevice.h> | 55 | #include <linux/netdevice.h> |
57 | #include <linux/vmalloc.h> | 56 | #include <linux/vmalloc.h> |
58 | #include <linux/init.h> | 57 | #include <linux/init.h> |
@@ -1062,9 +1061,7 @@ static void wait_until_sent(struct tty_struct *tty, int timeout) | |||
1062 | if (sanity_check(info, tty->name, "wait_until_sent")) | 1061 | if (sanity_check(info, tty->name, "wait_until_sent")) |
1063 | return; | 1062 | return; |
1064 | 1063 | ||
1065 | lock_kernel(); | 1064 | if (!test_bit(ASYNCB_INITIALIZED, &info->port.flags)) |
1066 | |||
1067 | if (!(info->port.flags & ASYNC_INITIALIZED)) | ||
1068 | goto exit; | 1065 | goto exit; |
1069 | 1066 | ||
1070 | orig_jiffies = jiffies; | 1067 | orig_jiffies = jiffies; |
@@ -1094,8 +1091,10 @@ static void wait_until_sent(struct tty_struct *tty, int timeout) | |||
1094 | break; | 1091 | break; |
1095 | } | 1092 | } |
1096 | } else { | 1093 | } else { |
1097 | //TODO: determine if there is something similar to USC16C32 | 1094 | /* |
1098 | // TXSTATUS_ALL_SENT status | 1095 | * TODO: determine if there is something similar to USC16C32 |
1096 | * TXSTATUS_ALL_SENT status | ||
1097 | */ | ||
1099 | while ( info->tx_active && info->tx_enabled) { | 1098 | while ( info->tx_active && info->tx_enabled) { |
1100 | msleep_interruptible(jiffies_to_msecs(char_time)); | 1099 | msleep_interruptible(jiffies_to_msecs(char_time)); |
1101 | if (signal_pending(current)) | 1100 | if (signal_pending(current)) |
@@ -1106,7 +1105,6 @@ static void wait_until_sent(struct tty_struct *tty, int timeout) | |||
1106 | } | 1105 | } |
1107 | 1106 | ||
1108 | exit: | 1107 | exit: |
1109 | unlock_kernel(); | ||
1110 | if (debug_level >= DEBUG_LEVEL_INFO) | 1108 | if (debug_level >= DEBUG_LEVEL_INFO) |
1111 | printk("%s(%d):%s wait_until_sent() exit\n", | 1109 | printk("%s(%d):%s wait_until_sent() exit\n", |
1112 | __FILE__,__LINE__, info->device_name ); | 1110 | __FILE__,__LINE__, info->device_name ); |
@@ -1122,7 +1120,6 @@ static int write_room(struct tty_struct *tty) | |||
1122 | if (sanity_check(info, tty->name, "write_room")) | 1120 | if (sanity_check(info, tty->name, "write_room")) |
1123 | return 0; | 1121 | return 0; |
1124 | 1122 | ||
1125 | lock_kernel(); | ||
1126 | if (info->params.mode == MGSL_MODE_HDLC) { | 1123 | if (info->params.mode == MGSL_MODE_HDLC) { |
1127 | ret = (info->tx_active) ? 0 : HDLC_MAX_FRAME_SIZE; | 1124 | ret = (info->tx_active) ? 0 : HDLC_MAX_FRAME_SIZE; |
1128 | } else { | 1125 | } else { |
@@ -1130,7 +1127,6 @@ static int write_room(struct tty_struct *tty) | |||
1130 | if (ret < 0) | 1127 | if (ret < 0) |
1131 | ret = 0; | 1128 | ret = 0; |
1132 | } | 1129 | } |
1133 | unlock_kernel(); | ||
1134 | 1130 | ||
1135 | if (debug_level >= DEBUG_LEVEL_INFO) | 1131 | if (debug_level >= DEBUG_LEVEL_INFO) |
1136 | printk("%s(%d):%s write_room()=%d\n", | 1132 | printk("%s(%d):%s write_room()=%d\n", |
@@ -1251,7 +1247,7 @@ static void tx_release(struct tty_struct *tty) | |||
1251 | * | 1247 | * |
1252 | * Return Value: 0 if success, otherwise error code | 1248 | * Return Value: 0 if success, otherwise error code |
1253 | */ | 1249 | */ |
1254 | static int do_ioctl(struct tty_struct *tty, struct file *file, | 1250 | static int ioctl(struct tty_struct *tty, struct file *file, |
1255 | unsigned int cmd, unsigned long arg) | 1251 | unsigned int cmd, unsigned long arg) |
1256 | { | 1252 | { |
1257 | SLMP_INFO *info = tty->driver_data; | 1253 | SLMP_INFO *info = tty->driver_data; |
@@ -1341,16 +1337,6 @@ static int do_ioctl(struct tty_struct *tty, struct file *file, | |||
1341 | return 0; | 1337 | return 0; |
1342 | } | 1338 | } |
1343 | 1339 | ||
1344 | static int ioctl(struct tty_struct *tty, struct file *file, | ||
1345 | unsigned int cmd, unsigned long arg) | ||
1346 | { | ||
1347 | int ret; | ||
1348 | lock_kernel(); | ||
1349 | ret = do_ioctl(tty, file, cmd, arg); | ||
1350 | unlock_kernel(); | ||
1351 | return ret; | ||
1352 | } | ||
1353 | |||
1354 | /* | 1340 | /* |
1355 | * /proc fs routines.... | 1341 | * /proc fs routines.... |
1356 | */ | 1342 | */ |
@@ -2883,7 +2869,9 @@ static int get_stats(SLMP_INFO * info, struct mgsl_icount __user *user_icount) | |||
2883 | if (!user_icount) { | 2869 | if (!user_icount) { |
2884 | memset(&info->icount, 0, sizeof(info->icount)); | 2870 | memset(&info->icount, 0, sizeof(info->icount)); |
2885 | } else { | 2871 | } else { |
2872 | mutex_lock(&info->port.mutex); | ||
2886 | COPY_TO_USER(err, user_icount, &info->icount, sizeof(struct mgsl_icount)); | 2873 | COPY_TO_USER(err, user_icount, &info->icount, sizeof(struct mgsl_icount)); |
2874 | mutex_unlock(&info->port.mutex); | ||
2887 | if (err) | 2875 | if (err) |
2888 | return -EFAULT; | 2876 | return -EFAULT; |
2889 | } | 2877 | } |
@@ -2898,7 +2886,9 @@ static int get_params(SLMP_INFO * info, MGSL_PARAMS __user *user_params) | |||
2898 | printk("%s(%d):%s get_params()\n", | 2886 | printk("%s(%d):%s get_params()\n", |
2899 | __FILE__,__LINE__, info->device_name); | 2887 | __FILE__,__LINE__, info->device_name); |
2900 | 2888 | ||
2889 | mutex_lock(&info->port.mutex); | ||
2901 | COPY_TO_USER(err,user_params, &info->params, sizeof(MGSL_PARAMS)); | 2890 | COPY_TO_USER(err,user_params, &info->params, sizeof(MGSL_PARAMS)); |
2891 | mutex_unlock(&info->port.mutex); | ||
2902 | if (err) { | 2892 | if (err) { |
2903 | if ( debug_level >= DEBUG_LEVEL_INFO ) | 2893 | if ( debug_level >= DEBUG_LEVEL_INFO ) |
2904 | printk( "%s(%d):%s get_params() user buffer copy failed\n", | 2894 | printk( "%s(%d):%s get_params() user buffer copy failed\n", |
@@ -2926,11 +2916,13 @@ static int set_params(SLMP_INFO * info, MGSL_PARAMS __user *new_params) | |||
2926 | return -EFAULT; | 2916 | return -EFAULT; |
2927 | } | 2917 | } |
2928 | 2918 | ||
2919 | mutex_lock(&info->port.mutex); | ||
2929 | spin_lock_irqsave(&info->lock,flags); | 2920 | spin_lock_irqsave(&info->lock,flags); |
2930 | memcpy(&info->params,&tmp_params,sizeof(MGSL_PARAMS)); | 2921 | memcpy(&info->params,&tmp_params,sizeof(MGSL_PARAMS)); |
2931 | spin_unlock_irqrestore(&info->lock,flags); | 2922 | spin_unlock_irqrestore(&info->lock,flags); |
2932 | 2923 | ||
2933 | change_params(info); | 2924 | change_params(info); |
2925 | mutex_unlock(&info->port.mutex); | ||
2934 | 2926 | ||
2935 | return 0; | 2927 | return 0; |
2936 | } | 2928 | } |