aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-12-11 18:34:40 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-12-11 18:34:40 -0500
commit0f4974c439dd7826c85bae4e6a8088ce2db0f498 (patch)
treefdabc7d9bb7d7bc49aad547c0aac3a633ce01f09 /include/linux
parent3126c136bc30225d7a43af741778aa50e95e467a (diff)
parent36ba782e9674cdc29ec7003757df0b375e99fa96 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty-2.6: (58 commits) tty: split the lock up a bit further tty: Move the leader test in disassociate tty: Push the bkl down a bit in the hangup code tty: Push the lock down further into the ldisc code tty: push the BKL down into the handlers a bit tty: moxa: split open lock tty: moxa: Kill the use of lock_kernel tty: moxa: Fix modem op locking tty: moxa: Kill off the throttle method tty: moxa: Locking clean up tty: moxa: rework the locking a bit tty: moxa: Use more tty_port ops tty: isicom: fix deadlock on shutdown tty: mxser: Use the new locking rules to fix setserial properly tty: mxser: use the tty_port_open method tty: isicom: sort out the board init logic tty: isicom: switch to the new tty_port_open helper tty: tty_port: Add a kref object to the tty port tty: istallion: tty port open/close methods tty: stallion: Convert to the tty_port_open/close methods ...
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/Kbuild1
-rw-r--r--include/linux/hayesesp.h114
-rw-r--r--include/linux/isicom.h1
-rw-r--r--include/linux/tty.h25
-rw-r--r--include/linux/usb/serial.h3
5 files changed, 24 insertions, 120 deletions
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index 5a5385749e1..f72914db2a1 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -214,7 +214,6 @@ unifdef-y += futex.h
214unifdef-y += fs.h 214unifdef-y += fs.h
215unifdef-y += gameport.h 215unifdef-y += gameport.h
216unifdef-y += generic_serial.h 216unifdef-y += generic_serial.h
217unifdef-y += hayesesp.h
218unifdef-y += hdlcdrv.h 217unifdef-y += hdlcdrv.h
219unifdef-y += hdlc.h 218unifdef-y += hdlc.h
220unifdef-y += hdreg.h 219unifdef-y += hdreg.h
diff --git a/include/linux/hayesesp.h b/include/linux/hayesesp.h
deleted file mode 100644
index 92b08cfe4a7..00000000000
--- a/include/linux/hayesesp.h
+++ /dev/null
@@ -1,114 +0,0 @@
1#ifndef HAYESESP_H
2#define HAYESESP_H
3
4struct hayes_esp_config {
5 short flow_on;
6 short flow_off;
7 short rx_trigger;
8 short tx_trigger;
9 short pio_threshold;
10 unsigned char rx_timeout;
11 char dma_channel;
12};
13
14#ifdef __KERNEL__
15
16#define ESP_DMA_CHANNEL 0
17#define ESP_RX_TRIGGER 768
18#define ESP_TX_TRIGGER 768
19#define ESP_FLOW_OFF 1016
20#define ESP_FLOW_ON 944
21#define ESP_RX_TMOUT 128
22#define ESP_PIO_THRESHOLD 32
23
24#define ESP_IN_MAJOR 57 /* major dev # for dial in */
25#define ESP_OUT_MAJOR 58 /* major dev # for dial out */
26#define ESPC_SCALE 3
27#define UART_ESI_BASE 0x00
28#define UART_ESI_SID 0x01
29#define UART_ESI_RX 0x02
30#define UART_ESI_TX 0x02
31#define UART_ESI_CMD1 0x04
32#define UART_ESI_CMD2 0x05
33#define UART_ESI_STAT1 0x04
34#define UART_ESI_STAT2 0x05
35#define UART_ESI_RWS 0x07
36
37#define UART_IER_DMA_TMOUT 0x80
38#define UART_IER_DMA_TC 0x08
39
40#define ESI_SET_IRQ 0x04
41#define ESI_SET_DMA_TMOUT 0x05
42#define ESI_SET_SRV_MASK 0x06
43#define ESI_SET_ERR_MASK 0x07
44#define ESI_SET_FLOW_CNTL 0x08
45#define ESI_SET_FLOW_CHARS 0x09
46#define ESI_SET_FLOW_LVL 0x0a
47#define ESI_SET_TRIGGER 0x0b
48#define ESI_SET_RX_TIMEOUT 0x0c
49#define ESI_SET_FLOW_TMOUT 0x0d
50#define ESI_WRITE_UART 0x0e
51#define ESI_READ_UART 0x0f
52#define ESI_SET_MODE 0x10
53#define ESI_GET_ERR_STAT 0x12
54#define ESI_GET_UART_STAT 0x13
55#define ESI_GET_RX_AVAIL 0x14
56#define ESI_GET_TX_AVAIL 0x15
57#define ESI_START_DMA_RX 0x16
58#define ESI_START_DMA_TX 0x17
59#define ESI_ISSUE_BREAK 0x1a
60#define ESI_FLUSH_RX 0x1b
61#define ESI_FLUSH_TX 0x1c
62#define ESI_SET_BAUD 0x1d
63#define ESI_SET_ENH_IRQ 0x1f
64#define ESI_SET_REINTR 0x20
65#define ESI_SET_PRESCALAR 0x23
66#define ESI_NO_COMMAND 0xff
67
68#define ESP_STAT_RX_TIMEOUT 0x01
69#define ESP_STAT_DMA_RX 0x02
70#define ESP_STAT_DMA_TX 0x04
71#define ESP_STAT_NEVER_DMA 0x08
72#define ESP_STAT_USE_PIO 0x10
73
74#define ESP_MAGIC 0x53ee
75#define ESP_XMIT_SIZE 4096
76
77struct esp_struct {
78 int magic;
79 struct tty_port port;
80 spinlock_t lock;
81 int io_port;
82 int irq;
83 int read_status_mask;
84 int ignore_status_mask;
85 int timeout;
86 int stat_flags;
87 int custom_divisor;
88 int close_delay;
89 unsigned short closing_wait;
90 unsigned short closing_wait2;
91 int IER; /* Interrupt Enable Register */
92 int MCR; /* Modem control register */
93 unsigned long last_active;
94 int line;
95 unsigned char *xmit_buf;
96 int xmit_head;
97 int xmit_tail;
98 int xmit_cnt;
99 wait_queue_head_t break_wait;
100 struct async_icount icount; /* kernel counters for the 4 input interrupts */
101 struct hayes_esp_config config; /* port configuration */
102 struct esp_struct *next_port; /* For the linked list */
103};
104
105struct esp_pio_buffer {
106 unsigned char data[1024];
107 struct esp_pio_buffer *next;
108};
109
110#endif /* __KERNEL__ */
111
112
113#endif /* ESP_H */
114
diff --git a/include/linux/isicom.h b/include/linux/isicom.h
index bbd42197298..b92e0565063 100644
--- a/include/linux/isicom.h
+++ b/include/linux/isicom.h
@@ -67,6 +67,7 @@
67 67
68#define FIRMWARE_LOADED 0x0001 68#define FIRMWARE_LOADED 0x0001
69#define BOARD_ACTIVE 0x0002 69#define BOARD_ACTIVE 0x0002
70#define BOARD_INIT 0x0004
70 71
71 /* isi_port status bitmap */ 72 /* isi_port status bitmap */
72 73
diff --git a/include/linux/tty.h b/include/linux/tty.h
index f0f43d08d8b..405a9035fe4 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -190,9 +190,17 @@ struct tty_port_operations {
190 /* Control the DTR line */ 190 /* Control the DTR line */
191 void (*dtr_rts)(struct tty_port *port, int raise); 191 void (*dtr_rts)(struct tty_port *port, int raise);
192 /* Called when the last close completes or a hangup finishes 192 /* Called when the last close completes or a hangup finishes
193 IFF the port was initialized. Do not use to free resources */ 193 IFF the port was initialized. Do not use to free resources. Called
194 under the port mutex to serialize against activate/shutdowns */
194 void (*shutdown)(struct tty_port *port); 195 void (*shutdown)(struct tty_port *port);
195 void (*drop)(struct tty_port *port); 196 void (*drop)(struct tty_port *port);
197 /* Called under the port mutex from tty_port_open, serialized using
198 the port mutex */
199 /* FIXME: long term getting the tty argument *out* of this would be
200 good for consoles */
201 int (*activate)(struct tty_port *port, struct tty_struct *tty);
202 /* Called on the final put of a port */
203 void (*destruct)(struct tty_port *port);
196}; 204};
197 205
198struct tty_port { 206struct tty_port {
@@ -206,12 +214,14 @@ struct tty_port {
206 wait_queue_head_t delta_msr_wait; /* Modem status change */ 214 wait_queue_head_t delta_msr_wait; /* Modem status change */
207 unsigned long flags; /* TTY flags ASY_*/ 215 unsigned long flags; /* TTY flags ASY_*/
208 struct mutex mutex; /* Locking */ 216 struct mutex mutex; /* Locking */
217 struct mutex buf_mutex; /* Buffer alloc lock */
209 unsigned char *xmit_buf; /* Optional buffer */ 218 unsigned char *xmit_buf; /* Optional buffer */
210 unsigned int close_delay; /* Close port delay */ 219 unsigned int close_delay; /* Close port delay */
211 unsigned int closing_wait; /* Delay for output */ 220 unsigned int closing_wait; /* Delay for output */
212 int drain_delay; /* Set to zero if no pure time 221 int drain_delay; /* Set to zero if no pure time
213 based drain is needed else 222 based drain is needed else
214 set to size of fifo */ 223 set to size of fifo */
224 struct kref kref; /* Ref counter */
215}; 225};
216 226
217/* 227/*
@@ -439,7 +449,7 @@ extern void initialize_tty_struct(struct tty_struct *tty,
439 struct tty_driver *driver, int idx); 449 struct tty_driver *driver, int idx);
440extern struct tty_struct *tty_init_dev(struct tty_driver *driver, int idx, 450extern struct tty_struct *tty_init_dev(struct tty_driver *driver, int idx,
441 int first_ok); 451 int first_ok);
442extern void tty_release_dev(struct file *filp); 452extern int tty_release(struct inode *inode, struct file *filp);
443extern int tty_init_termios(struct tty_struct *tty); 453extern int tty_init_termios(struct tty_struct *tty);
444 454
445extern struct tty_struct *tty_pair_get_tty(struct tty_struct *tty); 455extern struct tty_struct *tty_pair_get_tty(struct tty_struct *tty);
@@ -454,6 +464,15 @@ extern int tty_write_lock(struct tty_struct *tty, int ndelay);
454extern void tty_port_init(struct tty_port *port); 464extern void tty_port_init(struct tty_port *port);
455extern int tty_port_alloc_xmit_buf(struct tty_port *port); 465extern int tty_port_alloc_xmit_buf(struct tty_port *port);
456extern void tty_port_free_xmit_buf(struct tty_port *port); 466extern void tty_port_free_xmit_buf(struct tty_port *port);
467extern void tty_port_put(struct tty_port *port);
468
469extern inline struct tty_port *tty_port_get(struct tty_port *port)
470{
471 if (port)
472 kref_get(&port->kref);
473 return port;
474}
475
457extern struct tty_struct *tty_port_tty_get(struct tty_port *port); 476extern struct tty_struct *tty_port_tty_get(struct tty_port *port);
458extern void tty_port_tty_set(struct tty_port *port, struct tty_struct *tty); 477extern void tty_port_tty_set(struct tty_port *port, struct tty_struct *tty);
459extern int tty_port_carrier_raised(struct tty_port *port); 478extern int tty_port_carrier_raised(struct tty_port *port);
@@ -467,6 +486,8 @@ extern int tty_port_close_start(struct tty_port *port,
467extern void tty_port_close_end(struct tty_port *port, struct tty_struct *tty); 486extern void tty_port_close_end(struct tty_port *port, struct tty_struct *tty);
468extern void tty_port_close(struct tty_port *port, 487extern void tty_port_close(struct tty_port *port,
469 struct tty_struct *tty, struct file *filp); 488 struct tty_struct *tty, struct file *filp);
489extern int tty_port_open(struct tty_port *port,
490 struct tty_struct *tty, struct file *filp);
470extern inline int tty_port_users(struct tty_port *port) 491extern inline int tty_port_users(struct tty_port *port)
471{ 492{
472 return port->count + port->blocked_open; 493 return port->count + port->blocked_open;
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h
index ce911ebf91e..acf6e457c04 100644
--- a/include/linux/usb/serial.h
+++ b/include/linux/usb/serial.h
@@ -39,8 +39,6 @@ enum port_dev_state {
39 * @serial: pointer back to the struct usb_serial owner of this port. 39 * @serial: pointer back to the struct usb_serial owner of this port.
40 * @port: pointer to the corresponding tty_port for this port. 40 * @port: pointer to the corresponding tty_port for this port.
41 * @lock: spinlock to grab when updating portions of this structure. 41 * @lock: spinlock to grab when updating portions of this structure.
42 * @mutex: mutex used to synchronize serial_open() and serial_close()
43 * access for this port.
44 * @number: the number of the port (the minor number). 42 * @number: the number of the port (the minor number).
45 * @interrupt_in_buffer: pointer to the interrupt in buffer for this port. 43 * @interrupt_in_buffer: pointer to the interrupt in buffer for this port.
46 * @interrupt_in_urb: pointer to the interrupt in struct urb for this port. 44 * @interrupt_in_urb: pointer to the interrupt in struct urb for this port.
@@ -77,7 +75,6 @@ struct usb_serial_port {
77 struct usb_serial *serial; 75 struct usb_serial *serial;
78 struct tty_port port; 76 struct tty_port port;
79 spinlock_t lock; 77 spinlock_t lock;
80 struct mutex mutex;
81 unsigned char number; 78 unsigned char number;
82 79
83 unsigned char *interrupt_in_buffer; 80 unsigned char *interrupt_in_buffer;