diff options
Diffstat (limited to 'drivers/tty/serial/crisv10.c')
-rw-r--r-- | drivers/tty/serial/crisv10.c | 36 |
1 files changed, 6 insertions, 30 deletions
diff --git a/drivers/tty/serial/crisv10.c b/drivers/tty/serial/crisv10.c index 5b07c0c3a10c..7264d4d26717 100644 --- a/drivers/tty/serial/crisv10.c +++ b/drivers/tty/serial/crisv10.c | |||
@@ -952,19 +952,6 @@ static const struct control_pins e100_modem_pins[NR_PORTS] = | |||
952 | /* Input */ | 952 | /* Input */ |
953 | #define E100_DSR_GET(info) ((*e100_modem_pins[(info)->line].dsr_port) & e100_modem_pins[(info)->line].dsr_mask) | 953 | #define E100_DSR_GET(info) ((*e100_modem_pins[(info)->line].dsr_port) & e100_modem_pins[(info)->line].dsr_mask) |
954 | 954 | ||
955 | |||
956 | /* | ||
957 | * tmp_buf is used as a temporary buffer by serial_write. We need to | ||
958 | * lock it in case the memcpy_fromfs blocks while swapping in a page, | ||
959 | * and some other program tries to do a serial write at the same time. | ||
960 | * Since the lock will only come under contention when the system is | ||
961 | * swapping and available memory is low, it makes sense to share one | ||
962 | * buffer across all the serial ports, since it significantly saves | ||
963 | * memory if large numbers of serial ports are open. | ||
964 | */ | ||
965 | static unsigned char *tmp_buf; | ||
966 | static DEFINE_MUTEX(tmp_buf_mutex); | ||
967 | |||
968 | /* Calculate the chartime depending on baudrate, numbor of bits etc. */ | 955 | /* Calculate the chartime depending on baudrate, numbor of bits etc. */ |
969 | static void update_char_time(struct e100_serial * info) | 956 | static void update_char_time(struct e100_serial * info) |
970 | { | 957 | { |
@@ -3150,7 +3137,7 @@ static int rs_raw_write(struct tty_struct *tty, | |||
3150 | 3137 | ||
3151 | /* first some sanity checks */ | 3138 | /* first some sanity checks */ |
3152 | 3139 | ||
3153 | if (!tty || !info->xmit.buf || !tmp_buf) | 3140 | if (!tty || !info->xmit.buf) |
3154 | return 0; | 3141 | return 0; |
3155 | 3142 | ||
3156 | #ifdef SERIAL_DEBUG_DATA | 3143 | #ifdef SERIAL_DEBUG_DATA |
@@ -3989,7 +3976,7 @@ block_til_ready(struct tty_struct *tty, struct file * filp, | |||
3989 | */ | 3976 | */ |
3990 | if (tty_hung_up_p(filp) || | 3977 | if (tty_hung_up_p(filp) || |
3991 | (info->flags & ASYNC_CLOSING)) { | 3978 | (info->flags & ASYNC_CLOSING)) { |
3992 | wait_event_interruptible_tty(info->close_wait, | 3979 | wait_event_interruptible_tty(tty, info->close_wait, |
3993 | !(info->flags & ASYNC_CLOSING)); | 3980 | !(info->flags & ASYNC_CLOSING)); |
3994 | #ifdef SERIAL_DO_RESTART | 3981 | #ifdef SERIAL_DO_RESTART |
3995 | if (info->flags & ASYNC_HUP_NOTIFY) | 3982 | if (info->flags & ASYNC_HUP_NOTIFY) |
@@ -4065,9 +4052,9 @@ block_til_ready(struct tty_struct *tty, struct file * filp, | |||
4065 | printk("block_til_ready blocking: ttyS%d, count = %d\n", | 4052 | printk("block_til_ready blocking: ttyS%d, count = %d\n", |
4066 | info->line, info->count); | 4053 | info->line, info->count); |
4067 | #endif | 4054 | #endif |
4068 | tty_unlock(); | 4055 | tty_unlock(tty); |
4069 | schedule(); | 4056 | schedule(); |
4070 | tty_lock(); | 4057 | tty_lock(tty); |
4071 | } | 4058 | } |
4072 | set_current_state(TASK_RUNNING); | 4059 | set_current_state(TASK_RUNNING); |
4073 | remove_wait_queue(&info->open_wait, &wait); | 4060 | remove_wait_queue(&info->open_wait, &wait); |
@@ -4106,7 +4093,6 @@ rs_open(struct tty_struct *tty, struct file * filp) | |||
4106 | { | 4093 | { |
4107 | struct e100_serial *info; | 4094 | struct e100_serial *info; |
4108 | int retval; | 4095 | int retval; |
4109 | unsigned long page; | ||
4110 | int allocated_resources = 0; | 4096 | int allocated_resources = 0; |
4111 | 4097 | ||
4112 | info = rs_table + tty->index; | 4098 | info = rs_table + tty->index; |
@@ -4124,23 +4110,12 @@ rs_open(struct tty_struct *tty, struct file * filp) | |||
4124 | 4110 | ||
4125 | tty->low_latency = !!(info->flags & ASYNC_LOW_LATENCY); | 4111 | tty->low_latency = !!(info->flags & ASYNC_LOW_LATENCY); |
4126 | 4112 | ||
4127 | if (!tmp_buf) { | ||
4128 | page = get_zeroed_page(GFP_KERNEL); | ||
4129 | if (!page) { | ||
4130 | return -ENOMEM; | ||
4131 | } | ||
4132 | if (tmp_buf) | ||
4133 | free_page(page); | ||
4134 | else | ||
4135 | tmp_buf = (unsigned char *) page; | ||
4136 | } | ||
4137 | |||
4138 | /* | 4113 | /* |
4139 | * If the port is in the middle of closing, bail out now | 4114 | * If the port is in the middle of closing, bail out now |
4140 | */ | 4115 | */ |
4141 | if (tty_hung_up_p(filp) || | 4116 | if (tty_hung_up_p(filp) || |
4142 | (info->flags & ASYNC_CLOSING)) { | 4117 | (info->flags & ASYNC_CLOSING)) { |
4143 | wait_event_interruptible_tty(info->close_wait, | 4118 | wait_event_interruptible_tty(tty, info->close_wait, |
4144 | !(info->flags & ASYNC_CLOSING)); | 4119 | !(info->flags & ASYNC_CLOSING)); |
4145 | #ifdef SERIAL_DO_RESTART | 4120 | #ifdef SERIAL_DO_RESTART |
4146 | return ((info->flags & ASYNC_HUP_NOTIFY) ? | 4121 | return ((info->flags & ASYNC_HUP_NOTIFY) ? |
@@ -4487,6 +4462,7 @@ static int __init rs_init(void) | |||
4487 | info->enabled = 0; | 4462 | info->enabled = 0; |
4488 | } | 4463 | } |
4489 | } | 4464 | } |
4465 | tty_port_init(&info->port); | ||
4490 | info->uses_dma_in = 0; | 4466 | info->uses_dma_in = 0; |
4491 | info->uses_dma_out = 0; | 4467 | info->uses_dma_out = 0; |
4492 | info->line = i; | 4468 | info->line = i; |