Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

crisv10: use counts from tty_port

The same as flags, convert to using open/close counts from tty_port.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Jiri Slaby and committed by
Greg Kroah-Hartman
b12d8dc2 4aeaeb0c

+23 -27
+23 -25
drivers/tty/serial/crisv10.c
··· 3424 3424 goto check_and_exit; 3425 3425 } 3426 3426 3427 - if (info->count > 1) 3427 + if (info->port.count > 1) 3428 3428 return -EBUSY; 3429 3429 3430 3430 /* ··· 3760 3760 printk("[%d] rs_close ttyS%d, count = %d\n", current->pid, 3761 3761 info->line, info->count); 3762 3762 #endif 3763 - if ((tty->count == 1) && (info->count != 1)) { 3763 + if ((tty->count == 1) && (info->port.count != 1)) { 3764 3764 /* 3765 3765 * Uh, oh. tty->count is 1, which means that the tty 3766 3766 * structure will be freed. Info->count should always ··· 3770 3770 */ 3771 3771 printk(KERN_ERR 3772 3772 "rs_close: bad serial port count; tty->count is 1, " 3773 - "info->count is %d\n", info->count); 3774 - info->count = 1; 3773 + "info->count is %d\n", info->port.count); 3774 + info->port.count = 1; 3775 3775 } 3776 - if (--info->count < 0) { 3776 + if (--info->port.count < 0) { 3777 3777 printk(KERN_ERR "rs_close: bad serial port count for ttyS%d: %d\n", 3778 - info->line, info->count); 3779 - info->count = 0; 3778 + info->line, info->port.count); 3779 + info->port.count = 0; 3780 3780 } 3781 - if (info->count) { 3781 + if (info->port.count) { 3782 3782 local_irq_restore(flags); 3783 3783 return; 3784 3784 } ··· 3824 3824 tty->closing = 0; 3825 3825 info->event = 0; 3826 3826 info->port.tty = NULL; 3827 - if (info->blocked_open) { 3827 + if (info->port.blocked_open) { 3828 3828 if (info->port.close_delay) 3829 3829 schedule_timeout_interruptible(info->port.close_delay); 3830 3830 wake_up_interruptible(&info->port.open_wait); ··· 3923 3923 rs_flush_buffer(tty); 3924 3924 shutdown(info); 3925 3925 info->event = 0; 3926 - info->count = 0; 3926 + info->port.count = 0; 3927 3927 info->port.flags &= ~ASYNC_NORMAL_ACTIVE; 3928 3928 info->port.tty = NULL; 3929 3929 wake_up_interruptible(&info->port.open_wait); ··· 3978 3978 /* 3979 3979 * Block waiting for the carrier detect and the line to become 3980 3980 * free (i.e., not in use by the callout). While we are in 3981 - * this loop, info->count is dropped by one, so that 3981 + * this loop, info->port.count is dropped by one, so that 3982 3982 * rs_close() knows when to free things. We restore it upon 3983 3983 * exit, either normal or abnormal. 3984 3984 */ ··· 3986 3986 add_wait_queue(&info->port.open_wait, &wait); 3987 3987 #ifdef SERIAL_DEBUG_OPEN 3988 3988 printk("block_til_ready before block: ttyS%d, count = %d\n", 3989 - info->line, info->count); 3989 + info->line, info->port.count); 3990 3990 #endif 3991 3991 local_irq_save(flags); 3992 3992 if (!tty_hung_up_p(filp)) { 3993 3993 extra_count++; 3994 - info->count--; 3994 + info->port.count--; 3995 3995 } 3996 3996 local_irq_restore(flags); 3997 - info->blocked_open++; 3997 + info->port.blocked_open++; 3998 3998 while (1) { 3999 3999 local_irq_save(flags); 4000 4000 /* assert RTS and DTR */ ··· 4023 4023 } 4024 4024 #ifdef SERIAL_DEBUG_OPEN 4025 4025 printk("block_til_ready blocking: ttyS%d, count = %d\n", 4026 - info->line, info->count); 4026 + info->line, info->port.count); 4027 4027 #endif 4028 4028 tty_unlock(tty); 4029 4029 schedule(); ··· 4032 4032 set_current_state(TASK_RUNNING); 4033 4033 remove_wait_queue(&info->port.open_wait, &wait); 4034 4034 if (extra_count) 4035 - info->count++; 4036 - info->blocked_open--; 4035 + info->port.count++; 4036 + info->port.blocked_open--; 4037 4037 #ifdef SERIAL_DEBUG_OPEN 4038 4038 printk("block_til_ready after blocking: ttyS%d, count = %d\n", 4039 - info->line, info->count); 4039 + info->line, info->port.count); 4040 4040 #endif 4041 4041 if (retval) 4042 4042 return retval; ··· 4074 4074 4075 4075 #ifdef SERIAL_DEBUG_OPEN 4076 4076 printk("[%d] rs_open %s, count = %d\n", current->pid, tty->name, 4077 - info->count); 4077 + info->port.count); 4078 4078 #endif 4079 4079 4080 - info->count++; 4080 + info->port.count++; 4081 4081 tty->driver_data = info; 4082 4082 info->port.tty = tty; 4083 4083 ··· 4101 4101 /* 4102 4102 * If DMA is enabled try to allocate the irq's. 4103 4103 */ 4104 - if (info->count == 1) { 4104 + if (info->port.count == 1) { 4105 4105 allocated_resources = 1; 4106 4106 if (info->dma_in_enabled) { 4107 4107 if (request_irq(info->dma_in_irq_nbr, ··· 4174 4174 if (allocated_resources) 4175 4175 deinit_port(info); 4176 4176 4177 - /* FIXME Decrease count info->count here too? */ 4177 + /* FIXME Decrease count info->port.count here too? */ 4178 4178 return retval; 4179 4179 } 4180 4180 ··· 4191 4191 return retval; 4192 4192 } 4193 4193 4194 - if ((info->count == 1) && (info->port.flags & ASYNC_SPLIT_TERMIOS)) { 4194 + if ((info->port.count == 1) && (info->port.flags & ASYNC_SPLIT_TERMIOS)) { 4195 4195 tty->termios = info->normal_termios; 4196 4196 change_speed(info); 4197 4197 } ··· 4442 4442 info->custom_divisor = 0; 4443 4443 info->x_char = 0; 4444 4444 info->event = 0; 4445 - info->count = 0; 4446 - info->blocked_open = 0; 4447 4445 info->normal_termios = driver->init_termios; 4448 4446 info->xmit.buf = NULL; 4449 4447 info->xmit.tail = info->xmit.head = 0;
-2
drivers/tty/serial/crisv10.h
··· 90 90 unsigned long event; 91 91 int line; 92 92 int type; /* PORT_ETRAX */ 93 - int count; /* # of fd on device */ 94 - int blocked_open; /* # of blocked opens */ 95 93 struct circ_buf xmit; 96 94 struct etrax_recv_buffer *first_recv_buffer; 97 95 struct etrax_recv_buffer *last_recv_buffer;