Lines Matching refs:tty

366 static void tx_start(MGSLPC_INFO *info, struct tty_struct *tty);
402 static bool rx_get_frame(MGSLPC_INFO *info, struct tty_struct *tty);
413 static void bh_transmit(MGSLPC_INFO *info, struct tty_struct *tty);
419 static int tiocmget(struct tty_struct *tty);
420 static int tiocmset(struct tty_struct *tty,
424 static int set_params(MGSLPC_INFO *info, MGSL_PARAMS __user *new_params, struct tty_struct *tty);
427 static int set_txenable(MGSLPC_INFO *info, int enable, struct tty_struct *tty);
466 static void mgslpc_change_params(MGSLPC_INFO *info, struct tty_struct *tty);
467 static void mgslpc_wait_until_sent(struct tty_struct *tty, int timeout);
495 static void ldisc_receive_buf(struct tty_struct *tty, in ldisc_receive_buf() argument
499 if (!tty) in ldisc_receive_buf()
501 ld = tty_ldisc_ref(tty); in ldisc_receive_buf()
504 ld->ops->receive_buf(tty, data, flags, count); in ldisc_receive_buf()
704 static void tx_pause(struct tty_struct *tty) in tx_pause() argument
706 MGSLPC_INFO *info = (MGSLPC_INFO *)tty->driver_data; in tx_pause()
709 if (mgslpc_paranoia_check(info, tty->name, "tx_pause")) in tx_pause()
720 static void tx_release(struct tty_struct *tty) in tx_release() argument
722 MGSLPC_INFO *info = (MGSLPC_INFO *)tty->driver_data; in tx_release()
725 if (mgslpc_paranoia_check(info, tty->name, "tx_release")) in tx_release()
732 tx_start(info, tty); in tx_release()
771 struct tty_struct *tty; in bh_handler() local
779 tty = tty_port_tty_get(&info->port); in bh_handler()
791 while(rx_get_frame(info, tty)); in bh_handler()
794 bh_transmit(info, tty); in bh_handler()
806 tty_kref_put(tty); in bh_handler()
812 static void bh_transmit(MGSLPC_INFO *info, struct tty_struct *tty) in bh_transmit() argument
817 if (tty) in bh_transmit()
818 tty_wakeup(tty); in bh_transmit()
961 static void tx_done(MGSLPC_INFO *info, struct tty_struct *tty) in tx_done() argument
990 if (tty && (tty->stopped || tty->hw_stopped)) { in tx_done()
998 static void tx_ready(MGSLPC_INFO *info, struct tty_struct *tty) in tx_ready() argument
1010 if (tty && (tty->stopped || tty->hw_stopped)) { in tx_ready()
1047 static void cts_change(MGSLPC_INFO *info, struct tty_struct *tty) in cts_change() argument
1060 if (tty && tty_port_cts_enabled(&info->port)) { in cts_change()
1061 if (tty->hw_stopped) { in cts_change()
1065 tty->hw_stopped = 0; in cts_change()
1066 tx_start(info, tty); in cts_change()
1074 tty->hw_stopped = 1; in cts_change()
1082 static void dcd_change(MGSLPC_INFO *info, struct tty_struct *tty) in dcd_change() argument
1113 if (tty) in dcd_change()
1114 tty_hangup(tty); in dcd_change()
1160 struct tty_struct *tty; in mgslpc_isr() local
1171 tty = tty_port_tty_get(&info->port); in mgslpc_isr()
1188 dcd_change(info, tty); in mgslpc_isr()
1190 cts_change(info, tty); in mgslpc_isr()
1208 do_SAK(tty); in mgslpc_isr()
1226 tx_done(info, tty); in mgslpc_isr()
1230 tx_done(info, tty); in mgslpc_isr()
1233 tx_ready(info, tty); in mgslpc_isr()
1257 tty_kref_put(tty); in mgslpc_isr()
1268 static int startup(MGSLPC_INFO * info, struct tty_struct *tty) in startup() argument
1302 if (capable(CAP_SYS_ADMIN) && tty) in startup()
1303 set_bit(TTY_IO_ERROR, &tty->flags); in startup()
1309 mgslpc_change_params(info, tty); in startup()
1311 if (tty) in startup()
1312 clear_bit(TTY_IO_ERROR, &tty->flags); in startup()
1321 static void shutdown(MGSLPC_INFO * info, struct tty_struct *tty) in shutdown() argument
1352 if (!tty || tty->termios.c_cflag & HUPCL) { in shutdown()
1361 if (tty) in shutdown()
1362 set_bit(TTY_IO_ERROR, &tty->flags); in shutdown()
1367 static void mgslpc_program_hw(MGSLPC_INFO *info, struct tty_struct *tty) in mgslpc_program_hw() argument
1393 if (info->netcount || (tty && (tty->termios.c_cflag & CREAD))) in mgslpc_program_hw()
1401 static void mgslpc_change_params(MGSLPC_INFO *info, struct tty_struct *tty) in mgslpc_change_params() argument
1406 if (!tty) in mgslpc_change_params()
1413 cflag = tty->termios.c_cflag; in mgslpc_change_params()
1460 info->params.data_rate = tty_get_baud_rate(tty); in mgslpc_change_params()
1482 if (I_INPCK(tty)) in mgslpc_change_params()
1484 if (I_IGNPAR(tty)) in mgslpc_change_params()
1487 mgslpc_program_hw(info, tty); in mgslpc_change_params()
1492 static int mgslpc_put_char(struct tty_struct *tty, unsigned char ch) in mgslpc_put_char() argument
1494 MGSLPC_INFO *info = (MGSLPC_INFO *)tty->driver_data; in mgslpc_put_char()
1502 if (mgslpc_paranoia_check(info, tty->name, "mgslpc_put_char")) in mgslpc_put_char()
1525 static void mgslpc_flush_chars(struct tty_struct *tty) in mgslpc_flush_chars() argument
1527 MGSLPC_INFO *info = (MGSLPC_INFO *)tty->driver_data; in mgslpc_flush_chars()
1534 if (mgslpc_paranoia_check(info, tty->name, "mgslpc_flush_chars")) in mgslpc_flush_chars()
1537 if (info->tx_count <= 0 || tty->stopped || in mgslpc_flush_chars()
1538 tty->hw_stopped || !info->tx_buf) in mgslpc_flush_chars()
1547 tx_start(info, tty); in mgslpc_flush_chars()
1561 static int mgslpc_write(struct tty_struct * tty, in mgslpc_write() argument
1565 MGSLPC_INFO *info = (MGSLPC_INFO *)tty->driver_data; in mgslpc_write()
1572 if (mgslpc_paranoia_check(info, tty->name, "mgslpc_write") || in mgslpc_write()
1606 if (info->tx_count && !tty->stopped && !tty->hw_stopped) { in mgslpc_write()
1609 tx_start(info, tty); in mgslpc_write()
1621 static int mgslpc_write_room(struct tty_struct *tty) in mgslpc_write_room() argument
1623 MGSLPC_INFO *info = (MGSLPC_INFO *)tty->driver_data; in mgslpc_write_room()
1626 if (mgslpc_paranoia_check(info, tty->name, "mgslpc_write_room")) in mgslpc_write_room()
1649 static int mgslpc_chars_in_buffer(struct tty_struct *tty) in mgslpc_chars_in_buffer() argument
1651 MGSLPC_INFO *info = (MGSLPC_INFO *)tty->driver_data; in mgslpc_chars_in_buffer()
1658 if (mgslpc_paranoia_check(info, tty->name, "mgslpc_chars_in_buffer")) in mgslpc_chars_in_buffer()
1675 static void mgslpc_flush_buffer(struct tty_struct *tty) in mgslpc_flush_buffer() argument
1677 MGSLPC_INFO *info = (MGSLPC_INFO *)tty->driver_data; in mgslpc_flush_buffer()
1684 if (mgslpc_paranoia_check(info, tty->name, "mgslpc_flush_buffer")) in mgslpc_flush_buffer()
1692 wake_up_interruptible(&tty->write_wait); in mgslpc_flush_buffer()
1693 tty_wakeup(tty); in mgslpc_flush_buffer()
1698 static void mgslpc_send_xchar(struct tty_struct *tty, char ch) in mgslpc_send_xchar() argument
1700 MGSLPC_INFO *info = (MGSLPC_INFO *)tty->driver_data; in mgslpc_send_xchar()
1707 if (mgslpc_paranoia_check(info, tty->name, "mgslpc_send_xchar")) in mgslpc_send_xchar()
1714 tx_start(info, tty); in mgslpc_send_xchar()
1721 static void mgslpc_throttle(struct tty_struct * tty) in mgslpc_throttle() argument
1723 MGSLPC_INFO *info = (MGSLPC_INFO *)tty->driver_data; in mgslpc_throttle()
1730 if (mgslpc_paranoia_check(info, tty->name, "mgslpc_throttle")) in mgslpc_throttle()
1733 if (I_IXOFF(tty)) in mgslpc_throttle()
1734 mgslpc_send_xchar(tty, STOP_CHAR(tty)); in mgslpc_throttle()
1736 if (tty->termios.c_cflag & CRTSCTS) { in mgslpc_throttle()
1746 static void mgslpc_unthrottle(struct tty_struct * tty) in mgslpc_unthrottle() argument
1748 MGSLPC_INFO *info = (MGSLPC_INFO *)tty->driver_data; in mgslpc_unthrottle()
1755 if (mgslpc_paranoia_check(info, tty->name, "mgslpc_unthrottle")) in mgslpc_unthrottle()
1758 if (I_IXOFF(tty)) { in mgslpc_unthrottle()
1762 mgslpc_send_xchar(tty, START_CHAR(tty)); in mgslpc_unthrottle()
1765 if (tty->termios.c_cflag & CRTSCTS) { in mgslpc_unthrottle()
1812 static int set_params(MGSLPC_INFO * info, MGSL_PARAMS __user *new_params, struct tty_struct *tty) in set_params() argument
1833 mgslpc_change_params(info, tty); in set_params()
1894 static int set_txenable(MGSLPC_INFO * info, int enable, struct tty_struct *tty) in set_txenable() argument
1904 tx_start(info, tty); in set_txenable()
2121 static int tiocmget(struct tty_struct *tty) in tiocmget() argument
2123 MGSLPC_INFO *info = (MGSLPC_INFO *)tty->driver_data; in tiocmget()
2146 static int tiocmset(struct tty_struct *tty, in tiocmset() argument
2149 MGSLPC_INFO *info = (MGSLPC_INFO *)tty->driver_data; in tiocmset()
2177 static int mgslpc_break(struct tty_struct *tty, int break_state) in mgslpc_break() argument
2179 MGSLPC_INFO * info = (MGSLPC_INFO *)tty->driver_data; in mgslpc_break()
2186 if (mgslpc_paranoia_check(info, tty->name, "mgslpc_break")) in mgslpc_break()
2198 static int mgslpc_get_icount(struct tty_struct *tty, in mgslpc_get_icount() argument
2201 MGSLPC_INFO * info = (MGSLPC_INFO *)tty->driver_data; in mgslpc_get_icount()
2234 static int mgslpc_ioctl(struct tty_struct *tty, in mgslpc_ioctl() argument
2237 MGSLPC_INFO * info = (MGSLPC_INFO *)tty->driver_data; in mgslpc_ioctl()
2244 if (mgslpc_paranoia_check(info, tty->name, "mgslpc_ioctl")) in mgslpc_ioctl()
2249 if (tty->flags & (1 << TTY_IO_ERROR)) in mgslpc_ioctl()
2257 return set_params(info, argp, tty); in mgslpc_ioctl()
2267 return set_txenable(info,(int)arg, tty); in mgslpc_ioctl()
2291 static void mgslpc_set_termios(struct tty_struct *tty, struct ktermios *old_termios) in mgslpc_set_termios() argument
2293 MGSLPC_INFO *info = (MGSLPC_INFO *)tty->driver_data; in mgslpc_set_termios()
2298 tty->driver->name); in mgslpc_set_termios()
2301 if ((tty->termios.c_cflag == old_termios->c_cflag) in mgslpc_set_termios()
2302 && (RELEVANT_IFLAG(tty->termios.c_iflag) in mgslpc_set_termios()
2306 mgslpc_change_params(info, tty); in mgslpc_set_termios()
2310 !(tty->termios.c_cflag & CBAUD)) { in mgslpc_set_termios()
2319 tty->termios.c_cflag & CBAUD) { in mgslpc_set_termios()
2321 if (!(tty->termios.c_cflag & CRTSCTS) || in mgslpc_set_termios()
2322 !test_bit(TTY_THROTTLED, &tty->flags)) { in mgslpc_set_termios()
2332 !(tty->termios.c_cflag & CRTSCTS)) { in mgslpc_set_termios()
2333 tty->hw_stopped = 0; in mgslpc_set_termios()
2334 tx_release(tty); in mgslpc_set_termios()
2338 static void mgslpc_close(struct tty_struct *tty, struct file * filp) in mgslpc_close() argument
2340 MGSLPC_INFO * info = (MGSLPC_INFO *)tty->driver_data; in mgslpc_close()
2343 if (mgslpc_paranoia_check(info, tty->name, "mgslpc_close")) in mgslpc_close()
2350 if (tty_port_close_start(port, tty, filp) == 0) in mgslpc_close()
2354 mgslpc_wait_until_sent(tty, info->timeout); in mgslpc_close()
2356 mgslpc_flush_buffer(tty); in mgslpc_close()
2358 tty_ldisc_flush(tty); in mgslpc_close()
2359 shutdown(info, tty); in mgslpc_close()
2361 tty_port_close_end(port, tty); in mgslpc_close()
2366 tty->driver->name, port->count); in mgslpc_close()
2371 static void mgslpc_wait_until_sent(struct tty_struct *tty, int timeout) in mgslpc_wait_until_sent() argument
2373 MGSLPC_INFO * info = (MGSLPC_INFO *)tty->driver_data; in mgslpc_wait_until_sent()
2383 if (mgslpc_paranoia_check(info, tty->name, "mgslpc_wait_until_sent")) in mgslpc_wait_until_sent()
2435 static void mgslpc_hangup(struct tty_struct *tty) in mgslpc_hangup() argument
2437 MGSLPC_INFO * info = (MGSLPC_INFO *)tty->driver_data; in mgslpc_hangup()
2443 if (mgslpc_paranoia_check(info, tty->name, "mgslpc_hangup")) in mgslpc_hangup()
2446 mgslpc_flush_buffer(tty); in mgslpc_hangup()
2447 shutdown(info, tty); in mgslpc_hangup()
2480 static int mgslpc_open(struct tty_struct *tty, struct file * filp) in mgslpc_open() argument
2488 line = tty->index; in mgslpc_open()
2499 if (mgslpc_paranoia_check(info, tty->name, "mgslpc_open")) in mgslpc_open()
2503 tty->driver_data = info; in mgslpc_open()
2504 tty_port_tty_set(port, tty); in mgslpc_open()
2508 __FILE__, __LINE__, tty->driver->name, port->count); in mgslpc_open()
2512 wait_event_interruptible_tty(tty, port->close_wait, in mgslpc_open()
2534 retval = startup(info, tty); in mgslpc_open()
2539 retval = tty_port_block_til_ready(&info->port, tty, filp); in mgslpc_open()
3319 static void tx_start(MGSLPC_INFO *info, struct tty_struct *tty) in tx_start() argument
3343 tx_ready(info, tty); in tx_start()
3347 tx_ready(info, tty); in tx_start()
3668 static bool rx_get_frame(MGSLPC_INFO *info, struct tty_struct *tty) in rx_get_frame() argument
3737 ldisc_receive_buf(tty, buf->data, info->flag_buf, framesize); in rx_get_frame()
3894 struct tty_struct *tty = tty_port_tty_get(&info->port); in tx_timeout() local
3895 bh_transmit(info, tty); in tx_timeout()
3896 tty_kref_put(tty); in tx_timeout()
3916 struct tty_struct *tty; in hdlcdev_attach() local
3947 tty = tty_port_tty_get(&info->port); in hdlcdev_attach()
3948 mgslpc_program_hw(info, tty); in hdlcdev_attach()
3949 tty_kref_put(tty); in hdlcdev_attach()
3991 struct tty_struct *tty = tty_port_tty_get(&info->port); in hdlcdev_xmit() local
3992 tx_start(info, tty); in hdlcdev_xmit()
3993 tty_kref_put(tty); in hdlcdev_xmit()
4011 struct tty_struct *tty; in hdlcdev_open() local
4033 tty = tty_port_tty_get(&info->port); in hdlcdev_open()
4035 rc = startup(info, tty); in hdlcdev_open()
4037 tty_kref_put(tty); in hdlcdev_open()
4045 mgslpc_program_hw(info, tty); in hdlcdev_open()
4046 tty_kref_put(tty); in hdlcdev_open()
4074 struct tty_struct *tty = tty_port_tty_get(&info->port); in hdlcdev_close() local
4083 shutdown(info, tty); in hdlcdev_close()
4084 tty_kref_put(tty); in hdlcdev_close()
4191 struct tty_struct *tty = tty_port_tty_get(&info->port); in hdlcdev_ioctl() local
4192 mgslpc_program_hw(info, tty); in hdlcdev_ioctl()
4193 tty_kref_put(tty); in hdlcdev_ioctl()