Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'tty-5.18-rc7' 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 n_gsm and serial driver fixes for 5.18-rc7
that resolve reported problems. They include:

- n_gsm fixes for reported issues

- 8250_mtk driver fixes for some platforms

- fsl_lpuart driver fix for reported problem.

- digicolor driver fix for reported problem.

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

* tag 'tty-5.18-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty:
fsl_lpuart: Don't enable interrupts too early
tty: n_gsm: fix invalid gsmtty_write_room() result
tty: n_gsm: fix mux activation issues in gsm_config()
tty: n_gsm: fix buffer over-read in gsm_dlci_data()
serial: 8250_mtk: Fix register address for XON/XOFF character
serial: 8250_mtk: Make sure to select the right FEATURE_SEL
serial: 8250_mtk: Fix UART_EFR register address
tty/serial: digicolor: fix possible null-ptr-deref in digicolor_uart_probe()

+43 -29
+12 -8
drivers/tty/n_gsm.c
··· 137 137 int retries; 138 138 /* Uplink tty if active */ 139 139 struct tty_port port; /* The tty bound to this DLCI if there is one */ 140 + #define TX_SIZE 4096 /* Must be power of 2. */ 140 141 struct kfifo fifo; /* Queue fifo for the DLCI */ 141 142 int adaption; /* Adaption layer in use */ 142 143 int prev_adaption; ··· 1659 1658 if (len == 0) 1660 1659 return; 1661 1660 } 1661 + len--; 1662 1662 slen++; 1663 1663 tty = tty_port_tty_get(port); 1664 1664 if (tty) { ··· 1732 1730 return NULL; 1733 1731 spin_lock_init(&dlci->lock); 1734 1732 mutex_init(&dlci->mutex); 1735 - if (kfifo_alloc(&dlci->fifo, 4096, GFP_KERNEL) < 0) { 1733 + if (kfifo_alloc(&dlci->fifo, TX_SIZE, GFP_KERNEL) < 0) { 1736 1734 kfree(dlci); 1737 1735 return NULL; 1738 1736 } ··· 2353 2351 2354 2352 static int gsm_config(struct gsm_mux *gsm, struct gsm_config *c) 2355 2353 { 2354 + int ret = 0; 2356 2355 int need_close = 0; 2357 2356 int need_restart = 0; 2358 2357 ··· 2421 2418 * FIXME: We need to separate activation/deactivation from adding 2422 2419 * and removing from the mux array 2423 2420 */ 2424 - if (need_restart) 2425 - gsm_activate_mux(gsm); 2426 - if (gsm->initiator && need_close) 2427 - gsm_dlci_begin_open(gsm->dlci[0]); 2421 + if (gsm->dead) { 2422 + ret = gsm_activate_mux(gsm); 2423 + if (ret) 2424 + return ret; 2425 + if (gsm->initiator) 2426 + gsm_dlci_begin_open(gsm->dlci[0]); 2427 + } 2428 2428 return 0; 2429 2429 } 2430 2430 ··· 2977 2971 * Virtual tty side 2978 2972 */ 2979 2973 2980 - #define TX_SIZE 512 2981 - 2982 2974 /** 2983 2975 * gsm_modem_upd_via_data - send modem bits via convergence layer 2984 2976 * @dlci: channel ··· 3216 3212 struct gsm_dlci *dlci = tty->driver_data; 3217 3213 if (dlci->state == DLCI_CLOSED) 3218 3214 return 0; 3219 - return TX_SIZE - kfifo_len(&dlci->fifo); 3215 + return kfifo_avail(&dlci->fifo); 3220 3216 } 3221 3217 3222 3218 static unsigned int gsmtty_chars_in_buffer(struct tty_struct *tty)
+20 -9
drivers/tty/serial/8250/8250_mtk.c
··· 37 37 #define MTK_UART_IER_RTSI 0x40 /* Enable RTS Modem status interrupt */ 38 38 #define MTK_UART_IER_CTSI 0x80 /* Enable CTS Modem status interrupt */ 39 39 40 + #define MTK_UART_EFR 38 /* I/O: Extended Features Register */ 40 41 #define MTK_UART_EFR_EN 0x10 /* Enable enhancement feature */ 41 42 #define MTK_UART_EFR_RTS 0x40 /* Enable hardware rx flow control */ 42 43 #define MTK_UART_EFR_CTS 0x80 /* Enable hardware tx flow control */ ··· 53 52 #define MTK_UART_RX_SIZE 0x8000 54 53 #define MTK_UART_TX_TRIGGER 1 55 54 #define MTK_UART_RX_TRIGGER MTK_UART_RX_SIZE 55 + 56 + #define MTK_UART_FEATURE_SEL 39 /* Feature Selection register */ 57 + #define MTK_UART_FEAT_NEWRMAP BIT(0) /* Use new register map */ 58 + 59 + #define MTK_UART_XON1 40 /* I/O: Xon character 1 */ 60 + #define MTK_UART_XOFF1 42 /* I/O: Xoff character 1 */ 56 61 57 62 #ifdef CONFIG_SERIAL_8250_DMA 58 63 enum dma_rx_status { ··· 176 169 MTK_UART_DMA_EN_RX | MTK_UART_DMA_EN_TX); 177 170 178 171 serial_out(up, UART_LCR, UART_LCR_CONF_MODE_B); 179 - serial_out(up, UART_EFR, UART_EFR_ECB); 172 + serial_out(up, MTK_UART_EFR, UART_EFR_ECB); 180 173 serial_out(up, UART_LCR, lcr); 181 174 182 175 if (dmaengine_slave_config(dma->rxchan, &dma->rxconf) != 0) ··· 239 232 int lcr = serial_in(up, UART_LCR); 240 233 241 234 serial_out(up, UART_LCR, UART_LCR_CONF_MODE_B); 242 - serial_out(up, UART_EFR, UART_EFR_ECB); 235 + serial_out(up, MTK_UART_EFR, UART_EFR_ECB); 243 236 serial_out(up, UART_LCR, lcr); 244 237 lcr = serial_in(up, UART_LCR); 245 238 ··· 248 241 serial_out(up, MTK_UART_ESCAPE_DAT, MTK_UART_ESCAPE_CHAR); 249 242 serial_out(up, MTK_UART_ESCAPE_EN, 0x00); 250 243 serial_out(up, UART_LCR, UART_LCR_CONF_MODE_B); 251 - serial_out(up, UART_EFR, serial_in(up, UART_EFR) & 244 + serial_out(up, MTK_UART_EFR, serial_in(up, MTK_UART_EFR) & 252 245 (~(MTK_UART_EFR_HW_FC | MTK_UART_EFR_SW_FC_MASK))); 253 246 serial_out(up, UART_LCR, lcr); 254 247 mtk8250_disable_intrs(up, MTK_UART_IER_XOFFI | ··· 262 255 serial_out(up, UART_LCR, UART_LCR_CONF_MODE_B); 263 256 264 257 /*enable hw flow control*/ 265 - serial_out(up, UART_EFR, MTK_UART_EFR_HW_FC | 266 - (serial_in(up, UART_EFR) & 258 + serial_out(up, MTK_UART_EFR, MTK_UART_EFR_HW_FC | 259 + (serial_in(up, MTK_UART_EFR) & 267 260 (~(MTK_UART_EFR_HW_FC | MTK_UART_EFR_SW_FC_MASK)))); 268 261 269 262 serial_out(up, UART_LCR, lcr); ··· 277 270 serial_out(up, UART_LCR, UART_LCR_CONF_MODE_B); 278 271 279 272 /*enable sw flow control */ 280 - serial_out(up, UART_EFR, MTK_UART_EFR_XON1_XOFF1 | 281 - (serial_in(up, UART_EFR) & 273 + serial_out(up, MTK_UART_EFR, MTK_UART_EFR_XON1_XOFF1 | 274 + (serial_in(up, MTK_UART_EFR) & 282 275 (~(MTK_UART_EFR_HW_FC | MTK_UART_EFR_SW_FC_MASK)))); 283 276 284 - serial_out(up, UART_XON1, START_CHAR(port->state->port.tty)); 285 - serial_out(up, UART_XOFF1, STOP_CHAR(port->state->port.tty)); 277 + serial_out(up, MTK_UART_XON1, START_CHAR(port->state->port.tty)); 278 + serial_out(up, MTK_UART_XOFF1, STOP_CHAR(port->state->port.tty)); 286 279 serial_out(up, UART_LCR, lcr); 287 280 mtk8250_disable_intrs(up, MTK_UART_IER_CTSI|MTK_UART_IER_RTSI); 288 281 mtk8250_enable_intrs(up, MTK_UART_IER_XOFFI); ··· 574 567 if (data->dma) 575 568 uart.dma = data->dma; 576 569 #endif 570 + 571 + /* Set AP UART new register map */ 572 + writel(MTK_UART_FEAT_NEWRMAP, uart.port.membase + 573 + (MTK_UART_FEATURE_SEL << uart.port.regshift)); 577 574 578 575 /* Disable Rate Fix function */ 579 576 writel(0x0, uart.port.membase +
+2 -3
drivers/tty/serial/digicolor-usart.c
··· 471 471 if (IS_ERR(uart_clk)) 472 472 return PTR_ERR(uart_clk); 473 473 474 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 475 - dp->port.mapbase = res->start; 476 - dp->port.membase = devm_ioremap_resource(&pdev->dev, res); 474 + dp->port.membase = devm_platform_get_and_ioremap_resource(pdev, 0, &res); 477 475 if (IS_ERR(dp->port.membase)) 478 476 return PTR_ERR(dp->port.membase); 477 + dp->port.mapbase = res->start; 479 478 480 479 irq = platform_get_irq(pdev, 0); 481 480 if (irq < 0)
+9 -9
drivers/tty/serial/fsl_lpuart.c
··· 2664 2664 struct device_node *np = pdev->dev.of_node; 2665 2665 struct lpuart_port *sport; 2666 2666 struct resource *res; 2667 + irq_handler_t handler; 2667 2668 int ret; 2668 2669 2669 2670 sport = devm_kzalloc(&pdev->dev, sizeof(*sport), GFP_KERNEL); ··· 2742 2741 2743 2742 if (lpuart_is_32(sport)) { 2744 2743 lpuart_reg.cons = LPUART32_CONSOLE; 2745 - ret = devm_request_irq(&pdev->dev, sport->port.irq, lpuart32_int, 0, 2746 - DRIVER_NAME, sport); 2744 + handler = lpuart32_int; 2747 2745 } else { 2748 2746 lpuart_reg.cons = LPUART_CONSOLE; 2749 - ret = devm_request_irq(&pdev->dev, sport->port.irq, lpuart_int, 0, 2750 - DRIVER_NAME, sport); 2747 + handler = lpuart_int; 2751 2748 } 2752 - 2753 - if (ret) 2754 - goto failed_irq_request; 2755 - 2756 2749 ret = uart_add_one_port(&lpuart_reg, &sport->port); 2757 2750 if (ret) 2758 2751 goto failed_attach_port; ··· 2768 2773 2769 2774 sport->port.rs485_config(&sport->port, &sport->port.rs485); 2770 2775 2776 + ret = devm_request_irq(&pdev->dev, sport->port.irq, handler, 0, 2777 + DRIVER_NAME, sport); 2778 + if (ret) 2779 + goto failed_irq_request; 2780 + 2771 2781 return 0; 2772 2782 2783 + failed_irq_request: 2773 2784 failed_get_rs485: 2774 2785 failed_reset: 2775 2786 uart_remove_one_port(&lpuart_reg, &sport->port); 2776 2787 failed_attach_port: 2777 - failed_irq_request: 2778 2788 lpuart_disable_clks(sport); 2779 2789 failed_clock_enable: 2780 2790 failed_out_of_range: