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.0-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty

Pull tty/serial driver fixes from Greg KH:
"Here are a number of small tty core and serial driver fixes for
5.0-rc4 to resolve some reported issues.

Nothing major, the small serial driver fixes, a tty core fixup for a
crash that was reported, and some good vt fixes from Nicolas Pitre as
he seems to be auditing that chunk of code a lot lately.

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

* tag 'tty-5.0-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty:
serial: fsl_lpuart: fix maximum acceptable baud rate with over-sampling
tty: serial: qcom_geni_serial: Allow mctrl when flow control is disabled
tty: Handle problem if line discipline does not have receive_buf
vgacon: unconfuse vc_origin when using soft scrollback
vt: invoke notifier on screen size change
vt: always call notifier with the console lock held
vt: make vt_console_print() compatible with the unicode screen buffer
tty/n_hdlc: fix __might_sleep warning
serial: 8250: Fix serial8250 initialization crash
uart: Fix crash in uart_write and uart_put_char

+47 -55
+1
drivers/tty/n_hdlc.c
··· 597 597 /* too large for caller's buffer */ 598 598 ret = -EOVERFLOW; 599 599 } else { 600 + __set_current_state(TASK_RUNNING); 600 601 if (copy_to_user(buf, rbuf->buf, rbuf->count)) 601 602 ret = -EFAULT; 602 603 else
+9 -8
drivers/tty/serial/8250/8250_core.c
··· 1070 1070 1071 1071 ret = 0; 1072 1072 } 1073 - } 1074 1073 1075 - /* Initialise interrupt backoff work if required */ 1076 - if (up->overrun_backoff_time_ms > 0) { 1077 - uart->overrun_backoff_time_ms = up->overrun_backoff_time_ms; 1078 - INIT_DELAYED_WORK(&uart->overrun_backoff, 1079 - serial_8250_overrun_backoff_work); 1080 - } else { 1081 - uart->overrun_backoff_time_ms = 0; 1074 + /* Initialise interrupt backoff work if required */ 1075 + if (up->overrun_backoff_time_ms > 0) { 1076 + uart->overrun_backoff_time_ms = 1077 + up->overrun_backoff_time_ms; 1078 + INIT_DELAYED_WORK(&uart->overrun_backoff, 1079 + serial_8250_overrun_backoff_work); 1080 + } else { 1081 + uart->overrun_backoff_time_ms = 0; 1082 + } 1082 1083 } 1083 1084 1084 1085 mutex_unlock(&serial_mutex);
+1 -1
drivers/tty/serial/fsl_lpuart.c
··· 1697 1697 } 1698 1698 1699 1699 /* ask the core to calculate the divisor */ 1700 - baud = uart_get_baud_rate(port, termios, old, 50, port->uartclk / 16); 1700 + baud = uart_get_baud_rate(port, termios, old, 50, port->uartclk / 4); 1701 1701 1702 1702 spin_lock_irqsave(&sport->port.lock, flags); 1703 1703
+2 -2
drivers/tty/serial/qcom_geni_serial.c
··· 225 225 unsigned int mctrl = TIOCM_DSR | TIOCM_CAR; 226 226 u32 geni_ios; 227 227 228 - if (uart_console(uport) || !uart_cts_enabled(uport)) { 228 + if (uart_console(uport)) { 229 229 mctrl |= TIOCM_CTS; 230 230 } else { 231 231 geni_ios = readl_relaxed(uport->membase + SE_GENI_IOS); ··· 241 241 { 242 242 u32 uart_manual_rfr = 0; 243 243 244 - if (uart_console(uport) || !uart_cts_enabled(uport)) 244 + if (uart_console(uport)) 245 245 return; 246 246 247 247 if (!(mctrl & TIOCM_RTS))
+11 -7
drivers/tty/serial/serial_core.c
··· 550 550 int ret = 0; 551 551 552 552 circ = &state->xmit; 553 - if (!circ->buf) 554 - return 0; 555 - 556 553 port = uart_port_lock(state, flags); 554 + if (!circ->buf) { 555 + uart_port_unlock(port, flags); 556 + return 0; 557 + } 558 + 557 559 if (port && uart_circ_chars_free(circ) != 0) { 558 560 circ->buf[circ->head] = c; 559 561 circ->head = (circ->head + 1) & (UART_XMIT_SIZE - 1); ··· 588 586 return -EL3HLT; 589 587 } 590 588 591 - circ = &state->xmit; 592 - if (!circ->buf) 593 - return 0; 594 - 595 589 port = uart_port_lock(state, flags); 590 + circ = &state->xmit; 591 + if (!circ->buf) { 592 + uart_port_unlock(port, flags); 593 + return 0; 594 + } 595 + 596 596 while (port) { 597 597 c = CIRC_SPACE_TO_END(circ->head, circ->tail, UART_XMIT_SIZE); 598 598 if (count < c)
+2 -1
drivers/tty/tty_io.c
··· 2189 2189 ld = tty_ldisc_ref_wait(tty); 2190 2190 if (!ld) 2191 2191 return -EIO; 2192 - ld->ops->receive_buf(tty, &ch, &mbz, 1); 2192 + if (ld->ops->receive_buf) 2193 + ld->ops->receive_buf(tty, &ch, &mbz, 1); 2193 2194 tty_ldisc_deref(ld); 2194 2195 return 0; 2195 2196 }
+17 -33
drivers/tty/vt/vt.c
··· 1272 1272 if (con_is_visible(vc)) 1273 1273 update_screen(vc); 1274 1274 vt_event_post(VT_EVENT_RESIZE, vc->vc_num, vc->vc_num); 1275 + notify_update(vc); 1275 1276 return err; 1276 1277 } 1277 1278 ··· 2765 2764 con_flush(vc, draw_from, draw_to, &draw_x); 2766 2765 vc_uniscr_debug_check(vc); 2767 2766 console_conditional_schedule(); 2768 - console_unlock(); 2769 2767 notify_update(vc); 2768 + console_unlock(); 2770 2769 return n; 2771 2770 } 2772 2771 ··· 2885 2884 unsigned char c; 2886 2885 static DEFINE_SPINLOCK(printing_lock); 2887 2886 const ushort *start; 2888 - ushort cnt = 0; 2889 - ushort myx; 2887 + ushort start_x, cnt; 2890 2888 int kmsg_console; 2891 2889 2892 2890 /* console busy or not yet initialized */ ··· 2897 2897 kmsg_console = vt_get_kmsg_redirect(); 2898 2898 if (kmsg_console && vc_cons_allocated(kmsg_console - 1)) 2899 2899 vc = vc_cons[kmsg_console - 1].d; 2900 - 2901 - /* read `x' only after setting currcons properly (otherwise 2902 - the `x' macro will read the x of the foreground console). */ 2903 - myx = vc->vc_x; 2904 2900 2905 2901 if (!vc_cons_allocated(fg_console)) { 2906 2902 /* impossible */ ··· 2912 2916 hide_cursor(vc); 2913 2917 2914 2918 start = (ushort *)vc->vc_pos; 2915 - 2916 - /* Contrived structure to try to emulate original need_wrap behaviour 2917 - * Problems caused when we have need_wrap set on '\n' character */ 2919 + start_x = vc->vc_x; 2920 + cnt = 0; 2918 2921 while (count--) { 2919 2922 c = *b++; 2920 2923 if (c == 10 || c == 13 || c == 8 || vc->vc_need_wrap) { 2921 - if (cnt > 0) { 2922 - if (con_is_visible(vc)) 2923 - vc->vc_sw->con_putcs(vc, start, cnt, vc->vc_y, vc->vc_x); 2924 - vc->vc_x += cnt; 2925 - if (vc->vc_need_wrap) 2926 - vc->vc_x--; 2927 - cnt = 0; 2928 - } 2924 + if (cnt && con_is_visible(vc)) 2925 + vc->vc_sw->con_putcs(vc, start, cnt, vc->vc_y, start_x); 2926 + cnt = 0; 2929 2927 if (c == 8) { /* backspace */ 2930 2928 bs(vc); 2931 2929 start = (ushort *)vc->vc_pos; 2932 - myx = vc->vc_x; 2930 + start_x = vc->vc_x; 2933 2931 continue; 2934 2932 } 2935 2933 if (c != 13) 2936 2934 lf(vc); 2937 2935 cr(vc); 2938 2936 start = (ushort *)vc->vc_pos; 2939 - myx = vc->vc_x; 2937 + start_x = vc->vc_x; 2940 2938 if (c == 10 || c == 13) 2941 2939 continue; 2942 2940 } 2941 + vc_uniscr_putc(vc, c); 2943 2942 scr_writew((vc->vc_attr << 8) + c, (unsigned short *)vc->vc_pos); 2944 2943 notify_write(vc, c); 2945 2944 cnt++; 2946 - if (myx == vc->vc_cols - 1) { 2945 + if (vc->vc_x == vc->vc_cols - 1) { 2947 2946 vc->vc_need_wrap = 1; 2948 - continue; 2949 - } 2950 - vc->vc_pos += 2; 2951 - myx++; 2952 - } 2953 - if (cnt > 0) { 2954 - if (con_is_visible(vc)) 2955 - vc->vc_sw->con_putcs(vc, start, cnt, vc->vc_y, vc->vc_x); 2956 - vc->vc_x += cnt; 2957 - if (vc->vc_x == vc->vc_cols) { 2958 - vc->vc_x--; 2959 - vc->vc_need_wrap = 1; 2947 + } else { 2948 + vc->vc_pos += 2; 2949 + vc->vc_x++; 2960 2950 } 2961 2951 } 2952 + if (cnt && con_is_visible(vc)) 2953 + vc->vc_sw->con_putcs(vc, start, cnt, vc->vc_y, start_x); 2962 2954 set_cursor(vc); 2963 2955 notify_update(vc); 2964 2956
+4 -3
drivers/video/console/vgacon.c
··· 271 271 272 272 static void vgacon_restore_screen(struct vc_data *c) 273 273 { 274 + c->vc_origin = c->vc_visible_origin; 274 275 vgacon_scrollback_cur->save = 0; 275 276 276 277 if (!vga_is_gfx && !vgacon_scrollback_cur->restore) { ··· 288 287 int start, end, count, soff; 289 288 290 289 if (!lines) { 291 - c->vc_visible_origin = c->vc_origin; 292 - vga_set_mem_top(c); 290 + vgacon_restore_screen(c); 293 291 return; 294 292 } 295 293 ··· 298 298 if (!vgacon_scrollback_cur->save) { 299 299 vgacon_cursor(c, CM_ERASE); 300 300 vgacon_save_screen(c); 301 + c->vc_origin = (unsigned long)c->vc_screenbuf; 301 302 vgacon_scrollback_cur->save = 1; 302 303 } 303 304 ··· 336 335 int copysize; 337 336 338 337 int diff = c->vc_rows - count; 339 - void *d = (void *) c->vc_origin; 338 + void *d = (void *) c->vc_visible_origin; 340 339 void *s = (void *) c->vc_screenbuf; 341 340 342 341 count *= c->vc_size_row;