diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2020-03-31 16:18:55 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2020-03-31 16:18:55 -0700 |
commit | 1f944f976d7ef8a29d1ad296253d3a9387c58e62 (patch) | |
tree | 454ef4a50ea47c054171cdde6fdc5eb767ab6d4b /drivers/tty | |
parent | dfabb077d62552797ca0ae7756cb30d3e195ead5 (diff) | |
parent | 8d5b305484e8a3216eeb700ed6c6de870306adbd (diff) |
Merge tag 'tty-5.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty
Pull tty/serial updates from Greg KH:
"Here is the big set of TTY / Serial patches for 5.7-rc1
Lots of console fixups and reworking in here, serial core tweaks
(doesn't that ever get old, why are we still creating new serial
devices?), serial driver updates, line-protocol driver updates, and
some vt cleanups and fixes included in here as well.
All have been in linux-next with no reported issues"
* tag 'tty-5.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty: (161 commits)
serial: 8250: Optimize irq enable after console write
serial: 8250: Fix rs485 delay after console write
vt: vt_ioctl: fix use-after-free in vt_in_use()
vt: vt_ioctl: fix VT_DISALLOCATE freeing in-use virtual console
tty: serial: make SERIAL_SPRD depend on COMMON_CLK
tty: serial: fsl_lpuart: fix return value checking
tty: serial: fsl_lpuart: move dma_request_chan()
ARM: dts: tango4: Make /serial compatible with ns16550a
ARM: dts: mmp*: Make the serial ports compatible with xscale-uart
ARM: dts: mmp*: Fix serial port names
ARM: dts: mmp2-brownstone: Don't redeclare phandle references
ARM: dts: pxa*: Make the serial ports compatible with xscale-uart
ARM: dts: pxa*: Fix serial port names
ARM: dts: pxa*: Don't redeclare phandle references
serial: omap: drop unused dt-bindings header
serial: 8250: 8250_omap: Add DMA support for UARTs on K3 SoCs
serial: 8250: 8250_omap: Work around errata causing spurious IRQs with DMA
serial: 8250: 8250_omap: Extend driver data to pass FIFO trigger info
serial: 8250: 8250_omap: Move locking out from __dma_rx_do_complete()
serial: 8250: 8250_omap: Account for data in flight during DMA teardown
...
Diffstat (limited to 'drivers/tty')
56 files changed, 1998 insertions, 1352 deletions
diff --git a/drivers/tty/hvc/hvc_console.h b/drivers/tty/hvc/hvc_console.h index e9319954c832..18d005814e4b 100644 --- a/drivers/tty/hvc/hvc_console.h +++ b/drivers/tty/hvc/hvc_console.h @@ -1,4 +1,4 @@ -// SPDX-License-Identifier: GPL-2.0+ +/* SPDX-License-Identifier: GPL-2.0+ */ /* * hvc_console.h * Copyright (C) 2005 IBM Corporation diff --git a/drivers/tty/mips_ejtag_fdc.c b/drivers/tty/mips_ejtag_fdc.c index 620d8488b83e..21e76a2ec182 100644 --- a/drivers/tty/mips_ejtag_fdc.c +++ b/drivers/tty/mips_ejtag_fdc.c @@ -243,6 +243,7 @@ done: /* Fall back to a 3 byte encoding */ word.bytes = 3; word.word &= 0x00ffffff; + /* Fall through */ case 3: /* 3 byte encoding */ word.word |= 0x82000000; diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c index f1c90fa2978e..d77ed82a4840 100644 --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c @@ -97,7 +97,19 @@ struct gsm_msg { u8 ctrl; /* Control byte + flags */ unsigned int len; /* Length of data block (can be zero) */ unsigned char *data; /* Points into buffer but not at the start */ - unsigned char buffer[0]; + unsigned char buffer[]; +}; + +enum gsm_dlci_state { + DLCI_CLOSED, + DLCI_OPENING, /* Sending SABM not seen UA */ + DLCI_OPEN, /* SABM/UA complete */ + DLCI_CLOSING, /* Sending DISC not seen UA/DM */ +}; + +enum gsm_dlci_mode { + DLCI_MODE_ABM, /* Normal Asynchronous Balanced Mode */ + DLCI_MODE_ADM, /* Asynchronous Disconnected Mode */ }; /* @@ -113,32 +125,25 @@ struct gsm_msg { struct gsm_dlci { struct gsm_mux *gsm; int addr; - int state; -#define DLCI_CLOSED 0 -#define DLCI_OPENING 1 /* Sending SABM not seen UA */ -#define DLCI_OPEN 2 /* SABM/UA complete */ -#define DLCI_CLOSING 3 /* Sending DISC not seen UA/DM */ + enum gsm_dlci_state state; struct mutex mutex; /* Link layer */ - int mode; -#define DLCI_MODE_ABM 0 /* Normal Asynchronous Balanced Mode */ -#define DLCI_MODE_ADM 1 /* Asynchronous Disconnected Mode */ + enum gsm_dlci_mode mode; spinlock_t lock; /* Protects the internal state */ struct timer_list t1; /* Retransmit timer for SABM and UA */ int retries; /* Uplink tty if active */ struct tty_port port; /* The tty bound to this DLCI if there is one */ - struct kfifo *fifo; /* Queue fifo for the DLCI */ - struct kfifo _fifo; /* For new fifo API porting only */ + struct kfifo fifo; /* Queue fifo for the DLCI */ int adaption; /* Adaption layer in use */ int prev_adaption; u32 modem_rx; /* Our incoming virtual modem lines */ u32 modem_tx; /* Our outgoing modem lines */ - int dead; /* Refuse re-open */ + bool dead; /* Refuse re-open */ /* Flow control */ - int throttled; /* Private copy of throttle state */ - int constipated; /* Throttle status for outgoing */ + bool throttled; /* Private copy of throttle state */ + bool constipated; /* Throttle status for outgoing */ /* Packetised I/O */ struct sk_buff *skb; /* Frame being sent */ struct sk_buff_head skb_list; /* Queued frames */ @@ -168,6 +173,20 @@ struct gsm_control { int error; /* Error if any */ }; +enum gsm_mux_state { + GSM_SEARCH, + GSM_START, + GSM_ADDRESS, + GSM_CONTROL, + GSM_LEN, + GSM_DATA, + GSM_FCS, + GSM_OVERRUN, + GSM_LEN0, + GSM_LEN1, + GSM_SSOF, +}; + /* * Each GSM mux we have is represented by this structure. If we are * operating as an ldisc then we use this structure as our ldisc @@ -192,22 +211,11 @@ struct gsm_mux { /* Framing Layer */ unsigned char *buf; - int state; -#define GSM_SEARCH 0 -#define GSM_START 1 -#define GSM_ADDRESS 2 -#define GSM_CONTROL 3 -#define GSM_LEN 4 -#define GSM_DATA 5 -#define GSM_FCS 6 -#define GSM_OVERRUN 7 -#define GSM_LEN0 8 -#define GSM_LEN1 9 -#define GSM_SSOF 10 + enum gsm_mux_state state; unsigned int len; unsigned int address; unsigned int count; - int escape; + bool escape; int encoding; u8 control; u8 fcs; @@ -224,9 +232,9 @@ struct gsm_mux { unsigned int mru; unsigned int mtu; int initiator; /* Did we initiate connection */ - int dead; /* Has the mux been shut down */ + bool dead; /* Has the mux been shut down */ struct gsm_dlci *dlci[NUM_DLCI]; - int constipated; /* Asked by remote to shut up */ + bool constipated; /* Asked by remote to shut up */ spinlock_t tx_lock; unsigned int tx_bytes; /* TX data outstanding */ @@ -796,7 +804,7 @@ static int gsm_dlci_data_output(struct gsm_mux *gsm, struct gsm_dlci *dlci) total_size = 0; while (1) { - len = kfifo_len(dlci->fifo); + len = kfifo_len(&dlci->fifo); if (len == 0) return total_size; @@ -820,7 +828,7 @@ static int gsm_dlci_data_output(struct gsm_mux *gsm, struct gsm_dlci *dlci) *dp++ = gsm_encode_modem(dlci); break; } - WARN_ON(kfifo_out_locked(dlci->fifo, dp , len, &dlci->lock) != len); + WARN_ON(kfifo_out_locked(&dlci->fifo, dp , len, &dlci->lock) != len); __gsm_data_queue(dlci, msg); total_size += size; } @@ -1034,9 +1042,9 @@ static void gsm_process_modem(struct tty_struct *tty, struct gsm_dlci *dlci, fc = (modem & MDM_FC) || !(modem & MDM_RTR); if (fc && !dlci->constipated) { /* Need to throttle our output on this device */ - dlci->constipated = 1; + dlci->constipated = true; } else if (!fc && dlci->constipated) { - dlci->constipated = 0; + dlci->constipated = false; gsm_dlci_data_kick(dlci); } @@ -1199,8 +1207,8 @@ static void gsm_control_message(struct gsm_mux *gsm, unsigned int command, struct gsm_dlci *dlci = gsm->dlci[0]; /* Modem wishes to close down */ if (dlci) { - dlci->dead = 1; - gsm->dead = 1; + dlci->dead = true; + gsm->dead = true; gsm_dlci_begin_close(dlci); } } @@ -1211,7 +1219,7 @@ static void gsm_control_message(struct gsm_mux *gsm, unsigned int command, break; case CMD_FCON: /* Modem can accept data again */ - gsm->constipated = 0; + gsm->constipated = false; gsm_control_reply(gsm, CMD_FCON, NULL, 0); /* Kick the link in case it is idling */ spin_lock_irqsave(&gsm->tx_lock, flags); @@ -1220,7 +1228,7 @@ static void gsm_control_message(struct gsm_mux *gsm, unsigned int command, break; case CMD_FCOFF: /* Modem wants us to STFU */ - gsm->constipated = 1; + gsm->constipated = true; gsm_control_reply(gsm, CMD_FCOFF, NULL, 0); break; case CMD_MSC: @@ -1424,9 +1432,9 @@ static void gsm_dlci_close(struct gsm_dlci *dlci) dlci->state = DLCI_CLOSED; if (dlci->addr != 0) { tty_port_tty_hangup(&dlci->port, false); - kfifo_reset(dlci->fifo); + kfifo_reset(&dlci->fifo); } else - dlci->gsm->dead = 1; + dlci->gsm->dead = true; wake_up(&dlci->gsm->event); /* A DLCI 0 close is a MUX termination so we need to kick that back to userspace somehow */ @@ -1496,6 +1504,9 @@ static void gsm_dlci_t1(struct timer_list *t) } else gsm_dlci_close(dlci); break; + default: + pr_debug("%s: unhandled state: %d\n", __func__, dlci->state); + break; } } @@ -1645,8 +1656,7 @@ static struct gsm_dlci *gsm_dlci_alloc(struct gsm_mux *gsm, int addr) return NULL; spin_lock_init(&dlci->lock); mutex_init(&dlci->mutex); - dlci->fifo = &dlci->_fifo; - if (kfifo_alloc(&dlci->_fifo, 4096, GFP_KERNEL) < 0) { + if (kfifo_alloc(&dlci->fifo, 4096, GFP_KERNEL) < 0) { kfree(dlci); return NULL; } @@ -1681,7 +1691,7 @@ static void gsm_dlci_free(struct tty_port *port) del_timer_sync(&dlci->t1); dlci->gsm->dlci[dlci->addr] = NULL; - kfifo_free(dlci->fifo); + kfifo_free(&dlci->fifo); while ((dlci->skb = skb_dequeue(&dlci->skb_list))) dev_kfree_skb(dlci->skb); kfree(dlci); @@ -1810,6 +1820,10 @@ static void gsm_queue(struct gsm_mux *gsm) case DLCI_OPENING: gsm_dlci_open(dlci); break; + default: + pr_debug("%s: unhandled state: %d\n", __func__, + dlci->state); + break; } break; case DM: /* DM can be valid unsolicited */ @@ -1923,6 +1937,9 @@ static void gsm0_receive(struct gsm_mux *gsm, unsigned char c) break; } break; + default: + pr_debug("%s: unhandled state: %d\n", __func__, gsm->state); + break; } } @@ -1959,7 +1976,7 @@ static void gsm1_receive(struct gsm_mux *gsm, unsigned char c) } if (c == GSM1_ESCAPE) { - gsm->escape = 1; + gsm->escape = true; return; } @@ -1969,7 +1986,7 @@ static void gsm1_receive(struct gsm_mux *gsm, unsigned char c) if (gsm->escape) { c ^= GSM1_ESCAPE_BITS; - gsm->escape = 0; + gsm->escape = false; } switch (gsm->state) { case GSM_START: /* First byte after SOF */ @@ -1997,6 +2014,9 @@ static void gsm1_receive(struct gsm_mux *gsm, unsigned char c) break; case GSM_OVERRUN: /* Over-long - eg a dropped SOF */ break; + default: + pr_debug("%s: unhandled state: %d\n", __func__, gsm->state); + break; } } @@ -2061,7 +2081,7 @@ static void gsm_cleanup_mux(struct gsm_mux *gsm) struct gsm_dlci *dlci = gsm->dlci[0]; struct gsm_msg *txq, *ntxq; - gsm->dead = 1; + gsm->dead = true; spin_lock(&gsm_mux_lock); for (i = 0; i < MAX_MUX; i++) { @@ -2078,7 +2098,7 @@ static void gsm_cleanup_mux(struct gsm_mux *gsm) del_timer_sync(&gsm->t2_timer); /* Now we are sure T2 has stopped */ if (dlci) - dlci->dead = 1; + dlci->dead = true; /* Free up any link layer users */ mutex_lock(&gsm->mutex); @@ -2132,7 +2152,7 @@ static int gsm_activate_mux(struct gsm_mux *gsm) dlci = gsm_dlci_alloc(gsm, 0); if (dlci == NULL) return -ENOMEM; - gsm->dead = 0; /* Tty opens are now permissible */ + gsm->dead = false; /* Tty opens are now permissible */ return 0; } @@ -2216,7 +2236,7 @@ static struct gsm_mux *gsm_alloc_mux(void) gsm->encoding = 1; gsm->mru = 64; /* Default to encoding 1 so these should be 64 */ gsm->mtu = 64; - gsm->dead = 1; /* Avoid early tty opens */ + gsm->dead = true; /* Avoid early tty opens */ return gsm; } @@ -2618,11 +2638,11 @@ static int gsmld_ioctl(struct tty_struct *tty, struct file *file, switch (cmd) { case GSMIOC_GETCONF: gsm_copy_config_values(gsm, &c); - if (copy_to_user((void *)arg, &c, sizeof(c))) + if (copy_to_user((void __user *)arg, &c, sizeof(c))) return -EFAULT; return 0; case GSMIOC_SETCONF: - if (copy_from_user(&c, (void *)arg, sizeof(c))) + if (copy_from_user(&c, (void __user *)arg, sizeof(c))) return -EFAULT; return gsm_config(gsm, &c); case GSMIOC_GETFIRST: @@ -2769,7 +2789,7 @@ static void gsm_destroy_network(struct gsm_dlci *dlci) { struct gsm_mux_net *mux_net; - pr_debug("destroy network interface"); + pr_debug("destroy network interface\n"); if (!dlci->net) return; mux_net = netdev_priv(dlci->net); @@ -2798,7 +2818,7 @@ static int gsm_create_network(struct gsm_dlci *dlci, struct gsm_netconfig *nc) if (nc->adaption != 3 && nc->adaption != 4) return -EPROTONOSUPPORT; - pr_debug("create network interface"); + pr_debug("create network interface\n"); netname = "gsm%d"; if (nc->if_name[0] != '\0') @@ -2806,7 +2826,7 @@ static int gsm_create_network(struct gsm_dlci *dlci, struct gsm_netconfig *nc) net = alloc_netdev(sizeof(struct gsm_mux_net), netname, NET_NAME_UNKNOWN, gsm_mux_net_init); if (!net) { - pr_err("alloc_netdev failed"); + pr_err("alloc_netdev failed\n"); return -ENOMEM; } net->mtu = dlci->gsm->mtu; @@ -2824,7 +2844,7 @@ static int gsm_create_network(struct gsm_dlci *dlci, struct gsm_netconfig *nc) dlci->data = gsm_mux_rx_netchar; dlci->net = net; - pr_debug("register netdev"); + pr_debug("register netdev\n"); retval = register_netdev(net); if (retval) { pr_err("network register fail %d\n", retval); @@ -3030,7 +3050,7 @@ static int gsmtty_write(struct tty_struct *tty, const unsigned char *buf, if (dlci->state == DLCI_CLOSED) return -EINVAL; /* Stuff the bytes into the fifo queue */ - sent = kfifo_in_locked(dlci->fifo, buf, len, &dlci->lock); + sent = kfifo_in_locked(&dlci->fifo, buf, len, &dlci->lock); /* Need to kick the channel */ gsm_dlci_data_kick(dlci); return sent; @@ -3041,7 +3061,7 @@ static int gsmtty_write_room(struct tty_struct *tty) struct gsm_dlci *dlci = tty->driver_data; if (dlci->state == DLCI_CLOSED) return -EINVAL; - return TX_SIZE - kfifo_len(dlci->fifo); + return TX_SIZE - kfifo_len(&dlci->fifo); } static int gsmtty_chars_in_buffer(struct tty_struct *tty) @@ -3049,7 +3069,7 @@ static int gsmtty_chars_in_buffer(struct tty_struct *tty) struct gsm_dlci *dlci = tty->driver_data; if (dlci->state == DLCI_CLOSED) return -EINVAL; - return kfifo_len(dlci->fifo); + return kfifo_len(&dlci->fifo); } static void gsmtty_flush_buffer(struct tty_struct *tty) @@ -3061,7 +3081,7 @@ static void gsmtty_flush_buffer(struct tty_struct *tty) then the data being transmitted can't simply be junked once it has first hit the stack. Until then we can just blow it away */ - kfifo_reset(dlci->fifo); + kfifo_reset(&dlci->fifo); /* Need to unhook this DLCI from the transmit queue logic */ } @@ -3152,7 +3172,7 @@ static void gsmtty_throttle(struct tty_struct *tty) return; if (C_CRTSCTS(tty)) dlci->modem_tx &= ~TIOCM_DTR; - dlci->throttled = 1; + dlci->throttled = true; /* Send an MSC with DTR cleared */ gsmtty_modem_update(dlci, 0); } @@ -3164,7 +3184,7 @@ static void gsmtty_unthrottle(struct tty_struct *tty) return; if (C_CRTSCTS(tty)) dlci->modem_tx |= TIOCM_DTR; - dlci->throttled = 0; + dlci->throttled = false; /* Send an MSC with DTR set */ gsmtty_modem_update(dlci, 0); } diff --git a/drivers/tty/n_hdlc.c b/drivers/tty/n_hdlc.c index 27b506bf03ce..991f49ee4026 100644 --- a/drivers/tty/n_hdlc.c +++ b/drivers/tty/n_hdlc.c @@ -18,7 +18,7 @@ * All HDLC data is frame oriented which means: * * 1. tty write calls represent one complete transmit frame of data - * The device driver should accept the complete frame or none of + * The device driver should accept the complete frame or none of * the frame (busy) in the write method. Each write call should have * a byte count in the range of 2-65535 bytes (2 is min HDLC frame * with 1 addr byte and 1 ctrl byte). The max byte count of 65535 @@ -39,7 +39,7 @@ * tty read calls. * * 3. tty read calls returns an entire frame of data or nothing. - * + * * 4. all send and receive data is considered raw. No processing * or translation is performed by the line discipline, regardless * of the tty flags @@ -87,9 +87,6 @@ #include <linux/interrupt.h> #include <linux/ptrace.h> -#undef VERSION -#define VERSION(major,minor,patch) (((((major)<<8)+(minor))<<8)+(patch)) - #include <linux/poll.h> #include <linux/in.h> #include <linux/ioctl.h> @@ -107,7 +104,7 @@ /* * Buffers for individual HDLC frames */ -#define MAX_HDLC_FRAME_SIZE 65535 +#define MAX_HDLC_FRAME_SIZE 65535 #define DEFAULT_RX_BUF_COUNT 10 #define MAX_RX_BUF_COUNT 60 #define DEFAULT_TX_BUF_COUNT 3 @@ -127,11 +124,8 @@ struct n_hdlc_buf_list { /** * struct n_hdlc - per device instance data structure * @magic - magic value for structure - * @flags - miscellaneous control flags - * @tty - ptr to TTY structure - * @backup_tty - TTY to use if tty gets closed * @tbusy - reentrancy flag for tx wakeup code - * @woke_up - FIXME: describe this field + * @woke_up - tx wakeup needs to be run again as it was called while @tbusy * @tx_buf_list - list of pending transmit frame buffers * @rx_buf_list - list of received frame buffers * @tx_free_buf_list - list unused transmit frame buffers @@ -139,11 +133,8 @@ struct n_hdlc_buf_list { */ struct n_hdlc { int magic; - __u32 flags; - struct tty_struct *tty; - struct tty_struct *backup_tty; - int tbusy; - int woke_up; + bool tbusy; + bool woke_up; struct n_hdlc_buf_list tx_buf_list; struct n_hdlc_buf_list rx_buf_list; struct n_hdlc_buf_list tx_free_buf_list; @@ -161,39 +152,14 @@ static struct n_hdlc_buf *n_hdlc_buf_get(struct n_hdlc_buf_list *list); /* Local functions */ -static struct n_hdlc *n_hdlc_alloc (void); - -/* debug level can be set by insmod for debugging purposes */ -#define DEBUG_LEVEL_INFO 1 -static int debuglevel; +static struct n_hdlc *n_hdlc_alloc(void); /* max frame size for memory allocations */ static int maxframe = 4096; -/* TTY callbacks */ - -static ssize_t n_hdlc_tty_read(struct tty_struct *tty, struct file *file, - __u8 __user *buf, size_t nr); -static ssize_t n_hdlc_tty_write(struct tty_struct *tty, struct file *file, - const unsigned char *buf, size_t nr); -static int n_hdlc_tty_ioctl(struct tty_struct *tty, struct file *file, - unsigned int cmd, unsigned long arg); -static __poll_t n_hdlc_tty_poll(struct tty_struct *tty, struct file *filp, - poll_table *wait); -static int n_hdlc_tty_open(struct tty_struct *tty); -static void n_hdlc_tty_close(struct tty_struct *tty); -static void n_hdlc_tty_receive(struct tty_struct *tty, const __u8 *cp, - char *fp, int count); -static void n_hdlc_tty_wakeup(struct tty_struct *tty); - -#define bset(p,b) ((p)[(b) >> 5] |= (1 << ((b) & 0x1f))) - -#define tty2n_hdlc(tty) ((struct n_hdlc *) ((tty)->disc_data)) -#define n_hdlc2tty(n_hdlc) ((n_hdlc)->tty) - static void flush_rx_queue(struct tty_struct *tty) { - struct n_hdlc *n_hdlc = tty2n_hdlc(tty); + struct n_hdlc *n_hdlc = tty->disc_data; struct n_hdlc_buf *buf; while ((buf = n_hdlc_buf_get(&n_hdlc->rx_buf_list))) @@ -202,79 +168,22 @@ static void flush_rx_queue(struct tty_struct *tty) static void flush_tx_queue(struct tty_struct *tty) { - struct n_hdlc *n_hdlc = tty2n_hdlc(tty); + struct n_hdlc *n_hdlc = tty->disc_data; struct n_hdlc_buf *buf; while ((buf = n_hdlc_buf_get(&n_hdlc->tx_buf_list))) n_hdlc_buf_put(&n_hdlc->tx_free_buf_list, buf); } -static struct tty_ldisc_ops n_hdlc_ldisc = { - .owner = THIS_MODULE, - .magic = TTY_LDISC_MAGIC, - .name = "hdlc", - .open = n_hdlc_tty_open, - .close = n_hdlc_tty_close, - .read = n_hdlc_tty_read, - .write = n_hdlc_tty_write, - .ioctl = n_hdlc_tty_ioctl, - .poll = n_hdlc_tty_poll, - .receive_buf = n_hdlc_tty_receive, - .write_wakeup = n_hdlc_tty_wakeup, - .flush_buffer = flush_rx_queue, -}; - -/** - * n_hdlc_release - release an n_hdlc per device line discipline info structure - * @n_hdlc - per device line discipline info structure - */ -static void n_hdlc_release(struct n_hdlc *n_hdlc) +static void n_hdlc_free_buf_list(struct n_hdlc_buf_list *list) { - struct tty_struct *tty = n_hdlc2tty (n_hdlc); struct n_hdlc_buf *buf; - - if (debuglevel >= DEBUG_LEVEL_INFO) - printk("%s(%d)n_hdlc_release() called\n",__FILE__,__LINE__); - - /* Ensure that the n_hdlcd process is not hanging on select()/poll() */ - wake_up_interruptible (&tty->read_wait); - wake_up_interruptible (&tty->write_wait); - - if (tty->disc_data == n_hdlc) - tty->disc_data = NULL; /* Break the tty->n_hdlc link */ - - /* Release transmit and receive buffers */ - for(;;) { - buf = n_hdlc_buf_get(&n_hdlc->rx_free_buf_list); - if (buf) { - kfree(buf); - } else - break; - } - for(;;) { - buf = n_hdlc_buf_get(&n_hdlc->tx_free_buf_list); - if (buf) { - kfree(buf); - } else - break; - } - for(;;) { - buf = n_hdlc_buf_get(&n_hdlc->rx_buf_list); - if (buf) { - kfree(buf); - } else - break; - } - for(;;) { - buf = n_hdlc_buf_get(&n_hdlc->tx_buf_list); - if (buf) { - kfree(buf); - } else - break; - } |