Commit 42cf58c2 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'tty-6.0-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty

Pull tty/serial driver fixes from Greg KH:
 "Here are some small tty/serial/vt driver fixes for 6.0-rc4 that
  resolve a number of reported issues:

   - n_gsm fixups for previous changes that caused problems

   - much-reported serdev crash fix that showed up in 6.0-rc1

   - vt font selection bugfix

   - kerneldoc build warning fixes

   - other tiny serial core fixes

  All of these have been in linux-next for a while with no reported
  problems"

* tag 'tty-6.0-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty:
  tty: n_gsm: avoid call of sleeping functions from atomic context
  tty: n_gsm: replace kicktimer with delayed_work
  tty: n_gsm: initialize more members at gsm_alloc_mux()
  tty: n_gsm: add sanity check for gsm->receive in gsm_receive_buf()
  tty: serial: atmel: Preserve previous USART mode if RS485 disabled
  tty: serial: lpuart: disable flow control while waiting for the transmit engine to complete
  tty: Fix lookahead_buf crash with serdev
  serial: fsl_lpuart: RS485 RTS polariy is inverse
  vt: Clear selection before changing the font
  serial: document start_rx member at struct uart_ops
parents c53b3dcb 902e02ea
...@@ -248,7 +248,7 @@ struct gsm_mux { ...@@ -248,7 +248,7 @@ struct gsm_mux {
bool constipated; /* Asked by remote to shut up */ bool constipated; /* Asked by remote to shut up */
bool has_devices; /* Devices were registered */ bool has_devices; /* Devices were registered */
spinlock_t tx_lock; struct mutex tx_mutex;
unsigned int tx_bytes; /* TX data outstanding */ unsigned int tx_bytes; /* TX data outstanding */
#define TX_THRESH_HI 8192 #define TX_THRESH_HI 8192
#define TX_THRESH_LO 2048 #define TX_THRESH_LO 2048
...@@ -256,7 +256,7 @@ struct gsm_mux { ...@@ -256,7 +256,7 @@ struct gsm_mux {
struct list_head tx_data_list; /* Pending data packets */ struct list_head tx_data_list; /* Pending data packets */
/* Control messages */ /* Control messages */
struct timer_list kick_timer; /* Kick TX queuing on timeout */ struct delayed_work kick_timeout; /* Kick TX queuing on timeout */
struct timer_list t2_timer; /* Retransmit timer for commands */ struct timer_list t2_timer; /* Retransmit timer for commands */
int cretries; /* Command retry counter */ int cretries; /* Command retry counter */
struct gsm_control *pending_cmd;/* Our current pending command */ struct gsm_control *pending_cmd;/* Our current pending command */
...@@ -680,7 +680,6 @@ static int gsm_send(struct gsm_mux *gsm, int addr, int cr, int control) ...@@ -680,7 +680,6 @@ static int gsm_send(struct gsm_mux *gsm, int addr, int cr, int control)
struct gsm_msg *msg; struct gsm_msg *msg;
u8 *dp; u8 *dp;
int ocr; int ocr;
unsigned long flags;
msg = gsm_data_alloc(gsm, addr, 0, control); msg = gsm_data_alloc(gsm, addr, 0, control);
if (!msg) if (!msg)
...@@ -702,10 +701,10 @@ static int gsm_send(struct gsm_mux *gsm, int addr, int cr, int control) ...@@ -702,10 +701,10 @@ static int gsm_send(struct gsm_mux *gsm, int addr, int cr, int control)
gsm_print_packet("Q->", addr, cr, control, NULL, 0); gsm_print_packet("Q->", addr, cr, control, NULL, 0);
spin_lock_irqsave(&gsm->tx_lock, flags); mutex_lock(&gsm->tx_mutex);
list_add_tail(&msg->list, &gsm->tx_ctrl_list); list_add_tail(&msg->list, &gsm->tx_ctrl_list);
gsm->tx_bytes += msg->len; gsm->tx_bytes += msg->len;
spin_unlock_irqrestore(&gsm->tx_lock, flags); mutex_unlock(&gsm->tx_mutex);
gsmld_write_trigger(gsm); gsmld_write_trigger(gsm);
return 0; return 0;
...@@ -730,7 +729,7 @@ static void gsm_dlci_clear_queues(struct gsm_mux *gsm, struct gsm_dlci *dlci) ...@@ -730,7 +729,7 @@ static void gsm_dlci_clear_queues(struct gsm_mux *gsm, struct gsm_dlci *dlci)
spin_unlock_irqrestore(&dlci->lock, flags); spin_unlock_irqrestore(&dlci->lock, flags);
/* Clear data packets in MUX write queue */ /* Clear data packets in MUX write queue */
spin_lock_irqsave(&gsm->tx_lock, flags); mutex_lock(&gsm->tx_mutex);
list_for_each_entry_safe(msg, nmsg, &gsm->tx_data_list, list) { list_for_each_entry_safe(msg, nmsg, &gsm->tx_data_list, list) {
if (msg->addr != addr) if (msg->addr != addr)
continue; continue;
...@@ -738,7 +737,7 @@ static void gsm_dlci_clear_queues(struct gsm_mux *gsm, struct gsm_dlci *dlci) ...@@ -738,7 +737,7 @@ static void gsm_dlci_clear_queues(struct gsm_mux *gsm, struct gsm_dlci *dlci)
list_del(&msg->list); list_del(&msg->list);
kfree(msg); kfree(msg);
} }
spin_unlock_irqrestore(&gsm->tx_lock, flags); mutex_unlock(&gsm->tx_mutex);
} }
/** /**
...@@ -1009,7 +1008,7 @@ static void __gsm_data_queue(struct gsm_dlci *dlci, struct gsm_msg *msg) ...@@ -1009,7 +1008,7 @@ static void __gsm_data_queue(struct gsm_dlci *dlci, struct gsm_msg *msg)
gsm->tx_bytes += msg->len; gsm->tx_bytes += msg->len;
gsmld_write_trigger(gsm); gsmld_write_trigger(gsm);
mod_timer(&gsm->kick_timer, jiffies + 10 * gsm->t1 * HZ / 100); schedule_delayed_work(&gsm->kick_timeout, 10 * gsm->t1 * HZ / 100);
} }
/** /**
...@@ -1024,10 +1023,9 @@ static void __gsm_data_queue(struct gsm_dlci *dlci, struct gsm_msg *msg) ...@@ -1024,10 +1023,9 @@ static void __gsm_data_queue(struct gsm_dlci *dlci, struct gsm_msg *msg)
static void gsm_data_queue(struct gsm_dlci *dlci, struct gsm_msg *msg) static void gsm_data_queue(struct gsm_dlci *dlci, struct gsm_msg *msg)
{ {
unsigned long flags; mutex_lock(&dlci->gsm->tx_mutex);
spin_lock_irqsave(&dlci->gsm->tx_lock, flags);
__gsm_data_queue(dlci, msg); __gsm_data_queue(dlci, msg);
spin_unlock_irqrestore(&dlci->gsm->tx_lock, flags); mutex_unlock(&dlci->gsm->tx_mutex);
} }
/** /**
...@@ -1039,7 +1037,7 @@ static void gsm_data_queue(struct gsm_dlci *dlci, struct gsm_msg *msg) ...@@ -1039,7 +1037,7 @@ static void gsm_data_queue(struct gsm_dlci *dlci, struct gsm_msg *msg)
* is data. Keep to the MRU of the mux. This path handles the usual tty * is data. Keep to the MRU of the mux. This path handles the usual tty
* interface which is a byte stream with optional modem data. * interface which is a byte stream with optional modem data.
* *
* Caller must hold the tx_lock of the mux. * Caller must hold the tx_mutex of the mux.
*/ */
static int gsm_dlci_data_output(struct gsm_mux *gsm, struct gsm_dlci *dlci) static int gsm_dlci_data_output(struct gsm_mux *gsm, struct gsm_dlci *dlci)
...@@ -1099,7 +1097,7 @@ static int gsm_dlci_data_output(struct gsm_mux *gsm, struct gsm_dlci *dlci) ...@@ -1099,7 +1097,7 @@ static int gsm_dlci_data_output(struct gsm_mux *gsm, struct gsm_dlci *dlci)
* is data. Keep to the MRU of the mux. This path handles framed data * is data. Keep to the MRU of the mux. This path handles framed data
* queued as skbuffs to the DLCI. * queued as skbuffs to the DLCI.
* *
* Caller must hold the tx_lock of the mux. * Caller must hold the tx_mutex of the mux.
*/ */
static int gsm_dlci_data_output_framed(struct gsm_mux *gsm, static int gsm_dlci_data_output_framed(struct gsm_mux *gsm,
...@@ -1115,7 +1113,7 @@ static int gsm_dlci_data_output_framed(struct gsm_mux *gsm, ...@@ -1115,7 +1113,7 @@ static int gsm_dlci_data_output_framed(struct gsm_mux *gsm,
if (dlci->adaption == 4) if (dlci->adaption == 4)
overhead = 1; overhead = 1;
/* dlci->skb is locked by tx_lock */ /* dlci->skb is locked by tx_mutex */
if (dlci->skb == NULL) { if (dlci->skb == NULL) {
dlci->skb = skb_dequeue_tail(&dlci->skb_list); dlci->skb = skb_dequeue_tail(&dlci->skb_list);
if (dlci->skb == NULL) if (dlci->skb == NULL)
...@@ -1169,7 +1167,7 @@ static int gsm_dlci_data_output_framed(struct gsm_mux *gsm, ...@@ -1169,7 +1167,7 @@ static int gsm_dlci_data_output_framed(struct gsm_mux *gsm,
* Push an empty frame in to the transmit queue to update the modem status * Push an empty frame in to the transmit queue to update the modem status
* bits and to transmit an optional break. * bits and to transmit an optional break.
* *
* Caller must hold the tx_lock of the mux. * Caller must hold the tx_mutex of the mux.
*/ */
static int gsm_dlci_modem_output(struct gsm_mux *gsm, struct gsm_dlci *dlci, static int gsm_dlci_modem_output(struct gsm_mux *gsm, struct gsm_dlci *dlci,
...@@ -1283,13 +1281,12 @@ static int gsm_dlci_data_sweep(struct gsm_mux *gsm) ...@@ -1283,13 +1281,12 @@ static int gsm_dlci_data_sweep(struct gsm_mux *gsm)
static void gsm_dlci_data_kick(struct gsm_dlci *dlci) static void gsm_dlci_data_kick(struct gsm_dlci *dlci)
{ {
unsigned long flags;
int sweep; int sweep;
if (dlci->constipated) if (dlci->constipated)
return; return;
spin_lock_irqsave(&dlci->gsm->tx_lock, flags); mutex_lock(&dlci->gsm->tx_mutex);
/* If we have nothing running then we need to fire up */ /* If we have nothing running then we need to fire up */
sweep = (dlci->gsm->tx_bytes < TX_THRESH_LO); sweep = (dlci->gsm->tx_bytes < TX_THRESH_LO);
if (dlci->gsm->tx_bytes == 0) { if (dlci->gsm->tx_bytes == 0) {
...@@ -1300,7 +1297,7 @@ static void gsm_dlci_data_kick(struct gsm_dlci *dlci) ...@@ -1300,7 +1297,7 @@ static void gsm_dlci_data_kick(struct gsm_dlci *dlci)
} }
if (sweep) if (sweep)
gsm_dlci_data_sweep(dlci->gsm); gsm_dlci_data_sweep(dlci->gsm);
spin_unlock_irqrestore(&dlci->gsm->tx_lock, flags); mutex_unlock(&dlci->gsm->tx_mutex);
} }
/* /*
...@@ -1984,24 +1981,23 @@ static void gsm_dlci_command(struct gsm_dlci *dlci, const u8 *data, int len) ...@@ -1984,24 +1981,23 @@ static void gsm_dlci_command(struct gsm_dlci *dlci, const u8 *data, int len)
} }
/** /**
* gsm_kick_timer - transmit if possible * gsm_kick_timeout - transmit if possible
* @t: timer contained in our gsm object * @work: work contained in our gsm object
* *
* Transmit data from DLCIs if the queue is empty. We can't rely on * Transmit data from DLCIs if the queue is empty. We can't rely on
* a tty wakeup except when we filled the pipe so we need to fire off * a tty wakeup except when we filled the pipe so we need to fire off
* new data ourselves in other cases. * new data ourselves in other cases.
*/ */
static void gsm_kick_timer(struct timer_list *t) static void gsm_kick_timeout(struct work_struct *work)
{ {
struct gsm_mux *gsm = from_timer(gsm, t, kick_timer); struct gsm_mux *gsm = container_of(work, struct gsm_mux, kick_timeout.work);
unsigned long flags;
int sent = 0; int sent = 0;
spin_lock_irqsave(&gsm->tx_lock, flags); mutex_lock(&gsm->tx_mutex);
/* If we have nothing running then we need to fire up */ /* If we have nothing running then we need to fire up */
if (gsm->tx_bytes < TX_THRESH_LO) if (gsm->tx_bytes < TX_THRESH_LO)
sent = gsm_dlci_data_sweep(gsm); sent = gsm_dlci_data_sweep(gsm);
spin_unlock_irqrestore(&gsm->tx_lock, flags); mutex_unlock(&gsm->tx_mutex);
if (sent && debug & 4) if (sent && debug & 4)
pr_info("%s TX queue stalled\n", __func__); pr_info("%s TX queue stalled\n", __func__);
...@@ -2458,7 +2454,7 @@ static void gsm_cleanup_mux(struct gsm_mux *gsm, bool disc) ...@@ -2458,7 +2454,7 @@ static void gsm_cleanup_mux(struct gsm_mux *gsm, bool disc)
} }
/* Finish outstanding timers, making sure they are done */ /* Finish outstanding timers, making sure they are done */
del_timer_sync(&gsm->kick_timer); cancel_delayed_work_sync(&gsm->kick_timeout);
del_timer_sync(&gsm->t2_timer); del_timer_sync(&gsm->t2_timer);
/* Finish writing to ldisc */ /* Finish writing to ldisc */
...@@ -2501,13 +2497,6 @@ static int gsm_activate_mux(struct gsm_mux *gsm) ...@@ -2501,13 +2497,6 @@ static int gsm_activate_mux(struct gsm_mux *gsm)
if (dlci == NULL) if (dlci == NULL)
return -ENOMEM; return -ENOMEM;
timer_setup(&gsm->kick_timer, gsm_kick_timer, 0);
timer_setup(&gsm->t2_timer, gsm_control_retransmit, 0);
INIT_WORK(&gsm->tx_work, gsmld_write_task);
init_waitqueue_head(&gsm->event);
spin_lock_init(&gsm->control_lock);
spin_lock_init(&gsm->tx_lock);
if (gsm->encoding == 0) if (gsm->encoding == 0)
gsm->receive = gsm0_receive; gsm->receive = gsm0_receive;
else else
...@@ -2538,6 +2527,7 @@ static void gsm_free_mux(struct gsm_mux *gsm) ...@@ -2538,6 +2527,7 @@ static void gsm_free_mux(struct gsm_mux *gsm)
break; break;
} }
} }
mutex_destroy(&gsm->tx_mutex);
mutex_destroy(&gsm->mutex); mutex_destroy(&gsm->mutex);
kfree(gsm->txframe); kfree(gsm->txframe);
kfree(gsm->buf); kfree(gsm->buf);
...@@ -2609,9 +2599,15 @@ static struct gsm_mux *gsm_alloc_mux(void) ...@@ -2609,9 +2599,15 @@ static struct gsm_mux *gsm_alloc_mux(void)
} }
spin_lock_init(&gsm->lock); spin_lock_init(&gsm->lock);
mutex_init(&gsm->mutex); mutex_init(&gsm->mutex);
mutex_init(&gsm->tx_mutex);
kref_init(&gsm->ref); kref_init(&gsm->ref);
INIT_LIST_HEAD(&gsm->tx_ctrl_list); INIT_LIST_HEAD(&gsm->tx_ctrl_list);
INIT_LIST_HEAD(&gsm->tx_data_list); INIT_LIST_HEAD(&gsm->tx_data_list);
INIT_DELAYED_WORK(&gsm->kick_timeout, gsm_kick_timeout);
timer_setup(&gsm->t2_timer, gsm_control_retransmit, 0);
INIT_WORK(&gsm->tx_work, gsmld_write_task);
init_waitqueue_head(&gsm->event);
spin_lock_init(&gsm->control_lock);
gsm->t1 = T1; gsm->t1 = T1;
gsm->t2 = T2; gsm->t2 = T2;
...@@ -2636,6 +2632,7 @@ static struct gsm_mux *gsm_alloc_mux(void) ...@@ -2636,6 +2632,7 @@ static struct gsm_mux *gsm_alloc_mux(void)
} }
spin_unlock(&gsm_mux_lock); spin_unlock(&gsm_mux_lock);
if (i == MAX_MUX) { if (i == MAX_MUX) {
mutex_destroy(&gsm->tx_mutex);
mutex_destroy(&gsm->mutex); mutex_destroy(&gsm->mutex);
kfree(gsm->txframe); kfree(gsm->txframe);
kfree(gsm->buf); kfree(gsm->buf);
...@@ -2791,17 +2788,16 @@ static void gsmld_write_trigger(struct gsm_mux *gsm) ...@@ -2791,17 +2788,16 @@ static void gsmld_write_trigger(struct gsm_mux *gsm)
static void gsmld_write_task(struct work_struct *work) static void gsmld_write_task(struct work_struct *work)
{ {
struct gsm_mux *gsm = container_of(work, struct gsm_mux, tx_work); struct gsm_mux *gsm = container_of(work, struct gsm_mux, tx_work);
unsigned long flags;
int i, ret; int i, ret;
/* All outstanding control channel and control messages and one data /* All outstanding control channel and control messages and one data
* frame is sent. * frame is sent.
*/ */
ret = -ENODEV; ret = -ENODEV;
spin_lock_irqsave(&gsm->tx_lock, flags); mutex_lock(&gsm->tx_mutex);
if (gsm->tty) if (gsm->tty)
ret = gsm_data_kick(gsm); ret = gsm_data_kick(gsm);
spin_unlock_irqrestore(&gsm->tx_lock, flags); mutex_unlock(&gsm->tx_mutex);
if (ret >= 0) if (ret >= 0)
for (i = 0; i < NUM_DLCI; i++) for (i = 0; i < NUM_DLCI; i++)
...@@ -2858,6 +2854,7 @@ static void gsmld_receive_buf(struct tty_struct *tty, const unsigned char *cp, ...@@ -2858,6 +2854,7 @@ static void gsmld_receive_buf(struct tty_struct *tty, const unsigned char *cp,
flags = *fp++; flags = *fp++;
switch (flags) { switch (flags) {
case TTY_NORMAL: case TTY_NORMAL:
if (gsm->receive)
gsm->receive(gsm, *cp); gsm->receive(gsm, *cp);
break; break;
case TTY_OVERRUN: case TTY_OVERRUN:
...@@ -2946,10 +2943,6 @@ static int gsmld_open(struct tty_struct *tty) ...@@ -2946,10 +2943,6 @@ static int gsmld_open(struct tty_struct *tty)
gsmld_attach_gsm(tty, gsm); gsmld_attach_gsm(tty, gsm);
timer_setup(&gsm->kick_timer, gsm_kick_timer, 0);
timer_setup(&gsm->t2_timer, gsm_control_retransmit, 0);
INIT_WORK(&gsm->tx_work, gsmld_write_task);
return 0; return 0;
} }
...@@ -3012,7 +3005,6 @@ static ssize_t gsmld_write(struct tty_struct *tty, struct file *file, ...@@ -3012,7 +3005,6 @@ static ssize_t gsmld_write(struct tty_struct *tty, struct file *file,
const unsigned char *buf, size_t nr) const unsigned char *buf, size_t nr)
{ {
struct gsm_mux *gsm = tty->disc_data; struct gsm_mux *gsm = tty->disc_data;
unsigned long flags;
int space; int space;
int ret; int ret;
...@@ -3020,13 +3012,13 @@ static ssize_t gsmld_write(struct tty_struct *tty, struct file *file, ...@@ -3020,13 +3012,13 @@ static ssize_t gsmld_write(struct tty_struct *tty, struct file *file,
return -ENODEV; return -ENODEV;
ret = -ENOBUFS; ret = -ENOBUFS;
spin_lock_irqsave(&gsm->tx_lock, flags); mutex_lock(&gsm->tx_mutex);
space = tty_write_room(tty); space = tty_write_room(tty);
if (space >= nr) if (space >= nr)
ret = tty->ops->write(tty, buf, nr); ret = tty->ops->write(tty, buf, nr);
else else
set_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); set_bit(TTY_DO_WRITE_WAKEUP, &tty->flags);
spin_unlock_irqrestore(&gsm->tx_lock, flags); mutex_unlock(&gsm->tx_mutex);
return ret; return ret;
} }
...@@ -3323,14 +3315,13 @@ static struct tty_ldisc_ops tty_ldisc_packet = { ...@@ -3323,14 +3315,13 @@ static struct tty_ldisc_ops tty_ldisc_packet = {
static void gsm_modem_upd_via_data(struct gsm_dlci *dlci, u8 brk) static void gsm_modem_upd_via_data(struct gsm_dlci *dlci, u8 brk)
{ {
struct gsm_mux *gsm = dlci->gsm; struct gsm_mux *gsm = dlci->gsm;
unsigned long flags;
if (dlci->state != DLCI_OPEN || dlci->adaption != 2) if (dlci->state != DLCI_OPEN || dlci->adaption != 2)
return; return;
spin_lock_irqsave(&gsm->tx_lock, flags); mutex_lock(&gsm->tx_mutex);
gsm_dlci_modem_output(gsm, dlci, brk); gsm_dlci_modem_output(gsm, dlci, brk);
spin_unlock_irqrestore(&gsm->tx_lock, flags); mutex_unlock(&gsm->tx_mutex);
} }
/** /**
......
...@@ -294,9 +294,6 @@ static int atmel_config_rs485(struct uart_port *port, struct ktermios *termios, ...@@ -294,9 +294,6 @@ static int atmel_config_rs485(struct uart_port *port, struct ktermios *termios,
mode = atmel_uart_readl(port, ATMEL_US_MR); mode = atmel_uart_readl(port, ATMEL_US_MR);
/* Resetting serial mode to RS232 (0x0) */
mode &= ~ATMEL_US_USMODE;
if (rs485conf->flags & SER_RS485_ENABLED) { if (rs485conf->flags & SER_RS485_ENABLED) {
dev_dbg(port->dev, "Setting UART to RS485\n"); dev_dbg(port->dev, "Setting UART to RS485\n");
if (rs485conf->flags & SER_RS485_RX_DURING_TX) if (rs485conf->flags & SER_RS485_RX_DURING_TX)
...@@ -306,6 +303,7 @@ static int atmel_config_rs485(struct uart_port *port, struct ktermios *termios, ...@@ -306,6 +303,7 @@ static int atmel_config_rs485(struct uart_port *port, struct ktermios *termios,
atmel_uart_writel(port, ATMEL_US_TTGR, atmel_uart_writel(port, ATMEL_US_TTGR,
rs485conf->delay_rts_after_send); rs485conf->delay_rts_after_send);
mode &= ~ATMEL_US_USMODE;
mode |= ATMEL_US_USMODE_RS485; mode |= ATMEL_US_USMODE_RS485;
} else { } else {
dev_dbg(port->dev, "Setting UART to RS232\n"); dev_dbg(port->dev, "Setting UART to RS232\n");
......
...@@ -1394,9 +1394,9 @@ static int lpuart_config_rs485(struct uart_port *port, struct ktermios *termios, ...@@ -1394,9 +1394,9 @@ static int lpuart_config_rs485(struct uart_port *port, struct ktermios *termios,
* Note: UART is assumed to be active high. * Note: UART is assumed to be active high.
*/ */
if (rs485->flags & SER_RS485_RTS_ON_SEND) if (rs485->flags & SER_RS485_RTS_ON_SEND)
modem &= ~UARTMODEM_TXRTSPOL;
else if (rs485->flags & SER_RS485_RTS_AFTER_SEND)
modem |= UARTMODEM_TXRTSPOL; modem |= UARTMODEM_TXRTSPOL;
else if (rs485->flags & SER_RS485_RTS_AFTER_SEND)
modem &= ~UARTMODEM_TXRTSPOL;
} }
writeb(modem, sport->port.membase + UARTMODEM); writeb(modem, sport->port.membase + UARTMODEM);
...@@ -2191,6 +2191,7 @@ lpuart32_set_termios(struct uart_port *port, struct ktermios *termios, ...@@ -2191,6 +2191,7 @@ lpuart32_set_termios(struct uart_port *port, struct ktermios *termios,
uart_update_timeout(port, termios->c_cflag, baud); uart_update_timeout(port, termios->c_cflag, baud);
/* wait transmit engin complete */ /* wait transmit engin complete */
lpuart32_write(&sport->port, 0, UARTMODIR);
lpuart32_wait_bit_set(&sport->port, UARTSTAT, UARTSTAT_TC); lpuart32_wait_bit_set(&sport->port, UARTSTAT, UARTSTAT_TC);
/* disable transmit and receive */ /* disable transmit and receive */
......
...@@ -470,7 +470,6 @@ static void lookahead_bufs(struct tty_port *port, struct tty_buffer *head) ...@@ -470,7 +470,6 @@ static void lookahead_bufs(struct tty_port *port, struct tty_buffer *head)
while (head) { while (head) {
struct tty_buffer *next; struct tty_buffer *next;
unsigned char *p, *f = NULL;
unsigned int count; unsigned int count;
/* /*
...@@ -489,11 +488,16 @@ static void lookahead_bufs(struct tty_port *port, struct tty_buffer *head) ...@@ -489,11 +488,16 @@ static void lookahead_bufs(struct tty_port *port, struct tty_buffer *head)
continue; continue;
} }
if (port->client_ops->lookahead_buf) {
unsigned char *p, *f = NULL;
p = char_buf_ptr(head, head->lookahead); p = char_buf_ptr(head, head->lookahead);
if (~head->flags & TTYB_NORMAL) if (~head->flags & TTYB_NORMAL)
f = flag_buf_ptr(head, head->lookahead); f = flag_buf_ptr(head, head->lookahead);
port->client_ops->lookahead_buf(port, p, f, count); port->client_ops->lookahead_buf(port, p, f, count);
}
head->lookahead += count; head->lookahead += count;
} }
} }
......
...@@ -4662,9 +4662,11 @@ static int con_font_set(struct vc_data *vc, struct console_font_op *op) ...@@ -4662,9 +4662,11 @@ static int con_font_set(struct vc_data *vc, struct console_font_op *op)
console_lock(); console_lock();
if (vc->vc_mode != KD_TEXT) if (vc->vc_mode != KD_TEXT)
rc = -EINVAL; rc = -EINVAL;
else if (vc->vc_sw->con_font_set) else if (vc->vc_sw->con_font_set) {
if (vc_is_sel(vc))
clear_selection();
rc = vc->vc_sw->con_font_set(vc, &font, op->flags); rc = vc->vc_sw->con_font_set(vc, &font, op->flags);
else } else
rc = -ENOSYS; rc = -ENOSYS;
console_unlock(); console_unlock();
kfree(font.data); kfree(font.data);
...@@ -4691,9 +4693,11 @@ static int con_font_default(struct vc_data *vc, struct console_font_op *op) ...@@ -4691,9 +4693,11 @@ static int con_font_default(struct vc_data *vc, struct console_font_op *op)
console_unlock(); console_unlock();
return -EINVAL; return -EINVAL;
} }
if (vc->vc_sw->con_font_default) if (vc->vc_sw->con_font_default) {
if (vc_is_sel(vc))
clear_selection();
rc = vc->vc_sw->con_font_default(vc, &font, s); rc = vc->vc_sw->con_font_default(vc, &font, s);
else } else
rc = -ENOSYS; rc = -ENOSYS;
console_unlock(); console_unlock();
if (!rc) { if (!rc) {
......
...@@ -141,6 +141,14 @@ struct gpio_desc; ...@@ -141,6 +141,14 @@ struct gpio_desc;
* Locking: none. * Locking: none.
* Interrupts: caller dependent. * Interrupts: caller dependent.
* *
* @start_rx: ``void ()(struct uart_port *port)``
*
* Start receiving characters.
*
* Locking: @port->lock taken.
* Interrupts: locally disabled.
* This call must not sleep
*
* @stop_rx: ``void ()(struct uart_port *port)`` * @stop_rx: ``void ()(struct uart_port *port)``
* *
* Stop receiving characters; the @port is in the process of being closed. * Stop receiving characters; the @port is in the process of being closed.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment