Skip to content

Commit 4b2981b

Browse files
committed
Merge tag 'tty-6.8-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty
Pull tty / serial fixes from Greg KH: "Here are three small tty and serial driver fixes for 6.8-rc5: - revert a 8250_pci1xxxx off-by-one change that was incorrect - two changes to fix the transmit path of the mxs-auart driver, fixing a regression in the 6.2 release All of these have been in linux-next for over a week with no reported issues" * tag 'tty-6.8-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty: serial: mxs-auart: fix tx serial: core: introduce uart_port_tx_flags() serial: 8250_pci1xxxx: partially revert off by one patch
2 parents a3a7d16 + 7be50f2 commit 4b2981b

File tree

3 files changed

+32
-7
lines changed

3 files changed

+32
-7
lines changed

drivers/tty/serial/8250/8250_pci1xxxx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ static void pci1xxxx_process_read_data(struct uart_port *port,
302302
* to read, the data is received one byte at a time.
303303
*/
304304
while (valid_burst_count--) {
305-
if (*buff_index >= (RX_BUF_SIZE - UART_BURST_SIZE))
305+
if (*buff_index > (RX_BUF_SIZE - UART_BURST_SIZE))
306306
break;
307307
burst_buf = (u32 *)&rx_buff[*buff_index];
308308
*burst_buf = readl(port->membase + UART_RX_BURST_FIFO);

drivers/tty/serial/mxs-auart.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -605,13 +605,16 @@ static void mxs_auart_tx_chars(struct mxs_auart_port *s)
605605
return;
606606
}
607607

608-
pending = uart_port_tx(&s->port, ch,
608+
pending = uart_port_tx_flags(&s->port, ch, UART_TX_NOSTOP,
609609
!(mxs_read(s, REG_STAT) & AUART_STAT_TXFF),
610610
mxs_write(ch, s, REG_DATA));
611611
if (pending)
612612
mxs_set(AUART_INTR_TXIEN, s, REG_INTR);
613613
else
614614
mxs_clr(AUART_INTR_TXIEN, s, REG_INTR);
615+
616+
if (uart_tx_stopped(&s->port))
617+
mxs_auart_stop_tx(&s->port);
615618
}
616619

617620
static void mxs_auart_rx_char(struct mxs_auart_port *s)

include/linux/serial_core.h

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -748,8 +748,17 @@ struct uart_driver {
748748

749749
void uart_write_wakeup(struct uart_port *port);
750750

751-
#define __uart_port_tx(uport, ch, tx_ready, put_char, tx_done, for_test, \
752-
for_post) \
751+
/**
752+
* enum UART_TX_FLAGS -- flags for uart_port_tx_flags()
753+
*
754+
* @UART_TX_NOSTOP: don't call port->ops->stop_tx() on empty buffer
755+
*/
756+
enum UART_TX_FLAGS {
757+
UART_TX_NOSTOP = BIT(0),
758+
};
759+
760+
#define __uart_port_tx(uport, ch, flags, tx_ready, put_char, tx_done, \
761+
for_test, for_post) \
753762
({ \
754763
struct uart_port *__port = (uport); \
755764
struct circ_buf *xmit = &__port->state->xmit; \
@@ -777,7 +786,7 @@ void uart_write_wakeup(struct uart_port *port);
777786
if (pending < WAKEUP_CHARS) { \
778787
uart_write_wakeup(__port); \
779788
\
780-
if (pending == 0) \
789+
if (!((flags) & UART_TX_NOSTOP) && pending == 0) \
781790
__port->ops->stop_tx(__port); \
782791
} \
783792
\
@@ -812,7 +821,7 @@ void uart_write_wakeup(struct uart_port *port);
812821
*/
813822
#define uart_port_tx_limited(port, ch, count, tx_ready, put_char, tx_done) ({ \
814823
unsigned int __count = (count); \
815-
__uart_port_tx(port, ch, tx_ready, put_char, tx_done, __count, \
824+
__uart_port_tx(port, ch, 0, tx_ready, put_char, tx_done, __count, \
816825
__count--); \
817826
})
818827

@@ -826,8 +835,21 @@ void uart_write_wakeup(struct uart_port *port);
826835
* See uart_port_tx_limited() for more details.
827836
*/
828837
#define uart_port_tx(port, ch, tx_ready, put_char) \
829-
__uart_port_tx(port, ch, tx_ready, put_char, ({}), true, ({}))
838+
__uart_port_tx(port, ch, 0, tx_ready, put_char, ({}), true, ({}))
839+
830840

841+
/**
842+
* uart_port_tx_flags -- transmit helper for uart_port with flags
843+
* @port: uart port
844+
* @ch: variable to store a character to be written to the HW
845+
* @flags: %UART_TX_NOSTOP or similar
846+
* @tx_ready: can HW accept more data function
847+
* @put_char: function to write a character
848+
*
849+
* See uart_port_tx_limited() for more details.
850+
*/
851+
#define uart_port_tx_flags(port, ch, flags, tx_ready, put_char) \
852+
__uart_port_tx(port, ch, flags, tx_ready, put_char, ({}), true, ({}))
831853
/*
832854
* Baud rate helpers.
833855
*/

0 commit comments

Comments
 (0)