diff options
Diffstat (limited to 'drivers/char/synclinkmp.c')
-rw-r--r-- | drivers/char/synclinkmp.c | 171 |
1 files changed, 71 insertions, 100 deletions
diff --git a/drivers/char/synclinkmp.c b/drivers/char/synclinkmp.c index 6bdb44f7bec2..7b0c5b2dd263 100644 --- a/drivers/char/synclinkmp.c +++ b/drivers/char/synclinkmp.c | |||
@@ -558,6 +558,7 @@ static void release_resources(SLMP_INFO *info); | |||
558 | 558 | ||
559 | static int startup(SLMP_INFO *info); | 559 | static int startup(SLMP_INFO *info); |
560 | static int block_til_ready(struct tty_struct *tty, struct file * filp,SLMP_INFO *info); | 560 | static int block_til_ready(struct tty_struct *tty, struct file * filp,SLMP_INFO *info); |
561 | static int carrier_raised(struct tty_port *port); | ||
561 | static void shutdown(SLMP_INFO *info); | 562 | static void shutdown(SLMP_INFO *info); |
562 | static void program_hw(SLMP_INFO *info); | 563 | static void program_hw(SLMP_INFO *info); |
563 | static void change_params(SLMP_INFO *info); | 564 | static void change_params(SLMP_INFO *info); |
@@ -800,7 +801,7 @@ cleanup: | |||
800 | */ | 801 | */ |
801 | static void close(struct tty_struct *tty, struct file *filp) | 802 | static void close(struct tty_struct *tty, struct file *filp) |
802 | { | 803 | { |
803 | SLMP_INFO * info = (SLMP_INFO *)tty->driver_data; | 804 | SLMP_INFO * info = tty->driver_data; |
804 | 805 | ||
805 | if (sanity_check(info, tty->name, "close")) | 806 | if (sanity_check(info, tty->name, "close")) |
806 | return; | 807 | return; |
@@ -809,70 +810,18 @@ static void close(struct tty_struct *tty, struct file *filp) | |||
809 | printk("%s(%d):%s close() entry, count=%d\n", | 810 | printk("%s(%d):%s close() entry, count=%d\n", |
810 | __FILE__,__LINE__, info->device_name, info->port.count); | 811 | __FILE__,__LINE__, info->device_name, info->port.count); |
811 | 812 | ||
812 | if (!info->port.count) | 813 | if (tty_port_close_start(&info->port, tty, filp) == 0) |
813 | return; | ||
814 | |||
815 | if (tty_hung_up_p(filp)) | ||
816 | goto cleanup; | ||
817 | |||
818 | if ((tty->count == 1) && (info->port.count != 1)) { | ||
819 | /* | ||
820 | * tty->count is 1 and the tty structure will be freed. | ||
821 | * info->port.count should be one in this case. | ||
822 | * if it's not, correct it so that the port is shutdown. | ||
823 | */ | ||
824 | printk("%s(%d):%s close: bad refcount; tty->count is 1, " | ||
825 | "info->port.count is %d\n", | ||
826 | __FILE__,__LINE__, info->device_name, info->port.count); | ||
827 | info->port.count = 1; | ||
828 | } | ||
829 | |||
830 | info->port.count--; | ||
831 | |||
832 | /* if at least one open remaining, leave hardware active */ | ||
833 | if (info->port.count) | ||
834 | goto cleanup; | 814 | goto cleanup; |
835 | 815 | ||
836 | info->port.flags |= ASYNC_CLOSING; | ||
837 | |||
838 | /* set tty->closing to notify line discipline to | ||
839 | * only process XON/XOFF characters. Only the N_TTY | ||
840 | * discipline appears to use this (ppp does not). | ||
841 | */ | ||
842 | tty->closing = 1; | ||
843 | |||
844 | /* wait for transmit data to clear all layers */ | ||
845 | |||
846 | if (info->port.closing_wait != ASYNC_CLOSING_WAIT_NONE) { | ||
847 | if (debug_level >= DEBUG_LEVEL_INFO) | ||
848 | printk("%s(%d):%s close() calling tty_wait_until_sent\n", | ||
849 | __FILE__,__LINE__, info->device_name ); | ||
850 | tty_wait_until_sent(tty, info->port.closing_wait); | ||
851 | } | ||
852 | |||
853 | if (info->port.flags & ASYNC_INITIALIZED) | 816 | if (info->port.flags & ASYNC_INITIALIZED) |
854 | wait_until_sent(tty, info->timeout); | 817 | wait_until_sent(tty, info->timeout); |
855 | 818 | ||
856 | flush_buffer(tty); | 819 | flush_buffer(tty); |
857 | |||
858 | tty_ldisc_flush(tty); | 820 | tty_ldisc_flush(tty); |
859 | |||
860 | shutdown(info); | 821 | shutdown(info); |
861 | 822 | ||
862 | tty->closing = 0; | 823 | tty_port_close_end(&info->port, tty); |
863 | info->port.tty = NULL; | 824 | info->port.tty = NULL; |
864 | |||
865 | if (info->port.blocked_open) { | ||
866 | if (info->port.close_delay) { | ||
867 | msleep_interruptible(jiffies_to_msecs(info->port.close_delay)); | ||
868 | } | ||
869 | wake_up_interruptible(&info->port.open_wait); | ||
870 | } | ||
871 | |||
872 | info->port.flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING); | ||
873 | |||
874 | wake_up_interruptible(&info->port.close_wait); | ||
875 | |||
876 | cleanup: | 825 | cleanup: |
877 | if (debug_level >= DEBUG_LEVEL_INFO) | 826 | if (debug_level >= DEBUG_LEVEL_INFO) |
878 | printk("%s(%d):%s close() exit, count=%d\n", __FILE__,__LINE__, | 827 | printk("%s(%d):%s close() exit, count=%d\n", __FILE__,__LINE__, |
@@ -884,7 +833,7 @@ cleanup: | |||
884 | */ | 833 | */ |
885 | static void hangup(struct tty_struct *tty) | 834 | static void hangup(struct tty_struct *tty) |
886 | { | 835 | { |
887 | SLMP_INFO *info = (SLMP_INFO *)tty->driver_data; | 836 | SLMP_INFO *info = tty->driver_data; |
888 | 837 | ||
889 | if (debug_level >= DEBUG_LEVEL_INFO) | 838 | if (debug_level >= DEBUG_LEVEL_INFO) |
890 | printk("%s(%d):%s hangup()\n", | 839 | printk("%s(%d):%s hangup()\n", |
@@ -907,7 +856,7 @@ static void hangup(struct tty_struct *tty) | |||
907 | */ | 856 | */ |
908 | static void set_termios(struct tty_struct *tty, struct ktermios *old_termios) | 857 | static void set_termios(struct tty_struct *tty, struct ktermios *old_termios) |
909 | { | 858 | { |
910 | SLMP_INFO *info = (SLMP_INFO *)tty->driver_data; | 859 | SLMP_INFO *info = tty->driver_data; |
911 | unsigned long flags; | 860 | unsigned long flags; |
912 | 861 | ||
913 | if (debug_level >= DEBUG_LEVEL_INFO) | 862 | if (debug_level >= DEBUG_LEVEL_INFO) |
@@ -960,7 +909,7 @@ static int write(struct tty_struct *tty, | |||
960 | const unsigned char *buf, int count) | 909 | const unsigned char *buf, int count) |
961 | { | 910 | { |
962 | int c, ret = 0; | 911 | int c, ret = 0; |
963 | SLMP_INFO *info = (SLMP_INFO *)tty->driver_data; | 912 | SLMP_INFO *info = tty->driver_data; |
964 | unsigned long flags; | 913 | unsigned long flags; |
965 | 914 | ||
966 | if (debug_level >= DEBUG_LEVEL_INFO) | 915 | if (debug_level >= DEBUG_LEVEL_INFO) |
@@ -1038,7 +987,7 @@ cleanup: | |||
1038 | */ | 987 | */ |
1039 | static int put_char(struct tty_struct *tty, unsigned char ch) | 988 | static int put_char(struct tty_struct *tty, unsigned char ch) |
1040 | { | 989 | { |
1041 | SLMP_INFO *info = (SLMP_INFO *)tty->driver_data; | 990 | SLMP_INFO *info = tty->driver_data; |
1042 | unsigned long flags; | 991 | unsigned long flags; |
1043 | int ret = 0; | 992 | int ret = 0; |
1044 | 993 | ||
@@ -1075,7 +1024,7 @@ static int put_char(struct tty_struct *tty, unsigned char ch) | |||
1075 | */ | 1024 | */ |
1076 | static void send_xchar(struct tty_struct *tty, char ch) | 1025 | static void send_xchar(struct tty_struct *tty, char ch) |
1077 | { | 1026 | { |
1078 | SLMP_INFO *info = (SLMP_INFO *)tty->driver_data; | 1027 | SLMP_INFO *info = tty->driver_data; |
1079 | unsigned long flags; | 1028 | unsigned long flags; |
1080 | 1029 | ||
1081 | if (debug_level >= DEBUG_LEVEL_INFO) | 1030 | if (debug_level >= DEBUG_LEVEL_INFO) |
@@ -1099,7 +1048,7 @@ static void send_xchar(struct tty_struct *tty, char ch) | |||
1099 | */ | 1048 | */ |
1100 | static void wait_until_sent(struct tty_struct *tty, int timeout) | 1049 | static void wait_until_sent(struct tty_struct *tty, int timeout) |
1101 | { | 1050 | { |
1102 | SLMP_INFO * info = (SLMP_INFO *)tty->driver_data; | 1051 | SLMP_INFO * info = tty->driver_data; |
1103 | unsigned long orig_jiffies, char_time; | 1052 | unsigned long orig_jiffies, char_time; |
1104 | 1053 | ||
1105 | if (!info ) | 1054 | if (!info ) |
@@ -1166,7 +1115,7 @@ exit: | |||
1166 | */ | 1115 | */ |
1167 | static int write_room(struct tty_struct *tty) | 1116 | static int write_room(struct tty_struct *tty) |
1168 | { | 1117 | { |
1169 | SLMP_INFO *info = (SLMP_INFO *)tty->driver_data; | 1118 | SLMP_INFO *info = tty->driver_data; |
1170 | int ret; | 1119 | int ret; |
1171 | 1120 | ||
1172 | if (sanity_check(info, tty->name, "write_room")) | 1121 | if (sanity_check(info, tty->name, "write_room")) |
@@ -1193,7 +1142,7 @@ static int write_room(struct tty_struct *tty) | |||
1193 | */ | 1142 | */ |
1194 | static void flush_chars(struct tty_struct *tty) | 1143 | static void flush_chars(struct tty_struct *tty) |
1195 | { | 1144 | { |
1196 | SLMP_INFO *info = (SLMP_INFO *)tty->driver_data; | 1145 | SLMP_INFO *info = tty->driver_data; |
1197 | unsigned long flags; | 1146 | unsigned long flags; |
1198 | 1147 | ||
1199 | if ( debug_level >= DEBUG_LEVEL_INFO ) | 1148 | if ( debug_level >= DEBUG_LEVEL_INFO ) |
@@ -1232,7 +1181,7 @@ static void flush_chars(struct tty_struct *tty) | |||
1232 | */ | 1181 | */ |
1233 | static void flush_buffer(struct tty_struct *tty) | 1182 | static void flush_buffer(struct tty_struct *tty) |
1234 | { | 1183 | { |
1235 | SLMP_INFO *info = (SLMP_INFO *)tty->driver_data; | 1184 | SLMP_INFO *info = tty->driver_data; |
1236 | unsigned long flags; | 1185 | unsigned long flags; |
1237 | 1186 | ||
1238 | if (debug_level >= DEBUG_LEVEL_INFO) | 1187 | if (debug_level >= DEBUG_LEVEL_INFO) |
@@ -1254,7 +1203,7 @@ static void flush_buffer(struct tty_struct *tty) | |||
1254 | */ | 1203 | */ |
1255 | static void tx_hold(struct tty_struct *tty) | 1204 | static void tx_hold(struct tty_struct *tty) |
1256 | { | 1205 | { |
1257 | SLMP_INFO *info = (SLMP_INFO *)tty->driver_data; | 1206 | SLMP_INFO *info = tty->driver_data; |
1258 | unsigned long flags; | 1207 | unsigned long flags; |
1259 | 1208 | ||
1260 | if (sanity_check(info, tty->name, "tx_hold")) | 1209 | if (sanity_check(info, tty->name, "tx_hold")) |
@@ -1274,7 +1223,7 @@ static void tx_hold(struct tty_struct *tty) | |||
1274 | */ | 1223 | */ |
1275 | static void tx_release(struct tty_struct *tty) | 1224 | static void tx_release(struct tty_struct *tty) |
1276 | { | 1225 | { |
1277 | SLMP_INFO *info = (SLMP_INFO *)tty->driver_data; | 1226 | SLMP_INFO *info = tty->driver_data; |
1278 | unsigned long flags; | 1227 | unsigned long flags; |
1279 | 1228 | ||
1280 | if (sanity_check(info, tty->name, "tx_release")) | 1229 | if (sanity_check(info, tty->name, "tx_release")) |
@@ -1304,7 +1253,7 @@ static void tx_release(struct tty_struct *tty) | |||
1304 | static int do_ioctl(struct tty_struct *tty, struct file *file, | 1253 | static int do_ioctl(struct tty_struct *tty, struct file *file, |
1305 | unsigned int cmd, unsigned long arg) | 1254 | unsigned int cmd, unsigned long arg) |
1306 | { | 1255 | { |
1307 | SLMP_INFO *info = (SLMP_INFO *)tty->driver_data; | 1256 | SLMP_INFO *info = tty->driver_data; |
1308 | int error; | 1257 | int error; |
1309 | struct mgsl_icount cnow; /* kernel counter temps */ | 1258 | struct mgsl_icount cnow; /* kernel counter temps */ |
1310 | struct serial_icounter_struct __user *p_cuser; /* user space */ | 1259 | struct serial_icounter_struct __user *p_cuser; /* user space */ |
@@ -1515,7 +1464,7 @@ done: | |||
1515 | */ | 1464 | */ |
1516 | static int chars_in_buffer(struct tty_struct *tty) | 1465 | static int chars_in_buffer(struct tty_struct *tty) |
1517 | { | 1466 | { |
1518 | SLMP_INFO *info = (SLMP_INFO *)tty->driver_data; | 1467 | SLMP_INFO *info = tty->driver_data; |
1519 | 1468 | ||
1520 | if (sanity_check(info, tty->name, "chars_in_buffer")) | 1469 | if (sanity_check(info, tty->name, "chars_in_buffer")) |
1521 | return 0; | 1470 | return 0; |
@@ -1531,7 +1480,7 @@ static int chars_in_buffer(struct tty_struct *tty) | |||
1531 | */ | 1480 | */ |
1532 | static void throttle(struct tty_struct * tty) | 1481 | static void throttle(struct tty_struct * tty) |
1533 | { | 1482 | { |
1534 | SLMP_INFO *info = (SLMP_INFO *)tty->driver_data; | 1483 | SLMP_INFO *info = tty->driver_data; |
1535 | unsigned long flags; | 1484 | unsigned long flags; |
1536 | 1485 | ||
1537 | if (debug_level >= DEBUG_LEVEL_INFO) | 1486 | if (debug_level >= DEBUG_LEVEL_INFO) |
@@ -1556,7 +1505,7 @@ static void throttle(struct tty_struct * tty) | |||
1556 | */ | 1505 | */ |
1557 | static void unthrottle(struct tty_struct * tty) | 1506 | static void unthrottle(struct tty_struct * tty) |
1558 | { | 1507 | { |
1559 | SLMP_INFO *info = (SLMP_INFO *)tty->driver_data; | 1508 | SLMP_INFO *info = tty->driver_data; |
1560 | unsigned long flags; | 1509 | unsigned long flags; |
1561 | 1510 | ||
1562 | if (debug_level >= DEBUG_LEVEL_INFO) | 1511 | if (debug_level >= DEBUG_LEVEL_INFO) |
@@ -1587,7 +1536,7 @@ static void unthrottle(struct tty_struct * tty) | |||
1587 | static int set_break(struct tty_struct *tty, int break_state) | 1536 | static int set_break(struct tty_struct *tty, int break_state) |
1588 | { | 1537 | { |
1589 | unsigned char RegValue; | 1538 | unsigned char RegValue; |
1590 | SLMP_INFO * info = (SLMP_INFO *)tty->driver_data; | 1539 | SLMP_INFO * info = tty->driver_data; |
1591 | unsigned long flags; | 1540 | unsigned long flags; |
1592 | 1541 | ||
1593 | if (debug_level >= DEBUG_LEVEL_INFO) | 1542 | if (debug_level >= DEBUG_LEVEL_INFO) |
@@ -3269,7 +3218,7 @@ static int modem_input_wait(SLMP_INFO *info,int arg) | |||
3269 | */ | 3218 | */ |
3270 | static int tiocmget(struct tty_struct *tty, struct file *file) | 3219 | static int tiocmget(struct tty_struct *tty, struct file *file) |
3271 | { | 3220 | { |
3272 | SLMP_INFO *info = (SLMP_INFO *)tty->driver_data; | 3221 | SLMP_INFO *info = tty->driver_data; |
3273 | unsigned int result; | 3222 | unsigned int result; |
3274 | unsigned long flags; | 3223 | unsigned long flags; |
3275 | 3224 | ||
@@ -3295,7 +3244,7 @@ static int tiocmget(struct tty_struct *tty, struct file *file) | |||
3295 | static int tiocmset(struct tty_struct *tty, struct file *file, | 3244 | static int tiocmset(struct tty_struct *tty, struct file *file, |
3296 | unsigned int set, unsigned int clear) | 3245 | unsigned int set, unsigned int clear) |
3297 | { | 3246 | { |
3298 | SLMP_INFO *info = (SLMP_INFO *)tty->driver_data; | 3247 | SLMP_INFO *info = tty->driver_data; |
3299 | unsigned long flags; | 3248 | unsigned long flags; |
3300 | 3249 | ||
3301 | if (debug_level >= DEBUG_LEVEL_INFO) | 3250 | if (debug_level >= DEBUG_LEVEL_INFO) |
@@ -3318,7 +3267,28 @@ static int tiocmset(struct tty_struct *tty, struct file *file, | |||
3318 | return 0; | 3267 | return 0; |
3319 | } | 3268 | } |
3320 | 3269 | ||
3270 | static int carrier_raised(struct tty_port *port) | ||
3271 | { | ||
3272 | SLMP_INFO *info = container_of(port, SLMP_INFO, port); | ||
3273 | unsigned long flags; | ||
3274 | |||
3275 | spin_lock_irqsave(&info->lock,flags); | ||
3276 | get_signals(info); | ||
3277 | spin_unlock_irqrestore(&info->lock,flags); | ||
3321 | 3278 | ||
3279 | return (info->serial_signals & SerialSignal_DCD) ? 1 : 0; | ||
3280 | } | ||
3281 | |||
3282 | static void raise_dtr_rts(struct tty_port *port) | ||
3283 | { | ||
3284 | SLMP_INFO *info = container_of(port, SLMP_INFO, port); | ||
3285 | unsigned long flags; | ||
3286 | |||
3287 | spin_lock_irqsave(&info->lock,flags); | ||
3288 | info->serial_signals |= SerialSignal_RTS + SerialSignal_DTR; | ||
3289 | set_signals(info); | ||
3290 | spin_unlock_irqrestore(&info->lock,flags); | ||
3291 | } | ||
3322 | 3292 | ||
3323 | /* Block the current process until the specified port is ready to open. | 3293 | /* Block the current process until the specified port is ready to open. |
3324 | */ | 3294 | */ |
@@ -3330,6 +3300,8 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp, | |||
3330 | bool do_clocal = false; | 3300 | bool do_clocal = false; |
3331 | bool extra_count = false; | 3301 | bool extra_count = false; |
3332 | unsigned long flags; | 3302 | unsigned long flags; |
3303 | int cd; | ||
3304 | struct tty_port *port = &info->port; | ||
3333 | 3305 | ||
3334 | if (debug_level >= DEBUG_LEVEL_INFO) | 3306 | if (debug_level >= DEBUG_LEVEL_INFO) |
3335 | printk("%s(%d):%s block_til_ready()\n", | 3307 | printk("%s(%d):%s block_til_ready()\n", |
@@ -3338,7 +3310,7 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp, | |||
3338 | if (filp->f_flags & O_NONBLOCK || tty->flags & (1 << TTY_IO_ERROR)){ | 3310 | if (filp->f_flags & O_NONBLOCK || tty->flags & (1 << TTY_IO_ERROR)){ |
3339 | /* nonblock mode is set or port is not enabled */ | 3311 | /* nonblock mode is set or port is not enabled */ |
3340 | /* just verify that callout device is not active */ | 3312 | /* just verify that callout device is not active */ |
3341 | info->port.flags |= ASYNC_NORMAL_ACTIVE; | 3313 | port->flags |= ASYNC_NORMAL_ACTIVE; |
3342 | return 0; | 3314 | return 0; |
3343 | } | 3315 | } |
3344 | 3316 | ||
@@ -3347,50 +3319,42 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp, | |||
3347 | 3319 | ||
3348 | /* Wait for carrier detect and the line to become | 3320 | /* Wait for carrier detect and the line to become |
3349 | * free (i.e., not in use by the callout). While we are in | 3321 | * free (i.e., not in use by the callout). While we are in |
3350 | * this loop, info->port.count is dropped by one, so that | 3322 | * this loop, port->count is dropped by one, so that |
3351 | * close() knows when to free things. We restore it upon | 3323 | * close() knows when to free things. We restore it upon |
3352 | * exit, either normal or abnormal. | 3324 | * exit, either normal or abnormal. |
3353 | */ | 3325 | */ |
3354 | 3326 | ||
3355 | retval = 0; | 3327 | retval = 0; |
3356 | add_wait_queue(&info->port.open_wait, &wait); | 3328 | add_wait_queue(&port->open_wait, &wait); |
3357 | 3329 | ||
3358 | if (debug_level >= DEBUG_LEVEL_INFO) | 3330 | if (debug_level >= DEBUG_LEVEL_INFO) |
3359 | printk("%s(%d):%s block_til_ready() before block, count=%d\n", | 3331 | printk("%s(%d):%s block_til_ready() before block, count=%d\n", |
3360 | __FILE__,__LINE__, tty->driver->name, info->port.count ); | 3332 | __FILE__,__LINE__, tty->driver->name, port->count ); |
3361 | 3333 | ||
3362 | spin_lock_irqsave(&info->lock, flags); | 3334 | spin_lock_irqsave(&info->lock, flags); |
3363 | if (!tty_hung_up_p(filp)) { | 3335 | if (!tty_hung_up_p(filp)) { |
3364 | extra_count = true; | 3336 | extra_count = true; |
3365 | info->port.count--; | 3337 | port->count--; |
3366 | } | 3338 | } |
3367 | spin_unlock_irqrestore(&info->lock, flags); | 3339 | spin_unlock_irqrestore(&info->lock, flags); |
3368 | info->port.blocked_open++; | 3340 | port->blocked_open++; |
3369 | 3341 | ||
3370 | while (1) { | 3342 | while (1) { |
3371 | if ((tty->termios->c_cflag & CBAUD)) { | 3343 | if (tty->termios->c_cflag & CBAUD) |
3372 | spin_lock_irqsave(&info->lock,flags); | 3344 | tty_port_raise_dtr_rts(port); |
3373 | info->serial_signals |= SerialSignal_RTS + SerialSignal_DTR; | ||
3374 | set_signals(info); | ||
3375 | spin_unlock_irqrestore(&info->lock,flags); | ||
3376 | } | ||
3377 | 3345 | ||
3378 | set_current_state(TASK_INTERRUPTIBLE); | 3346 | set_current_state(TASK_INTERRUPTIBLE); |
3379 | 3347 | ||
3380 | if (tty_hung_up_p(filp) || !(info->port.flags & ASYNC_INITIALIZED)){ | 3348 | if (tty_hung_up_p(filp) || !(port->flags & ASYNC_INITIALIZED)){ |
3381 | retval = (info->port.flags & ASYNC_HUP_NOTIFY) ? | 3349 | retval = (port->flags & ASYNC_HUP_NOTIFY) ? |
3382 | -EAGAIN : -ERESTARTSYS; | 3350 | -EAGAIN : -ERESTARTSYS; |
3383 | break; | 3351 | break; |
3384 | } | 3352 | } |
3385 | 3353 | ||
3386 | spin_lock_irqsave(&info->lock,flags); | 3354 | cd = tty_port_carrier_raised(port); |
3387 | get_signals(info); | ||
3388 | spin_unlock_irqrestore(&info->lock,flags); | ||
3389 | 3355 | ||
3390 | if (!(info->port.flags & ASYNC_CLOSING) && | 3356 | if (!(port->flags & ASYNC_CLOSING) && (do_clocal || cd)) |
3391 | (do_clocal || (info->serial_signals & SerialSignal_DCD)) ) { | ||
3392 | break; | 3357 | break; |
3393 | } | ||
3394 | 3358 | ||
3395 | if (signal_pending(current)) { | 3359 | if (signal_pending(current)) { |
3396 | retval = -ERESTARTSYS; | 3360 | retval = -ERESTARTSYS; |
@@ -3399,24 +3363,24 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp, | |||
3399 | 3363 | ||
3400 | if (debug_level >= DEBUG_LEVEL_INFO) | 3364 | if (debug_level >= DEBUG_LEVEL_INFO) |
3401 | printk("%s(%d):%s block_til_ready() count=%d\n", | 3365 | printk("%s(%d):%s block_til_ready() count=%d\n", |
3402 | __FILE__,__LINE__, tty->driver->name, info->port.count ); | 3366 | __FILE__,__LINE__, tty->driver->name, port->count ); |
3403 | 3367 | ||
3404 | schedule(); | 3368 | schedule(); |
3405 | } | 3369 | } |
3406 | 3370 | ||
3407 | set_current_state(TASK_RUNNING); | 3371 | set_current_state(TASK_RUNNING); |
3408 | remove_wait_queue(&info->port.open_wait, &wait); | 3372 | remove_wait_queue(&port->open_wait, &wait); |
3409 | 3373 | ||
3410 | if (extra_count) | 3374 | if (extra_count) |
3411 | info->port.count++; | 3375 | port->count++; |
3412 | info->port.blocked_open--; | 3376 | port->blocked_open--; |
3413 | 3377 | ||
3414 | if (debug_level >= DEBUG_LEVEL_INFO) | 3378 | if (debug_level >= DEBUG_LEVEL_INFO) |
3415 | printk("%s(%d):%s block_til_ready() after, count=%d\n", | 3379 | printk("%s(%d):%s block_til_ready() after, count=%d\n", |
3416 | __FILE__,__LINE__, tty->driver->name, info->port.count ); | 3380 | __FILE__,__LINE__, tty->driver->name, port->count ); |
3417 | 3381 | ||
3418 | if (!retval) | 3382 | if (!retval) |
3419 | info->port.flags |= ASYNC_NORMAL_ACTIVE; | 3383 | port->flags |= ASYNC_NORMAL_ACTIVE; |
3420 | 3384 | ||
3421 | return retval; | 3385 | return retval; |
3422 | } | 3386 | } |
@@ -3782,6 +3746,11 @@ static void add_device(SLMP_INFO *info) | |||
3782 | #endif | 3746 | #endif |
3783 | } | 3747 | } |
3784 | 3748 | ||
3749 | static const struct tty_port_operations port_ops = { | ||
3750 | .carrier_raised = carrier_raised, | ||
3751 | .raise_dtr_rts = raise_dtr_rts, | ||
3752 | }; | ||
3753 | |||
3785 | /* Allocate and initialize a device instance structure | 3754 | /* Allocate and initialize a device instance structure |
3786 | * | 3755 | * |
3787 | * Return Value: pointer to SLMP_INFO if success, otherwise NULL | 3756 | * Return Value: pointer to SLMP_INFO if success, otherwise NULL |
@@ -3798,6 +3767,7 @@ static SLMP_INFO *alloc_dev(int adapter_num, int port_num, struct pci_dev *pdev) | |||
3798 | __FILE__,__LINE__, adapter_num, port_num); | 3767 | __FILE__,__LINE__, adapter_num, port_num); |
3799 | } else { | 3768 | } else { |
3800 | tty_port_init(&info->port); | 3769 | tty_port_init(&info->port); |
3770 | info->port.ops = &port_ops; | ||
3801 | info->magic = MGSL_MAGIC; | 3771 | info->magic = MGSL_MAGIC; |
3802 | INIT_WORK(&info->task, bh_handler); | 3772 | INIT_WORK(&info->task, bh_handler); |
3803 | info->max_frame_size = 4096; | 3773 | info->max_frame_size = 4096; |
@@ -3940,6 +3910,7 @@ static const struct tty_operations ops = { | |||
3940 | .tiocmset = tiocmset, | 3910 | .tiocmset = tiocmset, |
3941 | }; | 3911 | }; |
3942 | 3912 | ||
3913 | |||
3943 | static void synclinkmp_cleanup(void) | 3914 | static void synclinkmp_cleanup(void) |
3944 | { | 3915 | { |
3945 | int rc; | 3916 | int rc; |