4 * Copyright (C) 1998/1999 R.E.Wolff@BitWizard.nl
6 * written for the SX serial driver.
7 * Contains the code that should be shared over all the serial drivers.
9 * Credit for the idea to do it this way might go to Alan Cox.
12 * Version 0.1 -- December, 1998. Initial version.
13 * Version 0.2 -- March, 1999. Some more routines. Bugfixes. Etc.
14 * Version 0.5 -- August, 1999. Some more fixes. Reformat for Linus.
16 * BitWizard is actively maintaining this file. We sometimes find
17 * that someone submitted changes to this file. We really appreciate
18 * your help, but please submit changes through us. We're doing our
19 * best to be responsive. -- REW
22 #include <linux/module.h>
23 #include <linux/kernel.h>
24 #include <linux/tty.h>
25 #include <linux/serial.h>
27 #include <linux/generic_serial.h>
28 #include <linux/interrupt.h>
29 #include <asm/semaphore.h>
30 #include <asm/uaccess.h>
34 static char * tmp_buf;
35 static DECLARE_MUTEX(tmp_buf_sem);
40 #define gs_dprintk(f, str...) if (gs_debug & f) printk (str)
42 #define gs_dprintk(f, str...) /* nothing */
45 #define func_enter() gs_dprintk (GS_DEBUG_FLOW, "gs: enter %s\n", __FUNCTION__)
46 #define func_exit() gs_dprintk (GS_DEBUG_FLOW, "gs: exit %s\n", __FUNCTION__)
48 #ifdef NEW_WRITE_LOCKING
49 #define DECL /* Nothing */
50 #define LOCKIT down (& port->port_write_sem);
51 #define RELEASEIT up (&port->port_write_sem);
53 #define DECL unsigned long flags;
54 #define LOCKIT save_flags (flags);cli ()
55 #define RELEASEIT restore_flags (flags)
58 #define RS_EVENT_WRITE_WAKEUP 1
60 MODULE_PARM(gs_debug, "i");
63 void gs_put_char(struct tty_struct * tty, unsigned char ch)
72 port = tty->driver_data;
76 if (! (port->flags & ASYNC_INITIALIZED)) return;
78 /* Take a lock on the serial tranmit buffer! */
81 if (port->xmit_cnt >= SERIAL_XMIT_SIZE - 1) {
82 /* Sorry, buffer is full, drop character. Update statistics???? -- REW */
87 port->xmit_buf[port->xmit_head++] = ch;
88 port->xmit_head &= SERIAL_XMIT_SIZE - 1;
89 port->xmit_cnt++; /* Characters in buffer */
96 #ifdef NEW_WRITE_LOCKING
99 > Problems to take into account are:
100 > -1- Interrupts that empty part of the buffer.
101 > -2- page faults on the access to userspace.
102 > -3- Other processes that are also trying to do a "write".
105 int gs_write(struct tty_struct * tty, int from_user,
106 const unsigned char *buf, int count)
108 struct gs_port *port;
116 port = tty->driver_data;
120 if (! (port->flags & ASYNC_INITIALIZED))
123 /* get exclusive "write" access to this port (problem 3) */
124 /* This is not a spinlock because we can have a disk access (page
125 fault) in copy_from_user */
126 down (& port->port_write_sem);
132 /* This is safe because we "OWN" the "head". Noone else can
133 change the "head": we own the port_write_sem. */
134 /* Don't overrun the end of the buffer */
135 t = SERIAL_XMIT_SIZE - port->xmit_head;
138 /* This is safe because the xmit_cnt can only decrease. This
139 would increase "t", so we might copy too little chars. */
140 /* Don't copy past the "head" of the buffer */
141 t = SERIAL_XMIT_SIZE - 1 - port->xmit_cnt;
144 /* Can't copy more? break out! */
147 if (copy_from_user (port->xmit_buf + port->xmit_head,
149 up (& port->port_write_sem);
154 memcpy (port->xmit_buf + port->xmit_head, buf, c);
156 port -> xmit_cnt += c;
157 port -> xmit_head = (port->xmit_head + c) & (SERIAL_XMIT_SIZE -1);
162 up (& port->port_write_sem);
164 gs_dprintk (GS_DEBUG_WRITE, "write: interrupts are %s\n",
165 (port->flags & GS_TX_INTEN)?"enabled": "disabled");
167 if (port->xmit_cnt &&
170 !(port->flags & GS_TX_INTEN)) {
171 port->flags |= GS_TX_INTEN;
172 port->rd->enable_tx_interrupts (port);
179 > Problems to take into account are:
180 > -1- Interrupts that empty part of the buffer.
181 > -2- page faults on the access to userspace.
182 > -3- Other processes that are also trying to do a "write".
185 int gs_write(struct tty_struct * tty, int from_user,
186 const unsigned char *buf, int count)
188 struct gs_port *port;
195 /* The standard serial driver returns 0 in this case.
196 That sounds to me as "No error, I just didn't get to writing any
197 bytes. Feel free to try again."
198 The "official" way to write n bytes from buf is:
200 for (nwritten = 0;nwritten < n;nwritten += rv) {
201 rv = write (fd, buf+nwritten, n-nwritten);
202 if (rv < 0) break; // Error: bail out. //
205 which will loop endlessly in this case. The manual page for write
206 agrees with me. In practise almost everybody writes
207 "write (fd, buf,n);" but some people might have had to deal with
208 incomplete writes in the past and correctly implemented it by now...
211 if (!tty) return -EIO;
213 port = tty->driver_data;
214 if (!port || !port->xmit_buf || !tmp_buf)
223 /* This is safe because we "OWN" the "head". Noone else can
224 change the "head": we own the port_write_sem. */
225 /* Don't overrun the end of the buffer */
226 t = SERIAL_XMIT_SIZE - port->xmit_head;
229 /* This is safe because the xmit_cnt can only decrease. This
230 would increase "t", so we might copy too little chars. */
231 /* Don't copy past the "head" of the buffer */
232 t = SERIAL_XMIT_SIZE - 1 - port->xmit_cnt;
235 /* Can't copy more? break out! */
238 c -= copy_from_user(tmp_buf, buf, c);
245 t = SERIAL_XMIT_SIZE - port->xmit_head;
247 t = SERIAL_XMIT_SIZE - 1 - port->xmit_cnt;
250 memcpy(port->xmit_buf + port->xmit_head, tmp_buf, c);
251 port->xmit_head = ((port->xmit_head + c) &
252 (SERIAL_XMIT_SIZE-1));
254 restore_flags(flags);
265 /* This is safe because we "OWN" the "head". Noone else can
266 change the "head": we own the port_write_sem. */
267 /* Don't overrun the end of the buffer */
268 t = SERIAL_XMIT_SIZE - port->xmit_head;
271 /* This is safe because the xmit_cnt can only decrease. This
272 would increase "t", so we might copy too little chars. */
273 /* Don't copy past the "head" of the buffer */
274 t = SERIAL_XMIT_SIZE - 1 - port->xmit_cnt;
277 /* Can't copy more? break out! */
279 restore_flags(flags);
282 memcpy(port->xmit_buf + port->xmit_head, buf, c);
283 port->xmit_head = ((port->xmit_head + c) &
284 (SERIAL_XMIT_SIZE-1));
286 restore_flags(flags);
293 if (port->xmit_cnt &&
296 !(port->flags & GS_TX_INTEN)) {
297 port->flags |= GS_TX_INTEN;
298 port->rd->enable_tx_interrupts (port);
308 int gs_write_room(struct tty_struct * tty)
310 struct gs_port *port = tty->driver_data;
314 ret = SERIAL_XMIT_SIZE - port->xmit_cnt - 1;
322 int gs_chars_in_buffer(struct tty_struct *tty)
324 struct gs_port *port = tty->driver_data;
328 return port->xmit_cnt;
332 int gs_real_chars_in_buffer(struct tty_struct *tty)
334 struct gs_port *port;
338 port = tty->driver_data;
340 if (!port->rd) return 0;
341 if (!port->rd->chars_in_buffer) return 0;
344 return port->xmit_cnt + port->rd->chars_in_buffer (port);
348 static int gs_wait_tx_flushed (void * ptr, int timeout)
350 struct gs_port *port = ptr;
351 unsigned long end_jiffies;
352 int jiffies_to_transmit, charsleft = 0, rv = 0;
357 gs_dprintk (GS_DEBUG_FLUSH, "port=%p.\n", port);
359 gs_dprintk (GS_DEBUG_FLUSH, "xmit_cnt=%x, xmit_buf=%p, tty=%p.\n",
360 port->xmit_cnt, port->xmit_buf, port->tty);
363 if (!port || port->xmit_cnt < 0 || !port->xmit_buf) {
364 gs_dprintk (GS_DEBUG_FLUSH, "ERROR: !port, !port->xmit_buf or prot->xmit_cnt < 0.\n");
366 return -EINVAL; /* This is an error which we don't know how to handle. */
369 rcib = gs_real_chars_in_buffer(port->tty);
372 gs_dprintk (GS_DEBUG_FLUSH, "nothing to wait for.\n");
376 /* stop trying: now + twice the time it would normally take + seconds */
377 if (timeout == 0) timeout = MAX_SCHEDULE_TIMEOUT;
378 end_jiffies = jiffies;
379 if (timeout != MAX_SCHEDULE_TIMEOUT)
380 end_jiffies += port->baud?(2 * rcib * 10 * HZ / port->baud):0;
381 end_jiffies += timeout;
383 gs_dprintk (GS_DEBUG_FLUSH, "now=%lx, end=%lx (%ld).\n",
384 jiffies, end_jiffies, end_jiffies-jiffies);
386 /* the expression is actually jiffies < end_jiffies, but that won't
387 work around the wraparound. Tricky eh? */
388 while ((charsleft = gs_real_chars_in_buffer (port->tty)) &&
389 time_after (end_jiffies, jiffies)) {
391 chars * (bits/char) * (jiffies /sec) / (bits/sec) = jiffies!
394 charsleft += 16; /* Allow 16 chars more to be transmitted ... */
395 jiffies_to_transmit = port->baud?(1 + charsleft * 10 * HZ / port->baud):0;
396 /* ^^^ Round up.... */
397 if (jiffies_to_transmit <= 0) jiffies_to_transmit = 1;
399 gs_dprintk (GS_DEBUG_FLUSH, "Expect to finish in %d jiffies "
400 "(%d chars).\n", jiffies_to_transmit, charsleft);
402 set_current_state (TASK_INTERRUPTIBLE);
403 schedule_timeout(jiffies_to_transmit);
404 if (signal_pending (current)) {
405 gs_dprintk (GS_DEBUG_FLUSH, "Signal pending. Bombing out: ");
411 gs_dprintk (GS_DEBUG_FLUSH, "charsleft = %d.\n", charsleft);
412 set_current_state (TASK_RUNNING);
420 void gs_flush_buffer(struct tty_struct *tty)
422 struct gs_port *port;
429 port = tty->driver_data;
433 /* XXX Would the write semaphore do? */
434 save_flags(flags); cli();
435 port->xmit_cnt = port->xmit_head = port->xmit_tail = 0;
436 restore_flags(flags);
438 wake_up_interruptible(&tty->write_wait);
444 void gs_flush_chars(struct tty_struct * tty)
446 struct gs_port *port;
452 port = tty->driver_data;
456 if (port->xmit_cnt <= 0 || tty->stopped || tty->hw_stopped ||
462 /* Beats me -- REW */
463 port->flags |= GS_TX_INTEN;
464 port->rd->enable_tx_interrupts (port);
469 void gs_stop(struct tty_struct * tty)
471 struct gs_port *port;
477 port = tty->driver_data;
481 if (port->xmit_cnt &&
483 (port->flags & GS_TX_INTEN) ) {
484 port->flags &= ~GS_TX_INTEN;
485 port->rd->disable_tx_interrupts (port);
491 void gs_start(struct tty_struct * tty)
493 struct gs_port *port;
497 port = tty->driver_data;
501 if (port->xmit_cnt &&
503 !(port->flags & GS_TX_INTEN) ) {
504 port->flags |= GS_TX_INTEN;
505 port->rd->enable_tx_interrupts (port);
511 void gs_shutdown_port (struct gs_port *port)
519 if (!(port->flags & ASYNC_INITIALIZED))
525 if (port->xmit_buf) {
526 free_page((unsigned long) port->xmit_buf);
527 port->xmit_buf = NULL;
531 set_bit(TTY_IO_ERROR, &port->tty->flags);
533 port->rd->shutdown_port (port);
535 port->flags &= ~ASYNC_INITIALIZED;
536 restore_flags (flags);
542 void gs_hangup(struct tty_struct *tty)
544 struct gs_port *port;
550 port = tty->driver_data;
555 gs_shutdown_port (port);
556 port->flags &= ~(ASYNC_NORMAL_ACTIVE|GS_ACTIVE);
560 wake_up_interruptible(&port->open_wait);
565 void gs_do_softint(void *private_)
567 struct gs_port *port = private_;
568 struct tty_struct *tty;
578 if (test_and_clear_bit(RS_EVENT_WRITE_WAKEUP, &port->event)) {
580 wake_up_interruptible(&tty->write_wait);
586 int gs_block_til_ready(void *port_, struct file * filp)
588 struct gs_port *port = port_;
589 DECLARE_WAITQUEUE(wait, current);
593 struct tty_struct *tty;
603 gs_dprintk (GS_DEBUG_BTR, "Entering gs_block_till_ready.\n");
605 * If the device is in the middle of being closed, then block
606 * until it's done, and then try again.
608 if (tty_hung_up_p(filp) || port->flags & ASYNC_CLOSING) {
609 interruptible_sleep_on(&port->close_wait);
610 if (port->flags & ASYNC_HUP_NOTIFY)
616 gs_dprintk (GS_DEBUG_BTR, "after hung up\n");
619 * If non-blocking mode is set, or the port is not enabled,
620 * then make the check up front and then exit.
622 if ((filp->f_flags & O_NONBLOCK) ||
623 (tty->flags & (1 << TTY_IO_ERROR))) {
624 port->flags |= ASYNC_NORMAL_ACTIVE;
628 gs_dprintk (GS_DEBUG_BTR, "after nonblock\n");
634 * Block waiting for the carrier detect and the line to become
635 * free (i.e., not in use by the callout). While we are in
636 * this loop, port->count is dropped by one, so that
637 * rs_close() knows when to free things. We restore it upon
638 * exit, either normal or abnormal.
642 add_wait_queue(&port->open_wait, &wait);
644 gs_dprintk (GS_DEBUG_BTR, "after add waitq.\n");
646 if (!tty_hung_up_p(filp))
649 port->blocked_open++;
651 CD = port->rd->get_CD (port);
652 gs_dprintk (GS_DEBUG_BTR, "CD is now %d.\n", CD);
653 set_current_state (TASK_INTERRUPTIBLE);
654 if (tty_hung_up_p(filp) ||
655 !(port->flags & ASYNC_INITIALIZED)) {
656 if (port->flags & ASYNC_HUP_NOTIFY)
659 retval = -ERESTARTSYS;
662 if (!(port->flags & ASYNC_CLOSING) &&
665 gs_dprintk (GS_DEBUG_BTR, "signal_pending is now: %d (%lx)\n",
666 (int)signal_pending (current), *(long*)(¤t->blocked));
667 if (signal_pending(current)) {
668 retval = -ERESTARTSYS;
673 gs_dprintk (GS_DEBUG_BTR, "Got out of the loop. (%d)\n",
675 set_current_state (TASK_RUNNING);
676 remove_wait_queue(&port->open_wait, &wait);
677 if (!tty_hung_up_p(filp))
679 port->blocked_open--;
683 port->flags |= ASYNC_NORMAL_ACTIVE;
689 void gs_close(struct tty_struct * tty, struct file * filp)
692 struct gs_port *port;
698 port = (struct gs_port *) tty->driver_data;
703 /* This seems to happen when this is called from vhangup. */
704 gs_dprintk (GS_DEBUG_CLOSE, "gs: Odd: port->tty is NULL\n");
708 save_flags(flags); cli();
710 if (tty_hung_up_p(filp)) {
711 restore_flags(flags);
712 port->rd->hungup (port);
717 if ((tty->count == 1) && (port->count != 1)) {
718 printk(KERN_ERR "gs: gs_close: bad port count;"
719 " tty->count is 1, port count is %d\n", port->count);
722 if (--port->count < 0) {
723 printk(KERN_ERR "gs: gs_close: bad port count: %d\n", port->count);
727 gs_dprintk(GS_DEBUG_CLOSE, "gs_close: count: %d\n", port->count);
728 restore_flags(flags);
732 port->flags |= ASYNC_CLOSING;
735 * Now we wait for the transmit buffer to clear; and we notify
736 * the line discipline to only process XON/XOFF characters.
739 /* if (port->closing_wait != ASYNC_CLOSING_WAIT_NONE)
740 tty_wait_until_sent(tty, port->closing_wait); */
743 * At this point we stop accepting input. To do this, we
744 * disable the receive line status interrupts, and tell the
745 * interrupt driver to stop checking the data ready bit in the
746 * line status register.
749 port->rd->disable_rx_interrupts (port);
751 /* close has no way of returning "EINTR", so discard return value */
752 if (port->closing_wait != ASYNC_CLOSING_WAIT_NONE)
753 gs_wait_tx_flushed (port, port->closing_wait);
755 port->flags &= ~GS_ACTIVE;
757 if (tty->driver->flush_buffer)
758 tty->driver->flush_buffer(tty);
760 tty_ldisc_flush(tty);
764 port->rd->close (port);
765 port->rd->shutdown_port (port);
768 if (port->blocked_open) {
769 if (port->close_delay) {
770 set_current_state (TASK_INTERRUPTIBLE);
771 schedule_timeout(port->close_delay);
773 wake_up_interruptible(&port->open_wait);
775 port->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING | ASYNC_INITIALIZED);
776 wake_up_interruptible(&port->close_wait);
778 restore_flags(flags);
783 static unsigned int gs_baudrates[] = {
784 0, 50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800,
785 9600, 19200, 38400, 57600, 115200, 230400, 460800, 921600
789 void gs_set_termios (struct tty_struct * tty,
790 struct termios * old_termios)
792 struct gs_port *port;
793 int baudrate, tmp, rv;
794 struct termios *tiosp;
800 port = tty->driver_data;
804 tiosp = tty->termios;
806 if (gs_debug & GS_DEBUG_TERMIOS) {
807 gs_dprintk (GS_DEBUG_TERMIOS, "termios structure (%p):\n", tiosp);
811 /* This is an optimization that is only allowed for dumb cards */
812 /* Smart cards require knowledge of iflags and oflags too: that
813 might change hardware cooking mode.... */
816 if( (tiosp->c_iflag == old_termios->c_iflag)
817 && (tiosp->c_oflag == old_termios->c_oflag)
818 && (tiosp->c_cflag == old_termios->c_cflag)
819 && (tiosp->c_lflag == old_termios->c_lflag)
820 && (tiosp->c_line == old_termios->c_line)
821 && (memcmp(tiosp->c_cc, old_termios->c_cc, NCC) == 0)) {
822 gs_dprintk(GS_DEBUG_TERMIOS, "gs_set_termios: optimized away\n");
826 gs_dprintk(GS_DEBUG_TERMIOS, "gs_set_termios: no old_termios: "
827 "no optimization\n");
829 if(old_termios && (gs_debug & GS_DEBUG_TERMIOS)) {
830 if(tiosp->c_iflag != old_termios->c_iflag) printk("c_iflag changed\n");
831 if(tiosp->c_oflag != old_termios->c_oflag) printk("c_oflag changed\n");
832 if(tiosp->c_cflag != old_termios->c_cflag) printk("c_cflag changed\n");
833 if(tiosp->c_lflag != old_termios->c_lflag) printk("c_lflag changed\n");
834 if(tiosp->c_line != old_termios->c_line) printk("c_line changed\n");
835 if(!memcmp(tiosp->c_cc, old_termios->c_cc, NCC)) printk("c_cc changed\n");
838 baudrate = tiosp->c_cflag & CBAUD;
839 if (baudrate & CBAUDEX) {
840 baudrate &= ~CBAUDEX;
841 if ((baudrate < 1) || (baudrate > 4))
842 tiosp->c_cflag &= ~CBAUDEX;
847 baudrate = gs_baudrates[baudrate];
848 if ((tiosp->c_cflag & CBAUD) == B38400) {
849 if ( (port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI)
851 else if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI)
853 else if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI)
855 else if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP)
857 else if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST)
858 baudrate = (port->baud_base / port->custom_divisor);
861 /* I recommend using THIS instead of the mess in termios (and
862 duplicating the above code). Next we should create a clean
863 interface towards this variable. If your card supports arbitrary
864 baud rates, (e.g. CD1400 or 16550 based cards) then everything
865 will be very easy..... */
866 port->baud = baudrate;
868 /* Two timer ticks seems enough to wakeup something like SLIP driver */
869 /* Baudrate/10 is cps. Divide by HZ to get chars per tick. */
870 tmp = (baudrate / 10 / HZ) * 2;
872 if (tmp < 0) tmp = 0;
873 if (tmp >= SERIAL_XMIT_SIZE) tmp = SERIAL_XMIT_SIZE-1;
875 port->wakeup_chars = tmp;
877 /* We should really wait for the characters to be all sent before
878 changing the settings. -- CAL */
879 rv = gs_wait_tx_flushed (port, MAX_SCHEDULE_TIMEOUT);
880 if (rv < 0) return /* rv */;
882 rv = port->rd->set_real_termios(port);
883 if (rv < 0) return /* rv */;
886 (old_termios->c_cflag & CRTSCTS)) &&
887 !( tiosp->c_cflag & CRTSCTS)) {
892 #ifdef tytso_patch_94Nov25_1726
893 /* This "makes sense", Why is it commented out? */
895 if (!(old_termios->c_cflag & CLOCAL) &&
896 (tty->termios->c_cflag & CLOCAL))
897 wake_up_interruptible(&info->open_wait);
906 /* Must be called with interrupts enabled */
907 int gs_init_port(struct gs_port *port)
914 page = get_zeroed_page(GFP_KERNEL);
916 cli (); /* Don't expect this to make a difference. */
920 tmp_buf = (unsigned char *) page;
921 restore_flags (flags);
928 if (port->flags & ASYNC_INITIALIZED)
931 if (!port->xmit_buf) {
932 /* We may sleep in get_zeroed_page() */
935 tmp = get_zeroed_page(GFP_KERNEL);
942 port->xmit_buf = (unsigned char *) tmp;
943 restore_flags (flags);
952 clear_bit(TTY_IO_ERROR, &port->tty->flags);
954 port->xmit_cnt = port->xmit_head = port->xmit_tail = 0;
956 gs_set_termios(port->tty, NULL);
958 port->flags |= ASYNC_INITIALIZED;
959 port->flags &= ~GS_TX_INTEN;
961 restore_flags(flags);
966 int gs_setserial(struct gs_port *port, struct serial_struct __user *sp)
968 struct serial_struct sio;
970 if (copy_from_user(&sio, sp, sizeof(struct serial_struct)))
973 if (!capable(CAP_SYS_ADMIN)) {
974 if ((sio.baud_base != port->baud_base) ||
975 (sio.close_delay != port->close_delay) ||
976 ((sio.flags & ~ASYNC_USR_MASK) !=
977 (port->flags & ~ASYNC_USR_MASK)))
981 port->flags = (port->flags & ~ASYNC_USR_MASK) |
982 (sio.flags & ASYNC_USR_MASK);
984 port->baud_base = sio.baud_base;
985 port->close_delay = sio.close_delay;
986 port->closing_wait = sio.closing_wait;
987 port->custom_divisor = sio.custom_divisor;
989 gs_set_termios (port->tty, NULL);
995 /*****************************************************************************/
998 * Generate the serial struct info.
1001 int gs_getserial(struct gs_port *port, struct serial_struct __user *sp)
1003 struct serial_struct sio;
1005 memset(&sio, 0, sizeof(struct serial_struct));
1006 sio.flags = port->flags;
1007 sio.baud_base = port->baud_base;
1008 sio.close_delay = port->close_delay;
1009 sio.closing_wait = port->closing_wait;
1010 sio.custom_divisor = port->custom_divisor;
1013 /* If you want you can override these. */
1014 sio.type = PORT_UNKNOWN;
1015 sio.xmit_fifo_size = -1;
1020 if (port->rd->getserial)
1021 port->rd->getserial (port, &sio);
1023 if (copy_to_user(sp, &sio, sizeof(struct serial_struct)))
1030 void gs_got_break(struct gs_port *port)
1032 if (port->flags & ASYNC_SAK) {
1035 *(port->tty->flip.flag_buf_ptr) = TTY_BREAK;
1036 port->tty->flip.flag_buf_ptr++;
1037 port->tty->flip.char_buf_ptr++;
1038 port->tty->flip.count++;
1042 EXPORT_SYMBOL(gs_put_char);
1043 EXPORT_SYMBOL(gs_write);
1044 EXPORT_SYMBOL(gs_write_room);
1045 EXPORT_SYMBOL(gs_chars_in_buffer);
1046 EXPORT_SYMBOL(gs_flush_buffer);
1047 EXPORT_SYMBOL(gs_flush_chars);
1048 EXPORT_SYMBOL(gs_stop);
1049 EXPORT_SYMBOL(gs_start);
1050 EXPORT_SYMBOL(gs_hangup);
1051 EXPORT_SYMBOL(gs_do_softint);
1052 EXPORT_SYMBOL(gs_block_til_ready);
1053 EXPORT_SYMBOL(gs_close);
1054 EXPORT_SYMBOL(gs_set_termios);
1055 EXPORT_SYMBOL(gs_init_port);
1056 EXPORT_SYMBOL(gs_setserial);
1057 EXPORT_SYMBOL(gs_getserial);
1058 EXPORT_SYMBOL(gs_got_break);
1060 MODULE_LICENSE("GPL");