diff options
author | Tejun Heo <tj@kernel.org> | 2009-07-03 18:13:18 -0400 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2009-07-03 18:13:18 -0400 |
commit | c43768cbb7655ea5ff782ae250f6e2ef4297cf98 (patch) | |
tree | 3982e41dde3eecaa3739a5d1a8ed18d04bd74f01 /drivers/char | |
parent | 1a8dd307cc0a2119be4e578c517795464e6dabba (diff) | |
parent | 746a99a5af60ee676afa2ba469ccd1373493c7e7 (diff) |
Merge branch 'master' into for-next
Pull linus#master to merge PER_CPU_DEF_ATTRIBUTES and alpha build fix
changes. As alpha in percpu tree uses 'weak' attribute instead of
inline assembly, there's no need for __used attribute.
Conflicts:
arch/alpha/include/asm/percpu.h
arch/mn10300/kernel/vmlinux.lds.S
include/linux/percpu-defs.h
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/bfin_jtag_comm.c | 30 | ||||
-rw-r--r-- | drivers/char/bsr.c | 42 | ||||
-rw-r--r-- | drivers/char/moxa.c | 7 | ||||
-rw-r--r-- | drivers/char/mxser.c | 2 | ||||
-rw-r--r-- | drivers/char/n_hdlc.c | 46 | ||||
-rw-r--r-- | drivers/char/n_r3964.c | 26 | ||||
-rw-r--r-- | drivers/char/nozomi.c | 2 | ||||
-rw-r--r-- | drivers/char/pcmcia/cm4000_cs.c | 3 | ||||
-rw-r--r-- | drivers/char/synclink_gt.c | 72 | ||||
-rw-r--r-- | drivers/char/tty_ldisc.c | 15 | ||||
-rw-r--r-- | drivers/char/tty_port.c | 2 | ||||
-rw-r--r-- | drivers/char/vt_ioctl.c | 3 |
12 files changed, 142 insertions, 108 deletions
diff --git a/drivers/char/bfin_jtag_comm.c b/drivers/char/bfin_jtag_comm.c index 44c113d56045..1d7c34c73b20 100644 --- a/drivers/char/bfin_jtag_comm.c +++ b/drivers/char/bfin_jtag_comm.c | |||
@@ -8,6 +8,10 @@ | |||
8 | * Licensed under the GPL-2 or later. | 8 | * Licensed under the GPL-2 or later. |
9 | */ | 9 | */ |
10 | 10 | ||
11 | #define DRV_NAME "bfin-jtag-comm" | ||
12 | #define DEV_NAME "ttyBFJC" | ||
13 | #define pr_fmt(fmt) DRV_NAME ": " fmt | ||
14 | |||
11 | #include <linux/circ_buf.h> | 15 | #include <linux/circ_buf.h> |
12 | #include <linux/console.h> | 16 | #include <linux/console.h> |
13 | #include <linux/delay.h> | 17 | #include <linux/delay.h> |
@@ -22,18 +26,14 @@ | |||
22 | #include <linux/tty_flip.h> | 26 | #include <linux/tty_flip.h> |
23 | #include <asm/atomic.h> | 27 | #include <asm/atomic.h> |
24 | 28 | ||
29 | #define pr_init(fmt, args...) ({ static const __initconst char __fmt[] = fmt; printk(__fmt, ## args); }) | ||
30 | |||
25 | /* See the Debug/Emulation chapter in the HRM */ | 31 | /* See the Debug/Emulation chapter in the HRM */ |
26 | #define EMUDOF 0x00000001 /* EMUDAT_OUT full & valid */ | 32 | #define EMUDOF 0x00000001 /* EMUDAT_OUT full & valid */ |
27 | #define EMUDIF 0x00000002 /* EMUDAT_IN full & valid */ | 33 | #define EMUDIF 0x00000002 /* EMUDAT_IN full & valid */ |
28 | #define EMUDOOVF 0x00000004 /* EMUDAT_OUT overflow */ | 34 | #define EMUDOOVF 0x00000004 /* EMUDAT_OUT overflow */ |
29 | #define EMUDIOVF 0x00000008 /* EMUDAT_IN overflow */ | 35 | #define EMUDIOVF 0x00000008 /* EMUDAT_IN overflow */ |
30 | 36 | ||
31 | #define DRV_NAME "bfin-jtag-comm" | ||
32 | #define DEV_NAME "ttyBFJC" | ||
33 | |||
34 | #define pr_init(fmt, args...) ({ static const __initdata char __fmt[] = fmt; printk(__fmt, ## args); }) | ||
35 | #define debug(fmt, args...) pr_debug(DRV_NAME ": " fmt, ## args) | ||
36 | |||
37 | static inline uint32_t bfin_write_emudat(uint32_t emudat) | 37 | static inline uint32_t bfin_write_emudat(uint32_t emudat) |
38 | { | 38 | { |
39 | __asm__ __volatile__("emudat = %0;" : : "d"(emudat)); | 39 | __asm__ __volatile__("emudat = %0;" : : "d"(emudat)); |
@@ -74,7 +74,7 @@ bfin_jc_emudat_manager(void *arg) | |||
74 | while (!kthread_should_stop()) { | 74 | while (!kthread_should_stop()) { |
75 | /* no one left to give data to, so sleep */ | 75 | /* no one left to give data to, so sleep */ |
76 | if (bfin_jc_tty == NULL && circ_empty(&bfin_jc_write_buf)) { | 76 | if (bfin_jc_tty == NULL && circ_empty(&bfin_jc_write_buf)) { |
77 | debug("waiting for readers\n"); | 77 | pr_debug("waiting for readers\n"); |
78 | __set_current_state(TASK_UNINTERRUPTIBLE); | 78 | __set_current_state(TASK_UNINTERRUPTIBLE); |
79 | schedule(); | 79 | schedule(); |
80 | __set_current_state(TASK_RUNNING); | 80 | __set_current_state(TASK_RUNNING); |
@@ -82,7 +82,7 @@ bfin_jc_emudat_manager(void *arg) | |||
82 | 82 | ||
83 | /* no data available, so just chill */ | 83 | /* no data available, so just chill */ |
84 | if (!(bfin_read_DBGSTAT() & EMUDIF) && circ_empty(&bfin_jc_write_buf)) { | 84 | if (!(bfin_read_DBGSTAT() & EMUDIF) && circ_empty(&bfin_jc_write_buf)) { |
85 | debug("waiting for data (in_len = %i) (circ: %i %i)\n", | 85 | pr_debug("waiting for data (in_len = %i) (circ: %i %i)\n", |
86 | inbound_len, bfin_jc_write_buf.tail, bfin_jc_write_buf.head); | 86 | inbound_len, bfin_jc_write_buf.tail, bfin_jc_write_buf.head); |
87 | if (inbound_len) | 87 | if (inbound_len) |
88 | schedule(); | 88 | schedule(); |
@@ -99,11 +99,11 @@ bfin_jc_emudat_manager(void *arg) | |||
99 | if (tty != NULL) { | 99 | if (tty != NULL) { |
100 | uint32_t emudat = bfin_read_emudat(); | 100 | uint32_t emudat = bfin_read_emudat(); |
101 | if (inbound_len == 0) { | 101 | if (inbound_len == 0) { |
102 | debug("incoming length: 0x%08x\n", emudat); | 102 | pr_debug("incoming length: 0x%08x\n", emudat); |
103 | inbound_len = emudat; | 103 | inbound_len = emudat; |
104 | } else { | 104 | } else { |
105 | size_t num_chars = (4 <= inbound_len ? 4 : inbound_len); | 105 | size_t num_chars = (4 <= inbound_len ? 4 : inbound_len); |
106 | debug(" incoming data: 0x%08x (pushing %zu)\n", emudat, num_chars); | 106 | pr_debug(" incoming data: 0x%08x (pushing %zu)\n", emudat, num_chars); |
107 | inbound_len -= num_chars; | 107 | inbound_len -= num_chars; |
108 | tty_insert_flip_string(tty, (unsigned char *)&emudat, num_chars); | 108 | tty_insert_flip_string(tty, (unsigned char *)&emudat, num_chars); |
109 | tty_flip_buffer_push(tty); | 109 | tty_flip_buffer_push(tty); |
@@ -117,7 +117,7 @@ bfin_jc_emudat_manager(void *arg) | |||
117 | if (outbound_len == 0) { | 117 | if (outbound_len == 0) { |
118 | outbound_len = circ_cnt(&bfin_jc_write_buf); | 118 | outbound_len = circ_cnt(&bfin_jc_write_buf); |
119 | bfin_write_emudat(outbound_len); | 119 | bfin_write_emudat(outbound_len); |
120 | debug("outgoing length: 0x%08x\n", outbound_len); | 120 | pr_debug("outgoing length: 0x%08x\n", outbound_len); |
121 | } else { | 121 | } else { |
122 | struct tty_struct *tty; | 122 | struct tty_struct *tty; |
123 | int tail = bfin_jc_write_buf.tail; | 123 | int tail = bfin_jc_write_buf.tail; |
@@ -136,7 +136,7 @@ bfin_jc_emudat_manager(void *arg) | |||
136 | if (tty) | 136 | if (tty) |
137 | tty_wakeup(tty); | 137 | tty_wakeup(tty); |
138 | mutex_unlock(&bfin_jc_tty_mutex); | 138 | mutex_unlock(&bfin_jc_tty_mutex); |
139 | debug(" outgoing data: 0x%08x (pushing %zu)\n", emudat, ate); | 139 | pr_debug(" outgoing data: 0x%08x (pushing %zu)\n", emudat, ate); |
140 | } | 140 | } |
141 | } | 141 | } |
142 | } | 142 | } |
@@ -149,7 +149,7 @@ static int | |||
149 | bfin_jc_open(struct tty_struct *tty, struct file *filp) | 149 | bfin_jc_open(struct tty_struct *tty, struct file *filp) |
150 | { | 150 | { |
151 | mutex_lock(&bfin_jc_tty_mutex); | 151 | mutex_lock(&bfin_jc_tty_mutex); |
152 | debug("open %lu\n", bfin_jc_count); | 152 | pr_debug("open %lu\n", bfin_jc_count); |
153 | ++bfin_jc_count; | 153 | ++bfin_jc_count; |
154 | bfin_jc_tty = tty; | 154 | bfin_jc_tty = tty; |
155 | wake_up_process(bfin_jc_kthread); | 155 | wake_up_process(bfin_jc_kthread); |
@@ -161,7 +161,7 @@ static void | |||
161 | bfin_jc_close(struct tty_struct *tty, struct file *filp) | 161 | bfin_jc_close(struct tty_struct *tty, struct file *filp) |
162 | { | 162 | { |
163 | mutex_lock(&bfin_jc_tty_mutex); | 163 | mutex_lock(&bfin_jc_tty_mutex); |
164 | debug("close %lu\n", bfin_jc_count); | 164 | pr_debug("close %lu\n", bfin_jc_count); |
165 | if (--bfin_jc_count == 0) | 165 | if (--bfin_jc_count == 0) |
166 | bfin_jc_tty = NULL; | 166 | bfin_jc_tty = NULL; |
167 | wake_up_process(bfin_jc_kthread); | 167 | wake_up_process(bfin_jc_kthread); |
@@ -174,7 +174,7 @@ bfin_jc_circ_write(const unsigned char *buf, int count) | |||
174 | { | 174 | { |
175 | int i; | 175 | int i; |
176 | count = min(count, circ_free(&bfin_jc_write_buf)); | 176 | count = min(count, circ_free(&bfin_jc_write_buf)); |
177 | debug("going to write chunk of %i bytes\n", count); | 177 | pr_debug("going to write chunk of %i bytes\n", count); |
178 | for (i = 0; i < count; ++i) | 178 | for (i = 0; i < count; ++i) |
179 | circ_byte(&bfin_jc_write_buf, bfin_jc_write_buf.head + i) = buf[i]; | 179 | circ_byte(&bfin_jc_write_buf, bfin_jc_write_buf.head + i) = buf[i]; |
180 | bfin_jc_write_buf.head += i; | 180 | bfin_jc_write_buf.head += i; |
diff --git a/drivers/char/bsr.c b/drivers/char/bsr.c index 140ea10ecb88..c02db01f736e 100644 --- a/drivers/char/bsr.c +++ b/drivers/char/bsr.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/cdev.h> | 27 | #include <linux/cdev.h> |
28 | #include <linux/list.h> | 28 | #include <linux/list.h> |
29 | #include <linux/mm.h> | 29 | #include <linux/mm.h> |
30 | #include <asm/pgtable.h> | ||
30 | #include <asm/io.h> | 31 | #include <asm/io.h> |
31 | 32 | ||
32 | /* | 33 | /* |
@@ -75,12 +76,13 @@ static struct class *bsr_class; | |||
75 | static int bsr_major; | 76 | static int bsr_major; |
76 | 77 | ||
77 | enum { | 78 | enum { |
78 | BSR_8 = 0, | 79 | BSR_8 = 0, |
79 | BSR_16 = 1, | 80 | BSR_16 = 1, |
80 | BSR_64 = 2, | 81 | BSR_64 = 2, |
81 | BSR_128 = 3, | 82 | BSR_128 = 3, |
82 | BSR_UNKNOWN = 4, | 83 | BSR_4096 = 4, |
83 | BSR_MAX = 5, | 84 | BSR_UNKNOWN = 5, |
85 | BSR_MAX = 6, | ||
84 | }; | 86 | }; |
85 | 87 | ||
86 | static unsigned bsr_types[BSR_MAX]; | 88 | static unsigned bsr_types[BSR_MAX]; |
@@ -117,15 +119,22 @@ static int bsr_mmap(struct file *filp, struct vm_area_struct *vma) | |||
117 | { | 119 | { |
118 | unsigned long size = vma->vm_end - vma->vm_start; | 120 | unsigned long size = vma->vm_end - vma->vm_start; |
119 | struct bsr_dev *dev = filp->private_data; | 121 | struct bsr_dev *dev = filp->private_data; |
122 | int ret; | ||
120 | 123 | ||
121 | if (size > dev->bsr_len || (size & (PAGE_SIZE-1))) | ||
122 | return -EINVAL; | ||
123 | |||
124 | vma->vm_flags |= (VM_IO | VM_DONTEXPAND); | ||
125 | vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); | 124 | vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); |
126 | 125 | ||
127 | if (io_remap_pfn_range(vma, vma->vm_start, dev->bsr_addr >> PAGE_SHIFT, | 126 | /* check for the case of a small BSR device and map one 4k page for it*/ |
128 | size, vma->vm_page_prot)) | 127 | if (dev->bsr_len < PAGE_SIZE && size == PAGE_SIZE) |
128 | ret = remap_4k_pfn(vma, vma->vm_start, dev->bsr_addr >> 12, | ||
129 | vma->vm_page_prot); | ||
130 | else if (size <= dev->bsr_len) | ||
131 | ret = io_remap_pfn_range(vma, vma->vm_start, | ||
132 | dev->bsr_addr >> PAGE_SHIFT, | ||
133 | size, vma->vm_page_prot); | ||
134 | else | ||
135 | return -EINVAL; | ||
136 | |||
137 | if (ret) | ||
129 | return -EAGAIN; | 138 | return -EAGAIN; |
130 | 139 | ||
131 | return 0; | 140 | return 0; |
@@ -205,6 +214,11 @@ static int bsr_add_node(struct device_node *bn) | |||
205 | cur->bsr_stride = bsr_stride[i]; | 214 | cur->bsr_stride = bsr_stride[i]; |
206 | cur->bsr_dev = MKDEV(bsr_major, i + total_bsr_devs); | 215 | cur->bsr_dev = MKDEV(bsr_major, i + total_bsr_devs); |
207 | 216 | ||
217 | /* if we have a bsr_len of > 4k and less then PAGE_SIZE (64k pages) */ | ||
218 | /* we can only map 4k of it, so only advertise the 4k in sysfs */ | ||
219 | if (cur->bsr_len > 4096 && cur->bsr_len < PAGE_SIZE) | ||
220 | cur->bsr_len = 4096; | ||
221 | |||
208 | switch(cur->bsr_bytes) { | 222 | switch(cur->bsr_bytes) { |
209 | case 8: | 223 | case 8: |
210 | cur->bsr_type = BSR_8; | 224 | cur->bsr_type = BSR_8; |
@@ -218,9 +232,11 @@ static int bsr_add_node(struct device_node *bn) | |||
218 | case 128: | 232 | case 128: |
219 | cur->bsr_type = BSR_128; | 233 | cur->bsr_type = BSR_128; |
220 | break; | 234 | break; |
235 | case 4096: | ||
236 | cur->bsr_type = BSR_4096; | ||
237 | break; | ||
221 | default: | 238 | default: |
222 | cur->bsr_type = BSR_UNKNOWN; | 239 | cur->bsr_type = BSR_UNKNOWN; |
223 | printk(KERN_INFO "unknown BSR size %d\n",cur->bsr_bytes); | ||
224 | } | 240 | } |
225 | 241 | ||
226 | cur->bsr_num = bsr_types[cur->bsr_type]; | 242 | cur->bsr_num = bsr_types[cur->bsr_type]; |
diff --git a/drivers/char/moxa.c b/drivers/char/moxa.c index 6799588b0099..65b6ff2442c6 100644 --- a/drivers/char/moxa.c +++ b/drivers/char/moxa.c | |||
@@ -1189,11 +1189,6 @@ static int moxa_open(struct tty_struct *tty, struct file *filp) | |||
1189 | return -ENODEV; | 1189 | return -ENODEV; |
1190 | } | 1190 | } |
1191 | 1191 | ||
1192 | if (port % MAX_PORTS_PER_BOARD >= brd->numPorts) { | ||
1193 | retval = -ENODEV; | ||
1194 | goto out_unlock; | ||
1195 | } | ||
1196 | |||
1197 | ch = &brd->ports[port % MAX_PORTS_PER_BOARD]; | 1192 | ch = &brd->ports[port % MAX_PORTS_PER_BOARD]; |
1198 | ch->port.count++; | 1193 | ch->port.count++; |
1199 | tty->driver_data = ch; | 1194 | tty->driver_data = ch; |
@@ -1218,8 +1213,8 @@ static int moxa_open(struct tty_struct *tty, struct file *filp) | |||
1218 | moxa_close_port(tty); | 1213 | moxa_close_port(tty); |
1219 | } else | 1214 | } else |
1220 | ch->port.flags |= ASYNC_NORMAL_ACTIVE; | 1215 | ch->port.flags |= ASYNC_NORMAL_ACTIVE; |
1221 | out_unlock: | ||
1222 | mutex_unlock(&moxa_openlock); | 1216 | mutex_unlock(&moxa_openlock); |
1217 | |||
1223 | return retval; | 1218 | return retval; |
1224 | } | 1219 | } |
1225 | 1220 | ||
diff --git a/drivers/char/mxser.c b/drivers/char/mxser.c index 9533f43a30bb..52d953eb30c3 100644 --- a/drivers/char/mxser.c +++ b/drivers/char/mxser.c | |||
@@ -1048,8 +1048,6 @@ static int mxser_open(struct tty_struct *tty, struct file *filp) | |||
1048 | if (retval) | 1048 | if (retval) |
1049 | return retval; | 1049 | return retval; |
1050 | 1050 | ||
1051 | /* unmark here for very high baud rate (ex. 921600 bps) used */ | ||
1052 | tty->low_latency = 1; | ||
1053 | return 0; | 1051 | return 0; |
1054 | } | 1052 | } |
1055 | 1053 | ||
diff --git a/drivers/char/n_hdlc.c b/drivers/char/n_hdlc.c index 461ece591a5b..1c43c8cdee25 100644 --- a/drivers/char/n_hdlc.c +++ b/drivers/char/n_hdlc.c | |||
@@ -10,7 +10,6 @@ | |||
10 | * Paul Mackerras <Paul.Mackerras@cs.anu.edu.au> | 10 | * Paul Mackerras <Paul.Mackerras@cs.anu.edu.au> |
11 | * | 11 | * |
12 | * Original release 01/11/99 | 12 | * Original release 01/11/99 |
13 | * $Id: n_hdlc.c,v 4.8 2003/05/06 21:18:51 paulkf Exp $ | ||
14 | * | 13 | * |
15 | * This code is released under the GNU General Public License (GPL) | 14 | * This code is released under the GNU General Public License (GPL) |
16 | * | 15 | * |
@@ -79,7 +78,6 @@ | |||
79 | */ | 78 | */ |
80 | 79 | ||
81 | #define HDLC_MAGIC 0x239e | 80 | #define HDLC_MAGIC 0x239e |
82 | #define HDLC_VERSION "$Revision: 4.8 $" | ||
83 | 81 | ||
84 | #include <linux/module.h> | 82 | #include <linux/module.h> |
85 | #include <linux/init.h> | 83 | #include <linux/init.h> |
@@ -114,7 +112,7 @@ | |||
114 | #define MAX_HDLC_FRAME_SIZE 65535 | 112 | #define MAX_HDLC_FRAME_SIZE 65535 |
115 | #define DEFAULT_RX_BUF_COUNT 10 | 113 | #define DEFAULT_RX_BUF_COUNT 10 |
116 | #define MAX_RX_BUF_COUNT 60 | 114 | #define MAX_RX_BUF_COUNT 60 |
117 | #define DEFAULT_TX_BUF_COUNT 1 | 115 | #define DEFAULT_TX_BUF_COUNT 3 |
118 | 116 | ||
119 | struct n_hdlc_buf { | 117 | struct n_hdlc_buf { |
120 | struct n_hdlc_buf *link; | 118 | struct n_hdlc_buf *link; |
@@ -199,6 +197,31 @@ static void n_hdlc_tty_wakeup(struct tty_struct *tty); | |||
199 | #define tty2n_hdlc(tty) ((struct n_hdlc *) ((tty)->disc_data)) | 197 | #define tty2n_hdlc(tty) ((struct n_hdlc *) ((tty)->disc_data)) |
200 | #define n_hdlc2tty(n_hdlc) ((n_hdlc)->tty) | 198 | #define n_hdlc2tty(n_hdlc) ((n_hdlc)->tty) |
201 | 199 | ||
200 | static void flush_rx_queue(struct tty_struct *tty) | ||
201 | { | ||
202 | struct n_hdlc *n_hdlc = tty2n_hdlc(tty); | ||
203 | struct n_hdlc_buf *buf; | ||
204 | |||
205 | while ((buf = n_hdlc_buf_get(&n_hdlc->rx_buf_list))) | ||
206 | n_hdlc_buf_put(&n_hdlc->rx_free_buf_list, buf); | ||
207 | } | ||
208 | |||
209 | static void flush_tx_queue(struct tty_struct *tty) | ||
210 | { | ||
211 | struct n_hdlc *n_hdlc = tty2n_hdlc(tty); | ||
212 | struct n_hdlc_buf *buf; | ||
213 | unsigned long flags; | ||
214 | |||
215 | while ((buf = n_hdlc_buf_get(&n_hdlc->tx_buf_list))) | ||
216 | n_hdlc_buf_put(&n_hdlc->tx_free_buf_list, buf); | ||
217 | spin_lock_irqsave(&n_hdlc->tx_buf_list.spinlock, flags); | ||
218 | if (n_hdlc->tbuf) { | ||
219 | n_hdlc_buf_put(&n_hdlc->tx_free_buf_list, n_hdlc->tbuf); | ||
220 | n_hdlc->tbuf = NULL; | ||
221 | } | ||
222 | spin_unlock_irqrestore(&n_hdlc->tx_buf_list.spinlock, flags); | ||
223 | } | ||
224 | |||
202 | static struct tty_ldisc_ops n_hdlc_ldisc = { | 225 | static struct tty_ldisc_ops n_hdlc_ldisc = { |
203 | .owner = THIS_MODULE, | 226 | .owner = THIS_MODULE, |
204 | .magic = TTY_LDISC_MAGIC, | 227 | .magic = TTY_LDISC_MAGIC, |
@@ -211,6 +234,7 @@ static struct tty_ldisc_ops n_hdlc_ldisc = { | |||
211 | .poll = n_hdlc_tty_poll, | 234 | .poll = n_hdlc_tty_poll, |
212 | .receive_buf = n_hdlc_tty_receive, | 235 | .receive_buf = n_hdlc_tty_receive, |
213 | .write_wakeup = n_hdlc_tty_wakeup, | 236 | .write_wakeup = n_hdlc_tty_wakeup, |
237 | .flush_buffer = flush_rx_queue, | ||
214 | }; | 238 | }; |
215 | 239 | ||
216 | /** | 240 | /** |
@@ -341,10 +365,7 @@ static int n_hdlc_tty_open (struct tty_struct *tty) | |||
341 | set_bit(TTY_NO_WRITE_SPLIT,&tty->flags); | 365 | set_bit(TTY_NO_WRITE_SPLIT,&tty->flags); |
342 | #endif | 366 | #endif |
343 | 367 | ||
344 | /* Flush any pending characters in the driver and discipline. */ | 368 | /* flush receive data from driver */ |
345 | if (tty->ldisc->ops->flush_buffer) | ||
346 | tty->ldisc->ops->flush_buffer(tty); | ||
347 | |||
348 | tty_driver_flush_buffer(tty); | 369 | tty_driver_flush_buffer(tty); |
349 | 370 | ||
350 | if (debuglevel >= DEBUG_LEVEL_INFO) | 371 | if (debuglevel >= DEBUG_LEVEL_INFO) |
@@ -763,6 +784,14 @@ static int n_hdlc_tty_ioctl(struct tty_struct *tty, struct file *file, | |||
763 | error = put_user(count, (int __user *)arg); | 784 | error = put_user(count, (int __user *)arg); |
764 | break; | 785 | break; |
765 | 786 | ||
787 | case TCFLSH: | ||
788 | switch (arg) { | ||
789 | case TCIOFLUSH: | ||
790 | case TCOFLUSH: | ||
791 | flush_tx_queue(tty); | ||
792 | } | ||
793 | /* fall through to default */ | ||
794 | |||
766 | default: | 795 | default: |
767 | error = n_tty_ioctl_helper(tty, file, cmd, arg); | 796 | error = n_tty_ioctl_helper(tty, file, cmd, arg); |
768 | break; | 797 | break; |
@@ -919,8 +948,7 @@ static struct n_hdlc_buf* n_hdlc_buf_get(struct n_hdlc_buf_list *list) | |||
919 | } /* end of n_hdlc_buf_get() */ | 948 | } /* end of n_hdlc_buf_get() */ |
920 | 949 | ||
921 | static char hdlc_banner[] __initdata = | 950 | static char hdlc_banner[] __initdata = |
922 | KERN_INFO "HDLC line discipline: version " HDLC_VERSION | 951 | KERN_INFO "HDLC line discipline maxframe=%u\n"; |
923 | ", maxframe=%u\n"; | ||
924 | static char hdlc_register_ok[] __initdata = | 952 | static char hdlc_register_ok[] __initdata = |
925 | KERN_INFO "N_HDLC line discipline registered.\n"; | 953 | KERN_INFO "N_HDLC line discipline registered.\n"; |
926 | static char hdlc_register_fail[] __initdata = | 954 | static char hdlc_register_fail[] __initdata = |
diff --git a/drivers/char/n_r3964.c b/drivers/char/n_r3964.c index d2e93e343226..2e99158ebb8a 100644 --- a/drivers/char/n_r3964.c +++ b/drivers/char/n_r3964.c | |||
@@ -1062,7 +1062,7 @@ static ssize_t r3964_read(struct tty_struct *tty, struct file *file, | |||
1062 | struct r3964_client_info *pClient; | 1062 | struct r3964_client_info *pClient; |
1063 | struct r3964_message *pMsg; | 1063 | struct r3964_message *pMsg; |
1064 | struct r3964_client_message theMsg; | 1064 | struct r3964_client_message theMsg; |
1065 | int count; | 1065 | int ret; |
1066 | 1066 | ||
1067 | TRACE_L("read()"); | 1067 | TRACE_L("read()"); |
1068 | 1068 | ||
@@ -1074,8 +1074,8 @@ static ssize_t r3964_read(struct tty_struct *tty, struct file *file, | |||
1074 | if (pMsg == NULL) { | 1074 | if (pMsg == NULL) { |
1075 | /* no messages available. */ | 1075 | /* no messages available. */ |
1076 | if (file->f_flags & O_NONBLOCK) { | 1076 | if (file->f_flags & O_NONBLOCK) { |
1077 | unlock_kernel(); | 1077 | ret = -EAGAIN; |
1078 | return -EAGAIN; | 1078 | goto unlock; |
1079 | } | 1079 | } |
1080 | /* block until there is a message: */ | 1080 | /* block until there is a message: */ |
1081 | wait_event_interruptible(pInfo->read_wait, | 1081 | wait_event_interruptible(pInfo->read_wait, |
@@ -1085,29 +1085,31 @@ static ssize_t r3964_read(struct tty_struct *tty, struct file *file, | |||
1085 | /* If we still haven't got a message, we must have been signalled */ | 1085 | /* If we still haven't got a message, we must have been signalled */ |
1086 | 1086 | ||
1087 | if (!pMsg) { | 1087 | if (!pMsg) { |
1088 | unlock_kernel(); | 1088 | ret = -EINTR; |
1089 | return -EINTR; | 1089 | goto unlock; |
1090 | } | 1090 | } |
1091 | 1091 | ||
1092 | /* deliver msg to client process: */ | 1092 | /* deliver msg to client process: */ |
1093 | theMsg.msg_id = pMsg->msg_id; | 1093 | theMsg.msg_id = pMsg->msg_id; |
1094 | theMsg.arg = pMsg->arg; | 1094 | theMsg.arg = pMsg->arg; |
1095 | theMsg.error_code = pMsg->error_code; | 1095 | theMsg.error_code = pMsg->error_code; |
1096 | count = sizeof(struct r3964_client_message); | 1096 | ret = sizeof(struct r3964_client_message); |
1097 | 1097 | ||
1098 | kfree(pMsg); | 1098 | kfree(pMsg); |
1099 | TRACE_M("r3964_read - msg kfree %p", pMsg); | 1099 | TRACE_M("r3964_read - msg kfree %p", pMsg); |
1100 | 1100 | ||
1101 | if (copy_to_user(buf, &theMsg, count)) { | 1101 | if (copy_to_user(buf, &theMsg, ret)) { |
1102 | unlock_kernel(); | 1102 | ret = -EFAULT; |
1103 | return -EFAULT; | 1103 | goto unlock; |
1104 | } | 1104 | } |
1105 | 1105 | ||
1106 | TRACE_PS("read - return %d", count); | 1106 | TRACE_PS("read - return %d", ret); |
1107 | return count; | 1107 | goto unlock; |
1108 | } | 1108 | } |
1109 | ret = -EPERM; | ||
1110 | unlock: | ||
1109 | unlock_kernel(); | 1111 | unlock_kernel(); |
1110 | return -EPERM; | 1112 | return ret; |
1111 | } | 1113 | } |
1112 | 1114 | ||
1113 | static ssize_t r3964_write(struct tty_struct *tty, struct file *file, | 1115 | static ssize_t r3964_write(struct tty_struct *tty, struct file *file, |
diff --git a/drivers/char/nozomi.c b/drivers/char/nozomi.c index d6102b644b55..574f1c79b6e6 100644 --- a/drivers/char/nozomi.c +++ b/drivers/char/nozomi.c | |||
@@ -1591,8 +1591,6 @@ static int ntty_open(struct tty_struct *tty, struct file *file) | |||
1591 | 1591 | ||
1592 | /* Enable interrupt downlink for channel */ | 1592 | /* Enable interrupt downlink for channel */ |
1593 | if (port->port.count == 1) { | 1593 | if (port->port.count == 1) { |
1594 | /* FIXME: is this needed now ? */ | ||
1595 | tty->low_latency = 1; | ||
1596 | tty->driver_data = port; | 1594 | tty->driver_data = port; |
1597 | tty_port_tty_set(&port->port, tty); | 1595 | tty_port_tty_set(&port->port, tty); |
1598 | DBG1("open: %d", port->token_dl); | 1596 | DBG1("open: %d", port->token_dl); |
diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c index dbb912574569..881934c068c8 100644 --- a/drivers/char/pcmcia/cm4000_cs.c +++ b/drivers/char/pcmcia/cm4000_cs.c | |||
@@ -1575,7 +1575,8 @@ static long cmm_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | |||
1575 | clear_bit(LOCK_IO, &dev->flags); | 1575 | clear_bit(LOCK_IO, &dev->flags); |
1576 | wake_up_interruptible(&dev->ioq); | 1576 | wake_up_interruptible(&dev->ioq); |
1577 | 1577 | ||
1578 | return 0; | 1578 | rc = 0; |
1579 | break; | ||
1579 | case CM_IOCSPTS: | 1580 | case CM_IOCSPTS: |
1580 | { | 1581 | { |
1581 | struct ptsreq krnptsreq; | 1582 | struct ptsreq krnptsreq; |
diff --git a/drivers/char/synclink_gt.c b/drivers/char/synclink_gt.c index 1386625fc4ca..a2e67e6df3a1 100644 --- a/drivers/char/synclink_gt.c +++ b/drivers/char/synclink_gt.c | |||
@@ -467,7 +467,6 @@ static unsigned int free_tbuf_count(struct slgt_info *info); | |||
467 | static unsigned int tbuf_bytes(struct slgt_info *info); | 467 | static unsigned int tbuf_bytes(struct slgt_info *info); |
468 | static void reset_tbufs(struct slgt_info *info); | 468 | static void reset_tbufs(struct slgt_info *info); |
469 | static void tdma_reset(struct slgt_info *info); | 469 | static void tdma_reset(struct slgt_info *info); |
470 | static void tdma_start(struct slgt_info *info); | ||
471 | static void tx_load(struct slgt_info *info, const char *buf, unsigned int count); | 470 | static void tx_load(struct slgt_info *info, const char *buf, unsigned int count); |
472 | 471 | ||
473 | static void get_signals(struct slgt_info *info); | 472 | static void get_signals(struct slgt_info *info); |
@@ -795,6 +794,18 @@ static void set_termios(struct tty_struct *tty, struct ktermios *old_termios) | |||
795 | } | 794 | } |
796 | } | 795 | } |
797 | 796 | ||
797 | static void update_tx_timer(struct slgt_info *info) | ||
798 | { | ||
799 | /* | ||
800 | * use worst case speed of 1200bps to calculate transmit timeout | ||
801 | * based on data in buffers (tbuf_bytes) and FIFO (128 bytes) | ||
802 | */ | ||
803 | if (info->params.mode == MGSL_MODE_HDLC) { | ||
804 | int timeout = (tbuf_bytes(info) * 7) + 1000; | ||
805 | mod_timer(&info->tx_timer, jiffies + msecs_to_jiffies(timeout)); | ||
806 | } | ||
807 | } | ||
808 | |||
798 | static int write(struct tty_struct *tty, | 809 | static int write(struct tty_struct *tty, |
799 | const unsigned char *buf, int count) | 810 | const unsigned char *buf, int count) |
800 | { | 811 | { |
@@ -838,8 +849,18 @@ start: | |||
838 | spin_lock_irqsave(&info->lock,flags); | 849 | spin_lock_irqsave(&info->lock,flags); |
839 | if (!info->tx_active) | 850 | if (!info->tx_active) |
840 | tx_start(info); | 851 | tx_start(info); |
841 | else | 852 | else if (!(rd_reg32(info, TDCSR) & BIT0)) { |
842 | tdma_start(info); | 853 | /* transmit still active but transmit DMA stopped */ |
854 | unsigned int i = info->tbuf_current; | ||
855 | if (!i) | ||
856 | i = info->tbuf_count; | ||
857 | i--; | ||
858 | /* if DMA buf unsent must try later after tx idle */ | ||
859 | if (desc_count(info->tbufs[i])) | ||
860 | ret = 0; | ||
861 | } | ||
862 | if (ret > 0) | ||
863 | update_tx_timer(info); | ||
843 | spin_unlock_irqrestore(&info->lock,flags); | 864 | spin_unlock_irqrestore(&info->lock,flags); |
844 | } | 865 | } |
845 | 866 | ||
@@ -1502,10 +1523,9 @@ static int hdlcdev_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1502 | /* save start time for transmit timeout detection */ | 1523 | /* save start time for transmit timeout detection */ |
1503 | dev->trans_start = jiffies; | 1524 | dev->trans_start = jiffies; |
1504 | 1525 | ||
1505 | /* start hardware transmitter if necessary */ | ||
1506 | spin_lock_irqsave(&info->lock,flags); | 1526 | spin_lock_irqsave(&info->lock,flags); |
1507 | if (!info->tx_active) | 1527 | tx_start(info); |
1508 | tx_start(info); | 1528 | update_tx_timer(info); |
1509 | spin_unlock_irqrestore(&info->lock,flags); | 1529 | spin_unlock_irqrestore(&info->lock,flags); |
1510 | 1530 | ||
1511 | return 0; | 1531 | return 0; |
@@ -3946,50 +3966,19 @@ static void tx_start(struct slgt_info *info) | |||
3946 | slgt_irq_on(info, IRQ_TXUNDER + IRQ_TXIDLE); | 3966 | slgt_irq_on(info, IRQ_TXUNDER + IRQ_TXIDLE); |
3947 | /* clear tx idle and underrun status bits */ | 3967 | /* clear tx idle and underrun status bits */ |
3948 | wr_reg16(info, SSR, (unsigned short)(IRQ_TXIDLE + IRQ_TXUNDER)); | 3968 | wr_reg16(info, SSR, (unsigned short)(IRQ_TXIDLE + IRQ_TXUNDER)); |
3949 | if (info->params.mode == MGSL_MODE_HDLC) | ||
3950 | mod_timer(&info->tx_timer, jiffies + | ||
3951 | msecs_to_jiffies(5000)); | ||
3952 | } else { | 3969 | } else { |
3953 | slgt_irq_off(info, IRQ_TXDATA); | 3970 | slgt_irq_off(info, IRQ_TXDATA); |
3954 | slgt_irq_on(info, IRQ_TXIDLE); | 3971 | slgt_irq_on(info, IRQ_TXIDLE); |
3955 | /* clear tx idle status bit */ | 3972 | /* clear tx idle status bit */ |
3956 | wr_reg16(info, SSR, IRQ_TXIDLE); | 3973 | wr_reg16(info, SSR, IRQ_TXIDLE); |
3957 | } | 3974 | } |
3958 | tdma_start(info); | 3975 | /* set 1st descriptor address and start DMA */ |
3976 | wr_reg32(info, TDDAR, info->tbufs[info->tbuf_start].pdesc); | ||
3977 | wr_reg32(info, TDCSR, BIT2 + BIT0); | ||
3959 | info->tx_active = true; | 3978 | info->tx_active = true; |
3960 | } | 3979 | } |
3961 | } | 3980 | } |
3962 | 3981 | ||
3963 | /* | ||
3964 | * start transmit DMA if inactive and there are unsent buffers | ||
3965 | */ | ||
3966 | static void tdma_start(struct slgt_info *info) | ||
3967 | { | ||
3968 | unsigned int i; | ||
3969 | |||
3970 | if (rd_reg32(info, TDCSR) & BIT0) | ||
3971 | return; | ||
3972 | |||
3973 | /* transmit DMA inactive, check for unsent buffers */ | ||
3974 | i = info->tbuf_start; | ||
3975 | while (!desc_count(info->tbufs[i])) { | ||
3976 | if (++i == info->tbuf_count) | ||
3977 | i = 0; | ||
3978 | if (i == info->tbuf_current) | ||
3979 | return; | ||
3980 | } | ||
3981 | info->tbuf_start = i; | ||
3982 | |||
3983 | /* there are unsent buffers, start transmit DMA */ | ||
3984 | |||
3985 | /* reset needed if previous error condition */ | ||
3986 | tdma_reset(info); | ||
3987 | |||
3988 | /* set 1st descriptor address */ | ||
3989 | wr_reg32(info, TDDAR, info->tbufs[info->tbuf_start].pdesc); | ||
3990 | wr_reg32(info, TDCSR, BIT2 + BIT0); /* IRQ + DMA enable */ | ||
3991 | } | ||
3992 | |||
3993 | static void tx_stop(struct slgt_info *info) | 3982 | static void tx_stop(struct slgt_info *info) |
3994 | { | 3983 | { |
3995 | unsigned short val; | 3984 | unsigned short val; |
@@ -5004,8 +4993,7 @@ static void tx_timeout(unsigned long context) | |||
5004 | info->icount.txtimeout++; | 4993 | info->icount.txtimeout++; |
5005 | } | 4994 | } |
5006 | spin_lock_irqsave(&info->lock,flags); | 4995 | spin_lock_irqsave(&info->lock,flags); |
5007 | info->tx_active = false; | 4996 | tx_stop(info); |
5008 | info->tx_count = 0; | ||
5009 | spin_unlock_irqrestore(&info->lock,flags); | 4997 | spin_unlock_irqrestore(&info->lock,flags); |
5010 | 4998 | ||
5011 | #if SYNCLINK_GENERIC_HDLC | 4999 | #if SYNCLINK_GENERIC_HDLC |
diff --git a/drivers/char/tty_ldisc.c b/drivers/char/tty_ldisc.c index a19e935847b0..913aa8d3f1c5 100644 --- a/drivers/char/tty_ldisc.c +++ b/drivers/char/tty_ldisc.c | |||
@@ -867,15 +867,22 @@ void tty_ldisc_release(struct tty_struct *tty, struct tty_struct *o_tty) | |||
867 | tty_ldisc_wait_idle(tty); | 867 | tty_ldisc_wait_idle(tty); |
868 | 868 | ||
869 | /* | 869 | /* |
870 | * Shutdown the current line discipline, and reset it to N_TTY. | 870 | * Now kill off the ldisc |
871 | * | ||
872 | * FIXME: this MUST get fixed for the new reflocking | ||
873 | */ | 871 | */ |
872 | tty_ldisc_close(tty, tty->ldisc); | ||
873 | tty_ldisc_put(tty->ldisc); | ||
874 | /* Force an oops if we mess this up */ | ||
875 | tty->ldisc = NULL; | ||
876 | |||
877 | /* Ensure the next open requests the N_TTY ldisc */ | ||
878 | tty_set_termios_ldisc(tty, N_TTY); | ||
874 | 879 | ||
875 | tty_ldisc_reinit(tty); | ||
876 | /* This will need doing differently if we need to lock */ | 880 | /* This will need doing differently if we need to lock */ |
877 | if (o_tty) | 881 | if (o_tty) |
878 | tty_ldisc_release(o_tty, NULL); | 882 | tty_ldisc_release(o_tty, NULL); |
883 | |||
884 | /* And the memory resources remaining (buffers, termios) will be | ||
885 | disposed of when the kref hits zero */ | ||
879 | } | 886 | } |
880 | 887 | ||
881 | /** | 888 | /** |
diff --git a/drivers/char/tty_port.c b/drivers/char/tty_port.c index 62dadfc95e34..4e862a75f7ff 100644 --- a/drivers/char/tty_port.c +++ b/drivers/char/tty_port.c | |||
@@ -193,7 +193,7 @@ int tty_port_block_til_ready(struct tty_port *port, | |||
193 | { | 193 | { |
194 | int do_clocal = 0, retval; | 194 | int do_clocal = 0, retval; |
195 | unsigned long flags; | 195 | unsigned long flags; |
196 | DECLARE_WAITQUEUE(wait, current); | 196 | DEFINE_WAIT(wait); |
197 | int cd; | 197 | int cd; |
198 | 198 | ||
199 | /* block if port is in the process of being closed */ | 199 | /* block if port is in the process of being closed */ |
diff --git a/drivers/char/vt_ioctl.c b/drivers/char/vt_ioctl.c index e6ce632a393e..7539bed0f7e0 100644 --- a/drivers/char/vt_ioctl.c +++ b/drivers/char/vt_ioctl.c | |||
@@ -396,7 +396,8 @@ int vt_ioctl(struct tty_struct *tty, struct file * file, | |||
396 | kbd = kbd_table + console; | 396 | kbd = kbd_table + console; |
397 | switch (cmd) { | 397 | switch (cmd) { |
398 | case TIOCLINUX: | 398 | case TIOCLINUX: |
399 | return tioclinux(tty, arg); | 399 | ret = tioclinux(tty, arg); |
400 | break; | ||
400 | case KIOCSOUND: | 401 | case KIOCSOUND: |
401 | if (!perm) | 402 | if (!perm) |
402 | goto eperm; | 403 | goto eperm; |