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 <linux/tty_flip.h>
30 #include <linux/delay.h>
31 #include <asm/semaphore.h>
32 #include <asm/uaccess.h>
36 static char * tmp_buf;
37 static DECLARE_MUTEX(tmp_buf_sem);
42 #define gs_dprintk(f, str...) if (gs_debug & f) printk (str)
44 #define gs_dprintk(f, str...) /* nothing */
47 #define func_enter() gs_dprintk (GS_DEBUG_FLOW, "gs: enter %s\n", __FUNCTION__)
48 #define func_exit() gs_dprintk (GS_DEBUG_FLOW, "gs: exit %s\n", __FUNCTION__)
49 #define NEW_WRITE_LOCKING 1
51 #define DECL /* Nothing */
52 #define LOCKIT down (& port->port_write_sem);
53 #define RELEASEIT up (&port->port_write_sem);
55 #define DECL unsigned long flags;
56 #define LOCKIT save_flags (flags);cli ()
57 #define RELEASEIT restore_flags (flags)
60 #define RS_EVENT_WRITE_WAKEUP 1
62 module_param(gs_debug, int, 0644);
65 void gs_put_char(struct tty_struct * tty, unsigned char ch)
74 port = tty->driver_data;
78 if (! (port->flags & ASYNC_INITIALIZED)) return;
80 /* Take a lock on the serial tranmit buffer! */
83 if (port->xmit_cnt >= SERIAL_XMIT_SIZE - 1) {
84 /* Sorry, buffer is full, drop character. Update statistics???? -- REW */
89 port->xmit_buf[port->xmit_head++] = ch;
90 port->xmit_head &= SERIAL_XMIT_SIZE - 1;
91 port->xmit_cnt++; /* Characters in buffer */
98 #ifdef NEW_WRITE_LOCKING
101 > Problems to take into account are:
102 > -1- Interrupts that empty part of the buffer.
103 > -2- page faults on the access to userspace.
104 > -3- Other processes that are also trying to do a "write".
107 int gs_write(struct tty_struct * tty,
108 const unsigned char *buf, int count)
110 struct gs_port *port;
118 port = tty->driver_data;
122 if (! (port->flags & ASYNC_INITIALIZED))
125 /* get exclusive "write" access to this port (problem 3) */
126 /* This is not a spinlock because we can have a disk access (page
127 fault) in copy_from_user */
128 down (& port->port_write_sem);
134 /* This is safe because we "OWN" the "head". Noone else can
135 change the "head": we own the port_write_sem. */
136 /* Don't overrun the end of the buffer */
137 t = SERIAL_XMIT_SIZE - port->xmit_head;
140 /* This is safe because the xmit_cnt can only decrease. This
141 would increase "t", so we might copy too little chars. */
142 /* Don't copy past the "head" of the buffer */
143 t = SERIAL_XMIT_SIZE - 1 - port->xmit_cnt;
146 /* Can't copy more? break out! */
149 memcpy (port->xmit_buf + port->xmit_head, buf, c);
151 port -> xmit_cnt += c;
152 port -> xmit_head = (port->xmit_head + c) & (SERIAL_XMIT_SIZE -1);
157 up (& port->port_write_sem);
159 gs_dprintk (GS_DEBUG_WRITE, "write: interrupts are %s\n",
160 (port->flags & GS_TX_INTEN)?"enabled": "disabled");
162 if (port->xmit_cnt &&
165 !(port->flags & GS_TX_INTEN)) {
166 port->flags |= GS_TX_INTEN;
167 port->rd->enable_tx_interrupts (port);
174 > Problems to take into account are:
175 > -1- Interrupts that empty part of the buffer.
176 > -2- page faults on the access to userspace.
177 > -3- Other processes that are also trying to do a "write".
180 int gs_write(struct tty_struct * tty,
181 const unsigned char *buf, int count)
183 struct gs_port *port;
190 /* The standard serial driver returns 0 in this case.
191 That sounds to me as "No error, I just didn't get to writing any
192 bytes. Feel free to try again."
193 The "official" way to write n bytes from buf is:
195 for (nwritten = 0;nwritten < n;nwritten += rv) {
196 rv = write (fd, buf+nwritten, n-nwritten);
197 if (rv < 0) break; // Error: bail out. //
200 which will loop endlessly in this case. The manual page for write
201 agrees with me. In practise almost everybody writes
202 "write (fd, buf,n);" but some people might have had to deal with
203 incomplete writes in the past and correctly implemented it by now...
206 if (!tty) return -EIO;
208 port = tty->driver_data;
209 if (!port || !port->xmit_buf || !tmp_buf)
212 local_save_flags(flags);
217 /* This is safe because we "OWN" the "head". Noone else can
218 change the "head": we own the port_write_sem. */
219 /* Don't overrun the end of the buffer */
220 t = SERIAL_XMIT_SIZE - port->xmit_head;
223 /* This is safe because the xmit_cnt can only decrease. This
224 would increase "t", so we might copy too little chars. */
225 /* Don't copy past the "head" of the buffer */
226 t = SERIAL_XMIT_SIZE - 1 - port->xmit_cnt;
229 /* Can't copy more? break out! */
231 local_restore_flags(flags);
234 memcpy(port->xmit_buf + port->xmit_head, buf, c);
235 port->xmit_head = ((port->xmit_head + c) &
236 (SERIAL_XMIT_SIZE-1));
238 local_restore_flags(flags);
244 if (port->xmit_cnt &&
247 !(port->flags & GS_TX_INTEN)) {
248 port->flags |= GS_TX_INTEN;
249 port->rd->enable_tx_interrupts (port);
259 int gs_write_room(struct tty_struct * tty)
261 struct gs_port *port = tty->driver_data;
265 ret = SERIAL_XMIT_SIZE - port->xmit_cnt - 1;
273 int gs_chars_in_buffer(struct tty_struct *tty)
275 struct gs_port *port = tty->driver_data;
279 return port->xmit_cnt;
283 static int gs_real_chars_in_buffer(struct tty_struct *tty)
285 struct gs_port *port;
289 port = tty->driver_data;
291 if (!port->rd) return 0;
292 if (!port->rd->chars_in_buffer) return 0;
295 return port->xmit_cnt + port->rd->chars_in_buffer (port);
299 static int gs_wait_tx_flushed (void * ptr, unsigned long timeout)
301 struct gs_port *port = ptr;
302 unsigned long end_jiffies;
303 int jiffies_to_transmit, charsleft = 0, rv = 0;
308 gs_dprintk (GS_DEBUG_FLUSH, "port=%p.\n", port);
310 gs_dprintk (GS_DEBUG_FLUSH, "xmit_cnt=%x, xmit_buf=%p, tty=%p.\n",
311 port->xmit_cnt, port->xmit_buf, port->tty);
314 if (!port || port->xmit_cnt < 0 || !port->xmit_buf) {
315 gs_dprintk (GS_DEBUG_FLUSH, "ERROR: !port, !port->xmit_buf or prot->xmit_cnt < 0.\n");
317 return -EINVAL; /* This is an error which we don't know how to handle. */
320 rcib = gs_real_chars_in_buffer(port->tty);
323 gs_dprintk (GS_DEBUG_FLUSH, "nothing to wait for.\n");
327 /* stop trying: now + twice the time it would normally take + seconds */
328 if (timeout == 0) timeout = MAX_SCHEDULE_TIMEOUT;
329 end_jiffies = jiffies;
330 if (timeout != MAX_SCHEDULE_TIMEOUT)
331 end_jiffies += port->baud?(2 * rcib * 10 * HZ / port->baud):0;
332 end_jiffies += timeout;
334 gs_dprintk (GS_DEBUG_FLUSH, "now=%lx, end=%lx (%ld).\n",
335 jiffies, end_jiffies, end_jiffies-jiffies);
337 /* the expression is actually jiffies < end_jiffies, but that won't
338 work around the wraparound. Tricky eh? */
339 while ((charsleft = gs_real_chars_in_buffer (port->tty)) &&
340 time_after (end_jiffies, jiffies)) {
342 chars * (bits/char) * (jiffies /sec) / (bits/sec) = jiffies!
345 charsleft += 16; /* Allow 16 chars more to be transmitted ... */
346 jiffies_to_transmit = port->baud?(1 + charsleft * 10 * HZ / port->baud):0;
347 /* ^^^ Round up.... */
348 if (jiffies_to_transmit <= 0) jiffies_to_transmit = 1;
350 gs_dprintk (GS_DEBUG_FLUSH, "Expect to finish in %d jiffies "
351 "(%d chars).\n", jiffies_to_transmit, charsleft);
353 msleep_interruptible(jiffies_to_msecs(jiffies_to_transmit));
354 if (signal_pending (current)) {
355 gs_dprintk (GS_DEBUG_FLUSH, "Signal pending. Bombing out: ");
361 gs_dprintk (GS_DEBUG_FLUSH, "charsleft = %d.\n", charsleft);
362 set_current_state (TASK_RUNNING);
370 void gs_flush_buffer(struct tty_struct *tty)
372 struct gs_port *port;
379 port = tty->driver_data;
383 /* XXX Would the write semaphore do? */
384 spin_lock_irqsave (&port->driver_lock, flags);
385 port->xmit_cnt = port->xmit_head = port->xmit_tail = 0;
386 spin_unlock_irqrestore (&port->driver_lock, flags);
388 wake_up_interruptible(&tty->write_wait);
394 void gs_flush_chars(struct tty_struct * tty)
396 struct gs_port *port;
402 port = tty->driver_data;
406 if (port->xmit_cnt <= 0 || tty->stopped || tty->hw_stopped ||
412 /* Beats me -- REW */
413 port->flags |= GS_TX_INTEN;
414 port->rd->enable_tx_interrupts (port);
419 void gs_stop(struct tty_struct * tty)
421 struct gs_port *port;
427 port = tty->driver_data;
431 if (port->xmit_cnt &&
433 (port->flags & GS_TX_INTEN) ) {
434 port->flags &= ~GS_TX_INTEN;
435 port->rd->disable_tx_interrupts (port);
441 void gs_start(struct tty_struct * tty)
443 struct gs_port *port;
447 port = tty->driver_data;
451 if (port->xmit_cnt &&
453 !(port->flags & GS_TX_INTEN) ) {
454 port->flags |= GS_TX_INTEN;
455 port->rd->enable_tx_interrupts (port);
461 static void gs_shutdown_port (struct gs_port *port)
469 if (!(port->flags & ASYNC_INITIALIZED))
472 spin_lock_irqsave(&port->driver_lock, flags);
474 if (port->xmit_buf) {
475 free_page((unsigned long) port->xmit_buf);
476 port->xmit_buf = NULL;
480 set_bit(TTY_IO_ERROR, &port->tty->flags);
482 port->rd->shutdown_port (port);
484 port->flags &= ~ASYNC_INITIALIZED;
485 spin_unlock_irqrestore(&port->driver_lock, flags);
491 void gs_hangup(struct tty_struct *tty)
493 struct gs_port *port;
499 port = tty->driver_data;
504 gs_shutdown_port (port);
505 port->flags &= ~(ASYNC_NORMAL_ACTIVE|GS_ACTIVE);
509 wake_up_interruptible(&port->open_wait);
514 int gs_block_til_ready(void *port_, struct file * filp)
516 struct gs_port *port = port_;
517 DECLARE_WAITQUEUE(wait, current);
521 struct tty_struct *tty;
532 gs_dprintk (GS_DEBUG_BTR, "Entering gs_block_till_ready.\n");
534 * If the device is in the middle of being closed, then block
535 * until it's done, and then try again.
537 if (tty_hung_up_p(filp) || port->flags & ASYNC_CLOSING) {
538 interruptible_sleep_on(&port->close_wait);
539 if (port->flags & ASYNC_HUP_NOTIFY)
545 gs_dprintk (GS_DEBUG_BTR, "after hung up\n");
548 * If non-blocking mode is set, or the port is not enabled,
549 * then make the check up front and then exit.
551 if ((filp->f_flags & O_NONBLOCK) ||
552 (tty->flags & (1 << TTY_IO_ERROR))) {
553 port->flags |= ASYNC_NORMAL_ACTIVE;
557 gs_dprintk (GS_DEBUG_BTR, "after nonblock\n");
563 * Block waiting for the carrier detect and the line to become
564 * free (i.e., not in use by the callout). While we are in
565 * this loop, port->count is dropped by one, so that
566 * rs_close() knows when to free things. We restore it upon
567 * exit, either normal or abnormal.
571 add_wait_queue(&port->open_wait, &wait);
573 gs_dprintk (GS_DEBUG_BTR, "after add waitq.\n");
574 spin_lock_irqsave(&port->driver_lock, flags);
575 if (!tty_hung_up_p(filp)) {
578 spin_unlock_irqrestore(&port->driver_lock, flags);
579 port->blocked_open++;
581 CD = port->rd->get_CD (port);
582 gs_dprintk (GS_DEBUG_BTR, "CD is now %d.\n", CD);
583 set_current_state (TASK_INTERRUPTIBLE);
584 if (tty_hung_up_p(filp) ||
585 !(port->flags & ASYNC_INITIALIZED)) {
586 if (port->flags & ASYNC_HUP_NOTIFY)
589 retval = -ERESTARTSYS;
592 if (!(port->flags & ASYNC_CLOSING) &&
595 gs_dprintk (GS_DEBUG_BTR, "signal_pending is now: %d (%lx)\n",
596 (int)signal_pending (current), *(long*)(¤t->blocked));
597 if (signal_pending(current)) {
598 retval = -ERESTARTSYS;
603 gs_dprintk (GS_DEBUG_BTR, "Got out of the loop. (%d)\n",
605 set_current_state (TASK_RUNNING);
606 remove_wait_queue(&port->open_wait, &wait);
607 if (!tty_hung_up_p(filp)) {
610 port->blocked_open--;
614 port->flags |= ASYNC_NORMAL_ACTIVE;
620 void gs_close(struct tty_struct * tty, struct file * filp)
623 struct gs_port *port;
629 port = (struct gs_port *) tty->driver_data;
634 /* This seems to happen when this is called from vhangup. */
635 gs_dprintk (GS_DEBUG_CLOSE, "gs: Odd: port->tty is NULL\n");
639 spin_lock_irqsave(&port->driver_lock, flags);
641 if (tty_hung_up_p(filp)) {
642 spin_unlock_irqrestore(&port->driver_lock, flags);
643 if (port->rd->hungup)
644 port->rd->hungup (port);
649 if ((tty->count == 1) && (port->count != 1)) {
650 printk(KERN_ERR "gs: gs_close port %p: bad port count;"
651 " tty->count is 1, port count is %d\n", port, port->count);
654 if (--port->count < 0) {
655 printk(KERN_ERR "gs: gs_close port %p: bad port count: %d\n", port, port->count);
660 gs_dprintk(GS_DEBUG_CLOSE, "gs_close port %p: count: %d\n", port, port->count);
661 spin_unlock_irqrestore(&port->driver_lock, flags);
665 port->flags |= ASYNC_CLOSING;
668 * Now we wait for the transmit buffer to clear; and we notify
669 * the line discipline to only process XON/XOFF characters.
672 /* if (port->closing_wait != ASYNC_CLOSING_WAIT_NONE)
673 tty_wait_until_sent(tty, port->closing_wait); */
676 * At this point we stop accepting input. To do this, we
677 * disable the receive line status interrupts, and tell the
678 * interrupt driver to stop checking the data ready bit in the
679 * line status register.
682 port->rd->disable_rx_interrupts (port);
683 spin_unlock_irqrestore(&port->driver_lock, flags);
685 /* close has no way of returning "EINTR", so discard return value */
686 if (port->closing_wait != ASYNC_CLOSING_WAIT_NONE)
687 gs_wait_tx_flushed (port, port->closing_wait);
689 port->flags &= ~GS_ACTIVE;
691 if (tty->driver->flush_buffer)
692 tty->driver->flush_buffer(tty);
694 tty_ldisc_flush(tty);
698 port->rd->close (port);
699 port->rd->shutdown_port (port);
702 if (port->blocked_open) {
703 if (port->close_delay) {
704 spin_unlock_irqrestore(&port->driver_lock, flags);
705 msleep_interruptible(jiffies_to_msecs(port->close_delay));
706 spin_lock_irqsave(&port->driver_lock, flags);
708 wake_up_interruptible(&port->open_wait);
710 port->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING | ASYNC_INITIALIZED);
711 wake_up_interruptible(&port->close_wait);
717 static unsigned int gs_baudrates[] = {
718 0, 50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800,
719 9600, 19200, 38400, 57600, 115200, 230400, 460800, 921600
723 void gs_set_termios (struct tty_struct * tty,
724 struct termios * old_termios)
726 struct gs_port *port;
727 int baudrate, tmp, rv;
728 struct termios *tiosp;
734 port = tty->driver_data;
738 /* This seems to happen when this is called after gs_close. */
739 gs_dprintk (GS_DEBUG_TERMIOS, "gs: Odd: port->tty is NULL\n");
744 tiosp = tty->termios;
746 if (gs_debug & GS_DEBUG_TERMIOS) {
747 gs_dprintk (GS_DEBUG_TERMIOS, "termios structure (%p):\n", tiosp);
751 /* This is an optimization that is only allowed for dumb cards */
752 /* Smart cards require knowledge of iflags and oflags too: that
753 might change hardware cooking mode.... */
756 if( (tiosp->c_iflag == old_termios->c_iflag)
757 && (tiosp->c_oflag == old_termios->c_oflag)
758 && (tiosp->c_cflag == old_termios->c_cflag)
759 && (tiosp->c_lflag == old_termios->c_lflag)
760 && (tiosp->c_line == old_termios->c_line)
761 && (memcmp(tiosp->c_cc, old_termios->c_cc, NCC) == 0)) {
762 gs_dprintk(GS_DEBUG_TERMIOS, "gs_set_termios: optimized away\n");
766 gs_dprintk(GS_DEBUG_TERMIOS, "gs_set_termios: no old_termios: "
767 "no optimization\n");
769 if(old_termios && (gs_debug & GS_DEBUG_TERMIOS)) {
770 if(tiosp->c_iflag != old_termios->c_iflag) printk("c_iflag changed\n");
771 if(tiosp->c_oflag != old_termios->c_oflag) printk("c_oflag changed\n");
772 if(tiosp->c_cflag != old_termios->c_cflag) printk("c_cflag changed\n");
773 if(tiosp->c_lflag != old_termios->c_lflag) printk("c_lflag changed\n");
774 if(tiosp->c_line != old_termios->c_line) printk("c_line changed\n");
775 if(!memcmp(tiosp->c_cc, old_termios->c_cc, NCC)) printk("c_cc changed\n");
778 baudrate = tiosp->c_cflag & CBAUD;
779 if (baudrate & CBAUDEX) {
780 baudrate &= ~CBAUDEX;
781 if ((baudrate < 1) || (baudrate > 4))
782 tiosp->c_cflag &= ~CBAUDEX;
787 baudrate = gs_baudrates[baudrate];
788 if ((tiosp->c_cflag & CBAUD) == B38400) {
789 if ( (port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI)
791 else if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI)
793 else if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI)
795 else if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP)
797 else if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST)
798 baudrate = (port->baud_base / port->custom_divisor);
801 /* I recommend using THIS instead of the mess in termios (and
802 duplicating the above code). Next we should create a clean
803 interface towards this variable. If your card supports arbitrary
804 baud rates, (e.g. CD1400 or 16550 based cards) then everything
805 will be very easy..... */
806 port->baud = baudrate;
808 /* Two timer ticks seems enough to wakeup something like SLIP driver */
809 /* Baudrate/10 is cps. Divide by HZ to get chars per tick. */
810 tmp = (baudrate / 10 / HZ) * 2;
812 if (tmp < 0) tmp = 0;
813 if (tmp >= SERIAL_XMIT_SIZE) tmp = SERIAL_XMIT_SIZE-1;
815 port->wakeup_chars = tmp;
817 /* We should really wait for the characters to be all sent before
818 changing the settings. -- CAL */
819 rv = gs_wait_tx_flushed (port, MAX_SCHEDULE_TIMEOUT);
820 if (rv < 0) return /* rv */;
822 rv = port->rd->set_real_termios(port);
823 if (rv < 0) return /* rv */;
826 (old_termios->c_cflag & CRTSCTS)) &&
827 !( tiosp->c_cflag & CRTSCTS)) {
832 #ifdef tytso_patch_94Nov25_1726
833 /* This "makes sense", Why is it commented out? */
835 if (!(old_termios->c_cflag & CLOCAL) &&
836 (tty->termios->c_cflag & CLOCAL))
837 wake_up_interruptible(&port->gs.open_wait);
846 /* Must be called with interrupts enabled */
847 int gs_init_port(struct gs_port *port)
855 page = get_zeroed_page(GFP_KERNEL);
856 spin_lock_irqsave (&port->driver_lock, flags); /* Don't expect this to make a difference. */
860 tmp_buf = (unsigned char *) page;
861 spin_unlock_irqrestore (&port->driver_lock, flags);
868 if (port->flags & ASYNC_INITIALIZED) {
872 if (!port->xmit_buf) {
873 /* We may sleep in get_zeroed_page() */
876 tmp = get_zeroed_page(GFP_KERNEL);
877 spin_lock_irqsave (&port->driver_lock, flags);
881 port->xmit_buf = (unsigned char *) tmp;
882 spin_unlock_irqrestore(&port->driver_lock, flags);
883 if (!port->xmit_buf) {
889 spin_lock_irqsave (&port->driver_lock, flags);
891 clear_bit(TTY_IO_ERROR, &port->tty->flags);
892 init_MUTEX(&port->port_write_sem);
893 port->xmit_cnt = port->xmit_head = port->xmit_tail = 0;
894 spin_unlock_irqrestore(&port->driver_lock, flags);
895 gs_set_termios(port->tty, NULL);
896 spin_lock_irqsave (&port->driver_lock, flags);
897 port->flags |= ASYNC_INITIALIZED;
898 port->flags &= ~GS_TX_INTEN;
900 spin_unlock_irqrestore(&port->driver_lock, flags);
906 int gs_setserial(struct gs_port *port, struct serial_struct __user *sp)
908 struct serial_struct sio;
910 if (copy_from_user(&sio, sp, sizeof(struct serial_struct)))
913 if (!capable(CAP_SYS_ADMIN)) {
914 if ((sio.baud_base != port->baud_base) ||
915 (sio.close_delay != port->close_delay) ||
916 ((sio.flags & ~ASYNC_USR_MASK) !=
917 (port->flags & ~ASYNC_USR_MASK)))
921 port->flags = (port->flags & ~ASYNC_USR_MASK) |
922 (sio.flags & ASYNC_USR_MASK);
924 port->baud_base = sio.baud_base;
925 port->close_delay = sio.close_delay;
926 port->closing_wait = sio.closing_wait;
927 port->custom_divisor = sio.custom_divisor;
929 gs_set_termios (port->tty, NULL);
935 /*****************************************************************************/
938 * Generate the serial struct info.
941 int gs_getserial(struct gs_port *port, struct serial_struct __user *sp)
943 struct serial_struct sio;
945 memset(&sio, 0, sizeof(struct serial_struct));
946 sio.flags = port->flags;
947 sio.baud_base = port->baud_base;
948 sio.close_delay = port->close_delay;
949 sio.closing_wait = port->closing_wait;
950 sio.custom_divisor = port->custom_divisor;
953 /* If you want you can override these. */
954 sio.type = PORT_UNKNOWN;
955 sio.xmit_fifo_size = -1;
960 if (port->rd->getserial)
961 port->rd->getserial (port, &sio);
963 if (copy_to_user(sp, &sio, sizeof(struct serial_struct)))
970 void gs_got_break(struct gs_port *port)
974 tty_insert_flip_char(port->tty, 0, TTY_BREAK);
975 tty_schedule_flip(port->tty);
976 if (port->flags & ASYNC_SAK) {
984 EXPORT_SYMBOL(gs_put_char);
985 EXPORT_SYMBOL(gs_write);
986 EXPORT_SYMBOL(gs_write_room);
987 EXPORT_SYMBOL(gs_chars_in_buffer);
988 EXPORT_SYMBOL(gs_flush_buffer);
989 EXPORT_SYMBOL(gs_flush_chars);
990 EXPORT_SYMBOL(gs_stop);
991 EXPORT_SYMBOL(gs_start);
992 EXPORT_SYMBOL(gs_hangup);
993 EXPORT_SYMBOL(gs_block_til_ready);
994 EXPORT_SYMBOL(gs_close);
995 EXPORT_SYMBOL(gs_set_termios);
996 EXPORT_SYMBOL(gs_init_port);
997 EXPORT_SYMBOL(gs_setserial);
998 EXPORT_SYMBOL(gs_getserial);
999 EXPORT_SYMBOL(gs_got_break);
1001 MODULE_LICENSE("GPL");