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

Configure Feed

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

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

Pull tty/serial fixes from Greg KH:
"Here are some tty and serial driver fixes for 4.0-rc3.

Along with the atime fix that you know about, here are some other
serial driver bugfixes as well. Most notable is a wait_until_sent
bugfix that was traced back to being around since before 2.6.12 that
Johan has fixed up.

All have been in linux-next successfully"

* tag 'tty-4.0-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty:
TTY: fix tty_wait_until_sent maximum timeout
TTY: fix tty_wait_until_sent on 64-bit machines
USB: serial: fix infinite wait_until_sent timeout
TTY: bfin_jtag_comm: remove incorrect wait_until_sent operation
net: irda: fix wait_until_sent poll timeout
serial: uapi: Declare all userspace-visible io types
serial: core: Fix iotype userspace breakage
serial: sprd: Fix missing spin_unlock in sprd_handle_irq()
console: Fix console name size mismatch
tty: fix up atime/mtime mess, take four
serial: 8250_dw: Fix get_mctrl behaviour
serial:8250:8250_pci: delete unneeded quirk entries
serial:8250:8250_pci: fix redundant entry report for WCH_CH352_2S
Change email address for 8250_pci
serial: 8250: Revert "tty: serial: 8250_core: read only RX if there is something in the FIFO"
Revert "tty/serial: of_serial: add DT alias ID handling"

