diff options
Diffstat (limited to 'drivers/char/synclink.c')
-rw-r--r-- | drivers/char/synclink.c | 177 |
1 files changed, 78 insertions, 99 deletions
diff --git a/drivers/char/synclink.c b/drivers/char/synclink.c index 500f5176b6ba..b8063d4cad32 100644 --- a/drivers/char/synclink.c +++ b/drivers/char/synclink.c | |||
@@ -977,7 +977,7 @@ static void ldisc_receive_buf(struct tty_struct *tty, | |||
977 | */ | 977 | */ |
978 | static void mgsl_stop(struct tty_struct *tty) | 978 | static void mgsl_stop(struct tty_struct *tty) |
979 | { | 979 | { |
980 | struct mgsl_struct *info = (struct mgsl_struct *)tty->driver_data; | 980 | struct mgsl_struct *info = tty->driver_data; |
981 | unsigned long flags; | 981 | unsigned long flags; |
982 | 982 | ||
983 | if (mgsl_paranoia_check(info, tty->name, "mgsl_stop")) | 983 | if (mgsl_paranoia_check(info, tty->name, "mgsl_stop")) |
@@ -1000,7 +1000,7 @@ static void mgsl_stop(struct tty_struct *tty) | |||
1000 | */ | 1000 | */ |
1001 | static void mgsl_start(struct tty_struct *tty) | 1001 | static void mgsl_start(struct tty_struct *tty) |
1002 | { | 1002 | { |
1003 | struct mgsl_struct *info = (struct mgsl_struct *)tty->driver_data; | 1003 | struct mgsl_struct *info = tty->driver_data; |
1004 | unsigned long flags; | 1004 | unsigned long flags; |
1005 | 1005 | ||
1006 | if (mgsl_paranoia_check(info, tty->name, "mgsl_start")) | 1006 | if (mgsl_paranoia_check(info, tty->name, "mgsl_start")) |
@@ -2057,7 +2057,7 @@ static int mgsl_put_char(struct tty_struct *tty, unsigned char ch) | |||
2057 | */ | 2057 | */ |
2058 | static void mgsl_flush_chars(struct tty_struct *tty) | 2058 | static void mgsl_flush_chars(struct tty_struct *tty) |
2059 | { | 2059 | { |
2060 | struct mgsl_struct *info = (struct mgsl_struct *)tty->driver_data; | 2060 | struct mgsl_struct *info = tty->driver_data; |
2061 | unsigned long flags; | 2061 | unsigned long flags; |
2062 | 2062 | ||
2063 | if ( debug_level >= DEBUG_LEVEL_INFO ) | 2063 | if ( debug_level >= DEBUG_LEVEL_INFO ) |
@@ -2109,7 +2109,7 @@ static int mgsl_write(struct tty_struct * tty, | |||
2109 | const unsigned char *buf, int count) | 2109 | const unsigned char *buf, int count) |
2110 | { | 2110 | { |
2111 | int c, ret = 0; | 2111 | int c, ret = 0; |
2112 | struct mgsl_struct *info = (struct mgsl_struct *)tty->driver_data; | 2112 | struct mgsl_struct *info = tty->driver_data; |
2113 | unsigned long flags; | 2113 | unsigned long flags; |
2114 | 2114 | ||
2115 | if ( debug_level >= DEBUG_LEVEL_INFO ) | 2115 | if ( debug_level >= DEBUG_LEVEL_INFO ) |
@@ -2232,7 +2232,7 @@ cleanup: | |||
2232 | */ | 2232 | */ |
2233 | static int mgsl_write_room(struct tty_struct *tty) | 2233 | static int mgsl_write_room(struct tty_struct *tty) |
2234 | { | 2234 | { |
2235 | struct mgsl_struct *info = (struct mgsl_struct *)tty->driver_data; | 2235 | struct mgsl_struct *info = tty->driver_data; |
2236 | int ret; | 2236 | int ret; |
2237 | 2237 | ||
2238 | if (mgsl_paranoia_check(info, tty->name, "mgsl_write_room")) | 2238 | if (mgsl_paranoia_check(info, tty->name, "mgsl_write_room")) |
@@ -2267,7 +2267,7 @@ static int mgsl_write_room(struct tty_struct *tty) | |||
2267 | */ | 2267 | */ |
2268 | static int mgsl_chars_in_buffer(struct tty_struct *tty) | 2268 | static int mgsl_chars_in_buffer(struct tty_struct *tty) |
2269 | { | 2269 | { |
2270 | struct mgsl_struct *info = (struct mgsl_struct *)tty->driver_data; | 2270 | struct mgsl_struct *info = tty->driver_data; |
2271 | 2271 | ||
2272 | if (debug_level >= DEBUG_LEVEL_INFO) | 2272 | if (debug_level >= DEBUG_LEVEL_INFO) |
2273 | printk("%s(%d):mgsl_chars_in_buffer(%s)\n", | 2273 | printk("%s(%d):mgsl_chars_in_buffer(%s)\n", |
@@ -2301,7 +2301,7 @@ static int mgsl_chars_in_buffer(struct tty_struct *tty) | |||
2301 | */ | 2301 | */ |
2302 | static void mgsl_flush_buffer(struct tty_struct *tty) | 2302 | static void mgsl_flush_buffer(struct tty_struct *tty) |
2303 | { | 2303 | { |
2304 | struct mgsl_struct *info = (struct mgsl_struct *)tty->driver_data; | 2304 | struct mgsl_struct *info = tty->driver_data; |
2305 | unsigned long flags; | 2305 | unsigned long flags; |
2306 | 2306 | ||
2307 | if (debug_level >= DEBUG_LEVEL_INFO) | 2307 | if (debug_level >= DEBUG_LEVEL_INFO) |
@@ -2329,7 +2329,7 @@ static void mgsl_flush_buffer(struct tty_struct *tty) | |||
2329 | */ | 2329 | */ |
2330 | static void mgsl_send_xchar(struct tty_struct *tty, char ch) | 2330 | static void mgsl_send_xchar(struct tty_struct *tty, char ch) |
2331 | { | 2331 | { |
2332 | struct mgsl_struct *info = (struct mgsl_struct *)tty->driver_data; | 2332 | struct mgsl_struct *info = tty->driver_data; |
2333 | unsigned long flags; | 2333 | unsigned long flags; |
2334 | 2334 | ||
2335 | if (debug_level >= DEBUG_LEVEL_INFO) | 2335 | if (debug_level >= DEBUG_LEVEL_INFO) |
@@ -2358,7 +2358,7 @@ static void mgsl_send_xchar(struct tty_struct *tty, char ch) | |||
2358 | */ | 2358 | */ |
2359 | static void mgsl_throttle(struct tty_struct * tty) | 2359 | static void mgsl_throttle(struct tty_struct * tty) |
2360 | { | 2360 | { |
2361 | struct mgsl_struct *info = (struct mgsl_struct *)tty->driver_data; | 2361 | struct mgsl_struct *info = tty->driver_data; |
2362 | unsigned long flags; | 2362 | unsigned long flags; |
2363 | 2363 | ||
2364 | if (debug_level >= DEBUG_LEVEL_INFO) | 2364 | if (debug_level >= DEBUG_LEVEL_INFO) |
@@ -2388,7 +2388,7 @@ static void mgsl_throttle(struct tty_struct * tty) | |||
2388 | */ | 2388 | */ |
2389 | static void mgsl_unthrottle(struct tty_struct * tty) | 2389 | static void mgsl_unthrottle(struct tty_struct * tty) |
2390 | { | 2390 | { |
2391 | struct mgsl_struct *info = (struct mgsl_struct *)tty->driver_data; | 2391 | struct mgsl_struct *info = tty->driver_data; |
2392 | unsigned long flags; | 2392 | unsigned long flags; |
2393 | 2393 | ||
2394 | if (debug_level >= DEBUG_LEVEL_INFO) | 2394 | if (debug_level >= DEBUG_LEVEL_INFO) |
@@ -2841,7 +2841,7 @@ static int modem_input_wait(struct mgsl_struct *info,int arg) | |||
2841 | */ | 2841 | */ |
2842 | static int tiocmget(struct tty_struct *tty, struct file *file) | 2842 | static int tiocmget(struct tty_struct *tty, struct file *file) |
2843 | { | 2843 | { |
2844 | struct mgsl_struct *info = (struct mgsl_struct *)tty->driver_data; | 2844 | struct mgsl_struct *info = tty->driver_data; |
2845 | unsigned int result; | 2845 | unsigned int result; |
2846 | unsigned long flags; | 2846 | unsigned long flags; |
2847 | 2847 | ||
@@ -2867,7 +2867,7 @@ static int tiocmget(struct tty_struct *tty, struct file *file) | |||
2867 | static int tiocmset(struct tty_struct *tty, struct file *file, | 2867 | static int tiocmset(struct tty_struct *tty, struct file *file, |
2868 | unsigned int set, unsigned int clear) | 2868 | unsigned int set, unsigned int clear) |
2869 | { | 2869 | { |
2870 | struct mgsl_struct *info = (struct mgsl_struct *)tty->driver_data; | 2870 | struct mgsl_struct *info = tty->driver_data; |
2871 | unsigned long flags; | 2871 | unsigned long flags; |
2872 | 2872 | ||
2873 | if (debug_level >= DEBUG_LEVEL_INFO) | 2873 | if (debug_level >= DEBUG_LEVEL_INFO) |
@@ -2898,7 +2898,7 @@ static int tiocmset(struct tty_struct *tty, struct file *file, | |||
2898 | */ | 2898 | */ |
2899 | static int mgsl_break(struct tty_struct *tty, int break_state) | 2899 | static int mgsl_break(struct tty_struct *tty, int break_state) |
2900 | { | 2900 | { |
2901 | struct mgsl_struct * info = (struct mgsl_struct *)tty->driver_data; | 2901 | struct mgsl_struct * info = tty->driver_data; |
2902 | unsigned long flags; | 2902 | unsigned long flags; |
2903 | 2903 | ||
2904 | if (debug_level >= DEBUG_LEVEL_INFO) | 2904 | if (debug_level >= DEBUG_LEVEL_INFO) |
@@ -2932,7 +2932,7 @@ static int mgsl_break(struct tty_struct *tty, int break_state) | |||
2932 | static int mgsl_ioctl(struct tty_struct *tty, struct file * file, | 2932 | static int mgsl_ioctl(struct tty_struct *tty, struct file * file, |
2933 | unsigned int cmd, unsigned long arg) | 2933 | unsigned int cmd, unsigned long arg) |
2934 | { | 2934 | { |
2935 | struct mgsl_struct * info = (struct mgsl_struct *)tty->driver_data; | 2935 | struct mgsl_struct * info = tty->driver_data; |
2936 | int ret; | 2936 | int ret; |
2937 | 2937 | ||
2938 | if (debug_level >= DEBUG_LEVEL_INFO) | 2938 | if (debug_level >= DEBUG_LEVEL_INFO) |
@@ -3042,7 +3042,7 @@ static int mgsl_ioctl_common(struct mgsl_struct *info, unsigned int cmd, unsigne | |||
3042 | */ | 3042 | */ |
3043 | static void mgsl_set_termios(struct tty_struct *tty, struct ktermios *old_termios) | 3043 | static void mgsl_set_termios(struct tty_struct *tty, struct ktermios *old_termios) |
3044 | { | 3044 | { |
3045 | struct mgsl_struct *info = (struct mgsl_struct *)tty->driver_data; | 3045 | struct mgsl_struct *info = tty->driver_data; |
3046 | unsigned long flags; | 3046 | unsigned long flags; |
3047 | 3047 | ||
3048 | if (debug_level >= DEBUG_LEVEL_INFO) | 3048 | if (debug_level >= DEBUG_LEVEL_INFO) |
@@ -3096,7 +3096,7 @@ static void mgsl_set_termios(struct tty_struct *tty, struct ktermios *old_termio | |||
3096 | */ | 3096 | */ |
3097 | static void mgsl_close(struct tty_struct *tty, struct file * filp) | 3097 | static void mgsl_close(struct tty_struct *tty, struct file * filp) |
3098 | { | 3098 | { |
3099 | struct mgsl_struct * info = (struct mgsl_struct *)tty->driver_data; | 3099 | struct mgsl_struct * info = tty->driver_data; |
3100 | 3100 | ||
3101 | if (mgsl_paranoia_check(info, tty->name, "mgsl_close")) | 3101 | if (mgsl_paranoia_check(info, tty->name, "mgsl_close")) |
3102 | return; | 3102 | return; |
@@ -3104,70 +3104,18 @@ static void mgsl_close(struct tty_struct *tty, struct file * filp) | |||
3104 | if (debug_level >= DEBUG_LEVEL_INFO) | 3104 | if (debug_level >= DEBUG_LEVEL_INFO) |
3105 | printk("%s(%d):mgsl_close(%s) entry, count=%d\n", | 3105 | printk("%s(%d):mgsl_close(%s) entry, count=%d\n", |
3106 | __FILE__,__LINE__, info->device_name, info->port.count); | 3106 | __FILE__,__LINE__, info->device_name, info->port.count); |
3107 | |||
3108 | if (!info->port.count) | ||
3109 | return; | ||
3110 | 3107 | ||
3111 | if (tty_hung_up_p(filp)) | 3108 | if (tty_port_close_start(&info->port, tty, filp) == 0) |
3112 | goto cleanup; | 3109 | goto cleanup; |
3113 | 3110 | ||
3114 | if ((tty->count == 1) && (info->port.count != 1)) { | ||
3115 | /* | ||
3116 | * tty->count is 1 and the tty structure will be freed. | ||
3117 | * info->port.count should be one in this case. | ||
3118 | * if it's not, correct it so that the port is shutdown. | ||
3119 | */ | ||
3120 | printk("mgsl_close: bad refcount; tty->count is 1, " | ||
3121 | "info->port.count is %d\n", info->port.count); | ||
3122 | info->port.count = 1; | ||
3123 | } | ||
3124 | |||
3125 | info->port.count--; | ||
3126 | |||
3127 | /* if at least one open remaining, leave hardware active */ | ||
3128 | if (info->port.count) | ||
3129 | goto cleanup; | ||
3130 | |||
3131 | info->port.flags |= ASYNC_CLOSING; | ||
3132 | |||
3133 | /* set tty->closing to notify line discipline to | ||
3134 | * only process XON/XOFF characters. Only the N_TTY | ||
3135 | * discipline appears to use this (ppp does not). | ||
3136 | */ | ||
3137 | tty->closing = 1; | ||
3138 | |||
3139 | /* wait for transmit data to clear all layers */ | ||
3140 | |||
3141 | if (info->port.closing_wait != ASYNC_CLOSING_WAIT_NONE) { | ||
3142 | if (debug_level >= DEBUG_LEVEL_INFO) | ||
3143 | printk("%s(%d):mgsl_close(%s) calling tty_wait_until_sent\n", | ||
3144 | __FILE__,__LINE__, info->device_name ); | ||
3145 | tty_wait_until_sent(tty, info->port.closing_wait); | ||
3146 | } | ||
3147 | |||
3148 | if (info->port.flags & ASYNC_INITIALIZED) | 3111 | if (info->port.flags & ASYNC_INITIALIZED) |
3149 | mgsl_wait_until_sent(tty, info->timeout); | 3112 | mgsl_wait_until_sent(tty, info->timeout); |
3150 | |||
3151 | mgsl_flush_buffer(tty); | 3113 | mgsl_flush_buffer(tty); |
3152 | |||
3153 | tty_ldisc_flush(tty); | 3114 | tty_ldisc_flush(tty); |
3154 | |||
3155 | shutdown(info); | 3115 | shutdown(info); |
3156 | 3116 | ||
3157 | tty->closing = 0; | 3117 | tty_port_close_end(&info->port, tty); |
3158 | info->port.tty = NULL; | 3118 | info->port.tty = NULL; |
3159 | |||
3160 | if (info->port.blocked_open) { | ||
3161 | if (info->port.close_delay) { | ||
3162 | msleep_interruptible(jiffies_to_msecs(info->port.close_delay)); | ||
3163 | } | ||
3164 | wake_up_interruptible(&info->port.open_wait); | ||
3165 | } | ||
3166 | |||
3167 | info->port.flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING); | ||
3168 | |||
3169 | wake_up_interruptible(&info->port.close_wait); | ||
3170 | |||
3171 | cleanup: | 3119 | cleanup: |
3172 | if (debug_level >= DEBUG_LEVEL_INFO) | 3120 | if (debug_level >= DEBUG_LEVEL_INFO) |
3173 | printk("%s(%d):mgsl_close(%s) exit, count=%d\n", __FILE__,__LINE__, | 3121 | printk("%s(%d):mgsl_close(%s) exit, count=%d\n", __FILE__,__LINE__, |
@@ -3188,7 +3136,7 @@ cleanup: | |||
3188 | */ | 3136 | */ |
3189 | static void mgsl_wait_until_sent(struct tty_struct *tty, int timeout) | 3137 | static void mgsl_wait_until_sent(struct tty_struct *tty, int timeout) |
3190 | { | 3138 | { |
3191 | struct mgsl_struct * info = (struct mgsl_struct *)tty->driver_data; | 3139 | struct mgsl_struct * info = tty->driver_data; |
3192 | unsigned long orig_jiffies, char_time; | 3140 | unsigned long orig_jiffies, char_time; |
3193 | 3141 | ||
3194 | if (!info ) | 3142 | if (!info ) |
@@ -3261,7 +3209,7 @@ exit: | |||
3261 | */ | 3209 | */ |
3262 | static void mgsl_hangup(struct tty_struct *tty) | 3210 | static void mgsl_hangup(struct tty_struct *tty) |
3263 | { | 3211 | { |
3264 | struct mgsl_struct * info = (struct mgsl_struct *)tty->driver_data; | 3212 | struct mgsl_struct * info = tty->driver_data; |
3265 | 3213 | ||
3266 | if (debug_level >= DEBUG_LEVEL_INFO) | 3214 | if (debug_level >= DEBUG_LEVEL_INFO) |
3267 | printk("%s(%d):mgsl_hangup(%s)\n", | 3215 | printk("%s(%d):mgsl_hangup(%s)\n", |
@@ -3281,6 +3229,35 @@ static void mgsl_hangup(struct tty_struct *tty) | |||
3281 | 3229 | ||
3282 | } /* end of mgsl_hangup() */ | 3230 | } /* end of mgsl_hangup() */ |
3283 | 3231 | ||
3232 | /* | ||
3233 | * carrier_raised() | ||
3234 | * | ||
3235 | * Return true if carrier is raised | ||
3236 | */ | ||
3237 | |||
3238 | static int carrier_raised(struct tty_port *port) | ||
3239 | { | ||
3240 | unsigned long flags; | ||
3241 | struct mgsl_struct *info = container_of(port, struct mgsl_struct, port); | ||
3242 | |||
3243 | spin_lock_irqsave(&info->irq_spinlock, flags); | ||
3244 | usc_get_serial_signals(info); | ||
3245 | spin_unlock_irqrestore(&info->irq_spinlock, flags); | ||
3246 | return (info->serial_signals & SerialSignal_DCD) ? 1 : 0; | ||
3247 | } | ||
3248 | |||
3249 | static void raise_dtr_rts(struct tty_port *port) | ||
3250 | { | ||
3251 | struct mgsl_struct *info = container_of(port, struct mgsl_struct, port); | ||
3252 | unsigned long flags; | ||
3253 | |||
3254 | spin_lock_irqsave(&info->irq_spinlock,flags); | ||
3255 | info->serial_signals |= SerialSignal_RTS + SerialSignal_DTR; | ||
3256 | usc_set_serial_signals(info); | ||
3257 | spin_unlock_irqrestore(&info->irq_spinlock,flags); | ||
3258 | } | ||
3259 | |||
3260 | |||
3284 | /* block_til_ready() | 3261 | /* block_til_ready() |
3285 | * | 3262 | * |
3286 | * Block the current process until the specified port | 3263 | * Block the current process until the specified port |
@@ -3302,6 +3279,8 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp, | |||
3302 | bool do_clocal = false; | 3279 | bool do_clocal = false; |
3303 | bool extra_count = false; | 3280 | bool extra_count = false; |
3304 | unsigned long flags; | 3281 | unsigned long flags; |
3282 | int dcd; | ||
3283 | struct tty_port *port = &info->port; | ||
3305 | 3284 | ||
3306 | if (debug_level >= DEBUG_LEVEL_INFO) | 3285 | if (debug_level >= DEBUG_LEVEL_INFO) |
3307 | printk("%s(%d):block_til_ready on %s\n", | 3286 | printk("%s(%d):block_til_ready on %s\n", |
@@ -3309,7 +3288,7 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp, | |||
3309 | 3288 | ||
3310 | if (filp->f_flags & O_NONBLOCK || tty->flags & (1 << TTY_IO_ERROR)){ | 3289 | if (filp->f_flags & O_NONBLOCK || tty->flags & (1 << TTY_IO_ERROR)){ |
3311 | /* nonblock mode is set or port is not enabled */ | 3290 | /* nonblock mode is set or port is not enabled */ |
3312 | info->port.flags |= ASYNC_NORMAL_ACTIVE; | 3291 | port->flags |= ASYNC_NORMAL_ACTIVE; |
3313 | return 0; | 3292 | return 0; |
3314 | } | 3293 | } |
3315 | 3294 | ||
@@ -3318,50 +3297,42 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp, | |||
3318 | 3297 | ||
3319 | /* Wait for carrier detect and the line to become | 3298 | /* Wait for carrier detect and the line to become |
3320 | * free (i.e., not in use by the callout). While we are in | 3299 | * free (i.e., not in use by the callout). While we are in |
3321 | * this loop, info->port.count is dropped by one, so that | 3300 | * this loop, port->count is dropped by one, so that |
3322 | * mgsl_close() knows when to free things. We restore it upon | 3301 | * mgsl_close() knows when to free things. We restore it upon |
3323 | * exit, either normal or abnormal. | 3302 | * exit, either normal or abnormal. |
3324 | */ | 3303 | */ |
3325 | 3304 | ||
3326 | retval = 0; | 3305 | retval = 0; |
3327 | add_wait_queue(&info->port.open_wait, &wait); | 3306 | add_wait_queue(&port->open_wait, &wait); |
3328 | 3307 | ||
3329 | if (debug_level >= DEBUG_LEVEL_INFO) | 3308 | if (debug_level >= DEBUG_LEVEL_INFO) |
3330 | printk("%s(%d):block_til_ready before block on %s count=%d\n", | 3309 | printk("%s(%d):block_til_ready before block on %s count=%d\n", |
3331 | __FILE__,__LINE__, tty->driver->name, info->port.count ); | 3310 | __FILE__,__LINE__, tty->driver->name, port->count ); |
3332 | 3311 | ||
3333 | spin_lock_irqsave(&info->irq_spinlock, flags); | 3312 | spin_lock_irqsave(&info->irq_spinlock, flags); |
3334 | if (!tty_hung_up_p(filp)) { | 3313 | if (!tty_hung_up_p(filp)) { |
3335 | extra_count = true; | 3314 | extra_count = true; |
3336 | info->port.count--; | 3315 | port->count--; |
3337 | } | 3316 | } |
3338 | spin_unlock_irqrestore(&info->irq_spinlock, flags); | 3317 | spin_unlock_irqrestore(&info->irq_spinlock, flags); |
3339 | info->port.blocked_open++; | 3318 | port->blocked_open++; |
3340 | 3319 | ||
3341 | while (1) { | 3320 | while (1) { |
3342 | if (tty->termios->c_cflag & CBAUD) { | 3321 | if (tty->termios->c_cflag & CBAUD) |
3343 | spin_lock_irqsave(&info->irq_spinlock,flags); | 3322 | tty_port_raise_dtr_rts(port); |
3344 | info->serial_signals |= SerialSignal_RTS + SerialSignal_DTR; | ||
3345 | usc_set_serial_signals(info); | ||
3346 | spin_unlock_irqrestore(&info->irq_spinlock,flags); | ||
3347 | } | ||
3348 | 3323 | ||
3349 | set_current_state(TASK_INTERRUPTIBLE); | 3324 | set_current_state(TASK_INTERRUPTIBLE); |
3350 | 3325 | ||
3351 | if (tty_hung_up_p(filp) || !(info->port.flags & ASYNC_INITIALIZED)){ | 3326 | if (tty_hung_up_p(filp) || !(port->flags & ASYNC_INITIALIZED)){ |
3352 | retval = (info->port.flags & ASYNC_HUP_NOTIFY) ? | 3327 | retval = (port->flags & ASYNC_HUP_NOTIFY) ? |
3353 | -EAGAIN : -ERESTARTSYS; | 3328 | -EAGAIN : -ERESTARTSYS; |
3354 | break; | 3329 | break; |
3355 | } | 3330 | } |
3356 | 3331 | ||
3357 | spin_lock_irqsave(&info->irq_spinlock,flags); | 3332 | dcd = tty_port_carrier_raised(&info->port); |
3358 | usc_get_serial_signals(info); | ||
3359 | spin_unlock_irqrestore(&info->irq_spinlock,flags); | ||
3360 | 3333 | ||
3361 | if (!(info->port.flags & ASYNC_CLOSING) && | 3334 | if (!(port->flags & ASYNC_CLOSING) && (do_clocal || dcd)) |
3362 | (do_clocal || (info->serial_signals & SerialSignal_DCD)) ) { | ||
3363 | break; | 3335 | break; |
3364 | } | ||
3365 | 3336 | ||
3366 | if (signal_pending(current)) { | 3337 | if (signal_pending(current)) { |
3367 | retval = -ERESTARTSYS; | 3338 | retval = -ERESTARTSYS; |
@@ -3370,24 +3341,25 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp, | |||
3370 | 3341 | ||
3371 | if (debug_level >= DEBUG_LEVEL_INFO) | 3342 | if (debug_level >= DEBUG_LEVEL_INFO) |
3372 | printk("%s(%d):block_til_ready blocking on %s count=%d\n", | 3343 | printk("%s(%d):block_til_ready blocking on %s count=%d\n", |
3373 | __FILE__,__LINE__, tty->driver->name, info->port.count ); | 3344 | __FILE__,__LINE__, tty->driver->name, port->count ); |
3374 | 3345 | ||
3375 | schedule(); | 3346 | schedule(); |
3376 | } | 3347 | } |
3377 | 3348 | ||
3378 | set_current_state(TASK_RUNNING); | 3349 | set_current_state(TASK_RUNNING); |
3379 | remove_wait_queue(&info->port.open_wait, &wait); | 3350 | remove_wait_queue(&port->open_wait, &wait); |
3380 | 3351 | ||
3352 | /* FIXME: Racy on hangup during close wait */ | ||
3381 | if (extra_count) | 3353 | if (extra_count) |
3382 | info->port.count++; | 3354 | port->count++; |
3383 | info->port.blocked_open--; | 3355 | port->blocked_open--; |
3384 | 3356 | ||
3385 | if (debug_level >= DEBUG_LEVEL_INFO) | 3357 | if (debug_level >= DEBUG_LEVEL_INFO) |
3386 | printk("%s(%d):block_til_ready after blocking on %s count=%d\n", | 3358 | printk("%s(%d):block_til_ready after blocking on %s count=%d\n", |
3387 | __FILE__,__LINE__, tty->driver->name, info->port.count ); | 3359 | __FILE__,__LINE__, tty->driver->name, port->count ); |
3388 | 3360 | ||
3389 | if (!retval) | 3361 | if (!retval) |
3390 | info->port.flags |= ASYNC_NORMAL_ACTIVE; | 3362 | port->flags |= ASYNC_NORMAL_ACTIVE; |
3391 | 3363 | ||
3392 | return retval; | 3364 | return retval; |
3393 | 3365 | ||
@@ -4304,6 +4276,12 @@ static void mgsl_add_device( struct mgsl_struct *info ) | |||
4304 | 4276 | ||
4305 | } /* end of mgsl_add_device() */ | 4277 | } /* end of mgsl_add_device() */ |
4306 | 4278 | ||
4279 | static const struct tty_port_operations mgsl_port_ops = { | ||
4280 | .carrier_raised = carrier_raised, | ||
4281 | .raise_dtr_rts = raise_dtr_rts, | ||
4282 | }; | ||
4283 | |||
4284 | |||
4307 | /* mgsl_allocate_device() | 4285 | /* mgsl_allocate_device() |
4308 | * | 4286 | * |
4309 | * Allocate and initialize a device instance structure | 4287 | * Allocate and initialize a device instance structure |
@@ -4322,6 +4300,7 @@ static struct mgsl_struct* mgsl_allocate_device(void) | |||
4322 | printk("Error can't allocate device instance data\n"); | 4300 | printk("Error can't allocate device instance data\n"); |
4323 | } else { | 4301 | } else { |
4324 | tty_port_init(&info->port); | 4302 | tty_port_init(&info->port); |
4303 | info->port.ops = &mgsl_port_ops; | ||
4325 | info->magic = MGSL_MAGIC; | 4304 | info->magic = MGSL_MAGIC; |
4326 | INIT_WORK(&info->task, mgsl_bh_handler); | 4305 | INIT_WORK(&info->task, mgsl_bh_handler); |
4327 | info->max_frame_size = 4096; | 4306 | info->max_frame_size = 4096; |