+89 -61
+16
Documentation/devicetree/bindings/serial/snps-dw-apb-uart.txt
··· 21 - reg-io-width : the size (in bytes) of the IO accesses that should be 22 performed on the device. If this property is not present then single byte 23 accesses are used. 24 25 Example: 26 ··· 43 interrupts = <10>; 44 reg-shift = <2>; 45 reg-io-width = <4>; 46 }; 47 48 Example with one clock:
··· 21 - reg-io-width : the size (in bytes) of the IO accesses that should be 22 performed on the device. If this property is not present then single byte 23 accesses are used. 24 + - dcd-override : Override the DCD modem status signal. This signal will always 25 + be reported as active instead of being obtained from the modem status 26 + register. Define this if your serial port does not use this pin. 27 + - dsr-override : Override the DTS modem status signal. This signal will always 28 + be reported as active instead of being obtained from the modem status 29 + register. Define this if your serial port does not use this pin. 30 + - cts-override : Override the CTS modem status signal. This signal will always 31 + be reported as active instead of being obtained from the modem status 32 + register. Define this if your serial port does not use this pin. 33 + - ri-override : Override the RI modem status signal. This signal will always be 34 + reported as inactive instead of being obtained from the modem status register. 35 + Define this if your serial port does not use this pin. 36 37 Example: 38 ··· 31 interrupts = <10>; 32 reg-shift = <2>; 33 reg-io-width = <4>; 34 + dcd-override; 35 + dsr-override; 36 + cts-override; 37 + ri-override; 38 }; 39 40 Example with one clock:
-13
drivers/tty/bfin_jtag_comm.c
··· 210 return circ_cnt(&bfin_jc_write_buf); 211 } 212 213 - static void 214 - bfin_jc_wait_until_sent(struct tty_struct *tty, int timeout) 215 - { 216 - unsigned long expire = jiffies + timeout; 217 - while (!circ_empty(&bfin_jc_write_buf)) { 218 - if (signal_pending(current)) 219 - break; 220 - if (time_after(jiffies, expire)) 221 - break; 222 - } 223 - } 224 - 225 static const struct tty_operations bfin_jc_ops = { 226 .open = bfin_jc_open, 227 .close = bfin_jc_close, ··· 218 .flush_chars = bfin_jc_flush_chars, 219 .write_room = bfin_jc_write_room, 220 .chars_in_buffer = bfin_jc_chars_in_buffer, 221 - .wait_until_sent = bfin_jc_wait_until_sent, 222 }; 223 224 static int __init bfin_jc_init(void)
··· 210 return circ_cnt(&bfin_jc_write_buf); 211 } 212 213 static const struct tty_operations bfin_jc_ops = { 214 .open = bfin_jc_open, 215 .close = bfin_jc_close, ··· 230 .flush_chars = bfin_jc_flush_chars, 231 .write_room = bfin_jc_write_room, 232 .chars_in_buffer = bfin_jc_chars_in_buffer, 233 }; 234 235 static int __init bfin_jc_init(void)
+5 -6
drivers/tty/serial/8250/8250_core.c
··· 2138 /* 2139 * Clear the interrupt registers. 2140 */ 2141 - if (serial_port_in(port, UART_LSR) & UART_LSR_DR) 2142 - serial_port_in(port, UART_RX); 2143 serial_port_in(port, UART_IIR); 2144 serial_port_in(port, UART_MSR); 2145 ··· 2300 * saved flags to avoid getting false values from polling 2301 * routines or the previous session. 2302 */ 2303 - if (serial_port_in(port, UART_LSR) & UART_LSR_DR) 2304 - serial_port_in(port, UART_RX); 2305 serial_port_in(port, UART_IIR); 2306 serial_port_in(port, UART_MSR); 2307 up->lsr_saved_flags = 0; ··· 2394 * Read data port to reset things, and then unlink from 2395 * the IRQ chain. 2396 */ 2397 - if (serial_port_in(port, UART_LSR) & UART_LSR_DR) 2398 - serial_port_in(port, UART_RX); 2399 serial8250_rpm_put(up); 2400 2401 del_timer_sync(&up->timer);
··· 2138 /* 2139 * Clear the interrupt registers. 2140 */ 2141 + serial_port_in(port, UART_LSR); 2142 + serial_port_in(port, UART_RX); 2143 serial_port_in(port, UART_IIR); 2144 serial_port_in(port, UART_MSR); 2145 ··· 2300 * saved flags to avoid getting false values from polling 2301 * routines or the previous session. 2302 */ 2303 + serial_port_in(port, UART_LSR); 2304 + serial_port_in(port, UART_RX); 2305 serial_port_in(port, UART_IIR); 2306 serial_port_in(port, UART_MSR); 2307 up->lsr_saved_flags = 0; ··· 2394 * Read data port to reset things, and then unlink from 2395 * the IRQ chain. 2396 */ 2397 + serial_port_in(port, UART_RX); 2398 serial8250_rpm_put(up); 2399 2400 del_timer_sync(&up->timer);
+32
drivers/tty/serial/8250/8250_dw.c
··· 59 u8 usr_reg; 60 int last_mcr; 61 int line; 62 struct clk *clk; 63 struct clk *pclk; 64 struct reset_control *rst; ··· 81 if (offset == UART_MSR && d->last_mcr & UART_MCR_AFE) { 82 value |= UART_MSR_CTS; 83 value &= ~UART_MSR_DCTS; 84 } 85 86 return value; ··· 341 id = of_alias_get_id(np, "serial"); 342 if (id >= 0) 343 p->line = id; 344 345 /* clock got configured through clk api, all done */ 346 if (p->uartclk)
··· 59 u8 usr_reg; 60 int last_mcr; 61 int line; 62 + int msr_mask_on; 63 + int msr_mask_off; 64 struct clk *clk; 65 struct clk *pclk; 66 struct reset_control *rst; ··· 79 if (offset == UART_MSR && d->last_mcr & UART_MCR_AFE) { 80 value |= UART_MSR_CTS; 81 value &= ~UART_MSR_DCTS; 82 + } 83 + 84 + /* Override any modem control signals if needed */ 85 + if (offset == UART_MSR) { 86 + value |= d->msr_mask_on; 87 + value &= ~d->msr_mask_off; 88 } 89 90 return value; ··· 333 id = of_alias_get_id(np, "serial"); 334 if (id >= 0) 335 p->line = id; 336 + 337 + if (of_property_read_bool(np, "dcd-override")) { 338 + /* Always report DCD as active */ 339 + data->msr_mask_on |= UART_MSR_DCD; 340 + data->msr_mask_off |= UART_MSR_DDCD; 341 + } 342 + 343 + if (of_property_read_bool(np, "dsr-override")) { 344 + /* Always report DSR as active */ 345 + data->msr_mask_on |= UART_MSR_DSR; 346 + data->msr_mask_off |= UART_MSR_DDSR; 347 + } 348 + 349 + if (of_property_read_bool(np, "cts-override")) { 350 + /* Always report DSR as active */ 351 + data->msr_mask_on |= UART_MSR_DSR; 352 + data->msr_mask_off |= UART_MSR_DDSR; 353 + } 354 + 355 + if (of_property_read_bool(np, "ri-override")) { 356 + /* Always report Ring indicator as inactive */ 357 + data->msr_mask_off |= UART_MSR_RI; 358 + data->msr_mask_off |= UART_MSR_TERI; 359 + } 360 361 /* clock got configured through clk api, all done */ 362 if (p->uartclk)
+1 -19
drivers/tty/serial/8250/8250_pci.c
··· 69 "Please send the output of lspci -vv, this\n" 70 "message (0x%04x,0x%04x,0x%04x,0x%04x), the\n" 71 "manufacturer and name of serial board or\n" 72 - "modem board to rmk+serial@arm.linux.org.uk.\n", 73 pci_name(dev), str, dev->vendor, dev->device, 74 dev->subsystem_vendor, dev->subsystem_device); 75 } ··· 1989 }, 1990 { 1991 .vendor = PCI_VENDOR_ID_INTEL, 1992 - .device = PCI_DEVICE_ID_INTEL_QRK_UART, 1993 - .subvendor = PCI_ANY_ID, 1994 - .subdevice = PCI_ANY_ID, 1995 - .setup = pci_default_setup, 1996 - }, 1997 - { 1998 - .vendor = PCI_VENDOR_ID_INTEL, 1999 .device = PCI_DEVICE_ID_INTEL_BSW_UART1, 2000 .subvendor = PCI_ANY_ID, 2001 .subdevice = PCI_ANY_ID, ··· 2192 /* 2193 * PLX 2194 */ 2195 - { 2196 - .vendor = PCI_VENDOR_ID_PLX, 2197 - .device = PCI_DEVICE_ID_PLX_9030, 2198 - .subvendor = PCI_SUBVENDOR_ID_PERLE, 2199 - .subdevice = PCI_ANY_ID, 2200 - .setup = pci_default_setup, 2201 - }, 2202 { 2203 .vendor = PCI_VENDOR_ID_PLX, 2204 .device = PCI_DEVICE_ID_PLX_9050, ··· 5398 0, 0, pbn_b0_bt_4_115200 }, 5399 5400 { PCI_VENDOR_ID_WCH, PCI_DEVICE_ID_WCH_CH353_2S1PF, 5401 - PCI_ANY_ID, PCI_ANY_ID, 5402 - 0, 0, pbn_b0_bt_2_115200 }, 5403 - 5404 - { PCI_VENDOR_ID_WCH, PCI_DEVICE_ID_WCH_CH352_2S, 5405 PCI_ANY_ID, PCI_ANY_ID, 5406 0, 0, pbn_b0_bt_2_115200 }, 5407
··· 69 "Please send the output of lspci -vv, this\n" 70 "message (0x%04x,0x%04x,0x%04x,0x%04x), the\n" 71 "manufacturer and name of serial board or\n" 72 + "modem board to <linux-serial@vger.kernel.org>.\n", 73 pci_name(dev), str, dev->vendor, dev->device, 74 dev->subsystem_vendor, dev->subsystem_device); 75 } ··· 1989 }, 1990 { 1991 .vendor = PCI_VENDOR_ID_INTEL, 1992 .device = PCI_DEVICE_ID_INTEL_BSW_UART1, 1993 .subvendor = PCI_ANY_ID, 1994 .subdevice = PCI_ANY_ID, ··· 2199 /* 2200 * PLX 2201 */ 2202 { 2203 .vendor = PCI_VENDOR_ID_PLX, 2204 .device = PCI_DEVICE_ID_PLX_9050, ··· 5412 0, 0, pbn_b0_bt_4_115200 }, 5413 5414 { PCI_VENDOR_ID_WCH, PCI_DEVICE_ID_WCH_CH353_2S1PF, 5415 PCI_ANY_ID, PCI_ANY_ID, 5416 0, 0, pbn_b0_bt_2_115200 }, 5417
-4
drivers/tty/serial/of_serial.c
··· 133 if (of_find_property(np, "no-loopback-test", NULL)) 134 port->flags |= UPF_SKIP_TEST; 135 136 - ret = of_alias_get_id(np, "serial"); 137 - if (ret >= 0) 138 - port->line = ret; 139 - 140 port->dev = &ofdev->dev; 141 142 switch (type) {
··· 133 if (of_find_property(np, "no-loopback-test", NULL)) 134 port->flags |= UPF_SKIP_TEST; 135 136 port->dev = &ofdev->dev; 137 138 switch (type) {
+3 -1
drivers/tty/serial/sprd_serial.c
··· 293 294 ims = serial_in(port, SPRD_IMSR); 295 296 - if (!ims) 297 return IRQ_NONE; 298 299 serial_out(port, SPRD_ICLR, ~0); 300
··· 293 294 ims = serial_in(port, SPRD_IMSR); 295 296 + if (!ims) { 297 + spin_unlock(&port->lock); 298 return IRQ_NONE; 299 + } 300 301 serial_out(port, SPRD_ICLR, ~0); 302
+2 -2
drivers/tty/tty_io.c
··· 1028 /* We limit tty time update visibility to every 8 seconds or so. */ 1029 static void tty_update_time(struct timespec *time) 1030 { 1031 - unsigned long sec = get_seconds() & ~7; 1032 - if ((long)(sec - time->tv_sec) > 0) 1033 time->tv_sec = sec; 1034 } 1035
··· 1028 /* We limit tty time update visibility to every 8 seconds or so. */ 1029 static void tty_update_time(struct timespec *time) 1030 { 1031 + unsigned long sec = get_seconds(); 1032 + if (abs(sec - time->tv_sec) & ~7) 1033 time->tv_sec = sec; 1034 } 1035
+11 -5
drivers/tty/tty_ioctl.c
··· 217 #endif 218 if (!timeout) 219 timeout = MAX_SCHEDULE_TIMEOUT; 220 - if (wait_event_interruptible_timeout(tty->write_wait, 221 - !tty_chars_in_buffer(tty), timeout) >= 0) { 222 - if (tty->ops->wait_until_sent) 223 - tty->ops->wait_until_sent(tty, timeout); 224 - } 225 } 226 EXPORT_SYMBOL(tty_wait_until_sent); 227
··· 217 #endif 218 if (!timeout) 219 timeout = MAX_SCHEDULE_TIMEOUT; 220 + 221 + timeout = wait_event_interruptible_timeout(tty->write_wait, 222 + !tty_chars_in_buffer(tty), timeout); 223 + if (timeout <= 0) 224 + return; 225 + 226 + if (timeout == MAX_SCHEDULE_TIMEOUT) 227 + timeout = 0; 228 + 229 + if (tty->ops->wait_until_sent) 230 + tty->ops->wait_until_sent(tty, timeout); 231 } 232 EXPORT_SYMBOL(tty_wait_until_sent); 233
+3 -2
drivers/usb/serial/generic.c
··· 258 * character or at least one jiffy. 259 */ 260 period = max_t(unsigned long, (10 * HZ / bps), 1); 261 - period = min_t(unsigned long, period, timeout); 262 263 dev_dbg(&port->dev, "%s - timeout = %u ms, period = %u ms\n", 264 __func__, jiffies_to_msecs(timeout), ··· 269 schedule_timeout_interruptible(period); 270 if (signal_pending(current)) 271 break; 272 - if (time_after(jiffies, expire)) 273 break; 274 } 275 }
··· 258 * character or at least one jiffy. 259 */ 260 period = max_t(unsigned long, (10 * HZ / bps), 1); 261 + if (timeout) 262 + period = min_t(unsigned long, period, timeout); 263 264 dev_dbg(&port->dev, "%s - timeout = %u ms, period = %u ms\n", 265 __func__, jiffies_to_msecs(timeout), ··· 268 schedule_timeout_interruptible(period); 269 if (signal_pending(current)) 270 break; 271 + if (timeout && time_after(jiffies, expire)) 272 break; 273 } 274 }
+7 -7
include/linux/serial_core.h
··· 143 unsigned char iotype; /* io access style */ 144 unsigned char unused1; 145 146 - #define UPIO_PORT (0) /* 8b I/O port access */ 147 - #define UPIO_HUB6 (1) /* Hub6 ISA card */ 148 - #define UPIO_MEM (2) /* 8b MMIO access */ 149 - #define UPIO_MEM32 (3) /* 32b little endian */ 150 - #define UPIO_MEM32BE (4) /* 32b big endian */ 151 - #define UPIO_AU (5) /* Au1x00 and RT288x type IO */ 152 - #define UPIO_TSI (6) /* Tsi108/109 type IO */ 153 154 unsigned int read_status_mask; /* driver specific */ 155 unsigned int ignore_status_mask; /* driver specific */
··· 143 unsigned char iotype; /* io access style */ 144 unsigned char unused1; 145 146 + #define UPIO_PORT (SERIAL_IO_PORT) /* 8b I/O port access */ 147 + #define UPIO_HUB6 (SERIAL_IO_HUB6) /* Hub6 ISA card */ 148 + #define UPIO_MEM (SERIAL_IO_MEM) /* 8b MMIO access */ 149 + #define UPIO_MEM32 (SERIAL_IO_MEM32) /* 32b little endian */ 150 + #define UPIO_AU (SERIAL_IO_AU) /* Au1x00 and RT288x type IO */ 151 + #define UPIO_TSI (SERIAL_IO_TSI) /* Tsi108/109 type IO */ 152 + #define UPIO_MEM32BE (SERIAL_IO_MEM32BE) /* 32b big endian */ 153 154 unsigned int read_status_mask; /* driver specific */ 155 unsigned int ignore_status_mask; /* driver specific */
+4
include/uapi/linux/serial.h
··· 65 #define SERIAL_IO_PORT 0 66 #define SERIAL_IO_HUB6 1 67 #define SERIAL_IO_MEM 2 68 69 #define UART_CLEAR_FIFO 0x01 70 #define UART_USE_FIFO 0x02
··· 65 #define SERIAL_IO_PORT 0 66 #define SERIAL_IO_HUB6 1 67 #define SERIAL_IO_MEM 2 68 + #define SERIAL_IO_MEM32 3 69 + #define SERIAL_IO_AU 4 70 + #define SERIAL_IO_TSI 5 71 + #define SERIAL_IO_MEM32BE 6 72 73 #define UART_CLEAR_FIFO 0x01 74 #define UART_USE_FIFO 0x02
+1 -1
kernel/printk/console_cmdline.h
··· 3 4 struct console_cmdline 5 { 6 - char name[8]; /* Name of the driver */ 7 int index; /* Minor dev. to use */ 8 char *options; /* Options for the driver */ 9 #ifdef CONFIG_A11Y_BRAILLE_CONSOLE
··· 3 4 struct console_cmdline 5 { 6 + char name[16]; /* Name of the driver */ 7 int index; /* Minor dev. to use */ 8 char *options; /* Options for the driver */ 9 #ifdef CONFIG_A11Y_BRAILLE_CONSOLE
+1
kernel/printk/printk.c
··· 2464 for (i = 0, c = console_cmdline; 2465 i < MAX_CMDLINECONSOLES && c->name[0]; 2466 i++, c++) { 2467 if (strcmp(c->name, newcon->name) != 0) 2468 continue; 2469 if (newcon->index >= 0 &&
··· 2464 for (i = 0, c = console_cmdline; 2465 i < MAX_CMDLINECONSOLES && c->name[0]; 2466 i++, c++) { 2467 + BUILD_BUG_ON(sizeof(c->name) != sizeof(newcon->name)); 2468 if (strcmp(c->name, newcon->name) != 0) 2469 continue; 2470 if (newcon->index >= 0 &&
+3 -1
net/irda/ircomm/ircomm_tty.c
··· 798 orig_jiffies = jiffies; 799 800 /* Set poll time to 200 ms */ 801 - poll_time = IRDA_MIN(timeout, msecs_to_jiffies(200)); 802 803 spin_lock_irqsave(&self->spinlock, flags); 804 while (self->tx_skb && self->tx_skb->len) {
··· 798 orig_jiffies = jiffies; 799 800 /* Set poll time to 200 ms */ 801 + poll_time = msecs_to_jiffies(200); 802 + if (timeout) 803 + poll_time = min_t(unsigned long, timeout, poll_time); 804 805 spin_lock_irqsave(&self->spinlock, flags); 806 while (self->tx_skb && self->tx_skb->len) {