--- zzzz-none-000/linux-3.10.107/drivers/tty/serial/sunzilog.c 2017-06-27 09:49:32.000000000 +0000 +++ scorpion-7490-727/linux-3.10.107/drivers/tty/serial/sunzilog.c 2021-02-04 17:41:59.000000000 +0000 @@ -319,7 +319,7 @@ serio_interrupt(&up->serio, ch, 0); #endif break; - }; + } } } @@ -644,7 +644,8 @@ /* The port lock is held and interrupts are disabled. */ static void sunzilog_set_mctrl(struct uart_port *port, unsigned int mctrl) { - struct uart_sunzilog_port *up = (struct uart_sunzilog_port *) port; + struct uart_sunzilog_port *up = + container_of(port, struct uart_sunzilog_port, port); struct zilog_channel __iomem *channel = ZILOG_CHANNEL_FROM_PORT(port); unsigned char set_bits, clear_bits; @@ -668,7 +669,8 @@ /* The port lock is held and interrupts are disabled. */ static void sunzilog_stop_tx(struct uart_port *port) { - struct uart_sunzilog_port *up = (struct uart_sunzilog_port *) port; + struct uart_sunzilog_port *up = + container_of(port, struct uart_sunzilog_port, port); up->flags |= SUNZILOG_FLAG_TX_STOPPED; } @@ -676,7 +678,8 @@ /* The port lock is held and interrupts are disabled. */ static void sunzilog_start_tx(struct uart_port *port) { - struct uart_sunzilog_port *up = (struct uart_sunzilog_port *) port; + struct uart_sunzilog_port *up = + container_of(port, struct uart_sunzilog_port, port); struct zilog_channel __iomem *channel = ZILOG_CHANNEL_FROM_PORT(port); unsigned char status; @@ -703,6 +706,8 @@ } else { struct circ_buf *xmit = &port->state->xmit; + if (uart_circ_empty(xmit)) + return; writeb(xmit->buf[xmit->tail], &channel->data); ZSDELAY(); ZS_WSYNC(channel); @@ -734,7 +739,8 @@ /* The port lock is held. */ static void sunzilog_enable_ms(struct uart_port *port) { - struct uart_sunzilog_port *up = (struct uart_sunzilog_port *) port; + struct uart_sunzilog_port *up = + container_of(port, struct uart_sunzilog_port, port); struct zilog_channel __iomem *channel = ZILOG_CHANNEL_FROM_PORT(port); unsigned char new_reg; @@ -750,7 +756,8 @@ /* The port lock is not held. */ static void sunzilog_break_ctl(struct uart_port *port, int break_state) { - struct uart_sunzilog_port *up = (struct uart_sunzilog_port *) port; + struct uart_sunzilog_port *up = + container_of(port, struct uart_sunzilog_port, port); struct zilog_channel __iomem *channel = ZILOG_CHANNEL_FROM_PORT(port); unsigned char set_bits, clear_bits, new_reg; unsigned long flags; @@ -897,7 +904,7 @@ up->curregs[R5] |= Tx8; up->parity_mask = 0xff; break; - }; + } up->curregs[R4] &= ~0x0c; if (cflag & CSTOPB) up->curregs[R4] |= SB2; @@ -915,7 +922,7 @@ up->port.read_status_mask = Rx_OVR; if (iflag & INPCK) up->port.read_status_mask |= CRC_ERR | PAR_ERR; - if (iflag & (BRKINT | PARMRK)) + if (iflag & (IGNBRK | BRKINT | PARMRK)) up->port.read_status_mask |= BRK_ABRT; up->port.ignore_status_mask = 0; @@ -936,7 +943,8 @@ sunzilog_set_termios(struct uart_port *port, struct ktermios *termios, struct ktermios *old) { - struct uart_sunzilog_port *up = (struct uart_sunzilog_port *) port; + struct uart_sunzilog_port *up = + container_of(port, struct uart_sunzilog_port, port); unsigned long flags; int baud, brg; @@ -996,7 +1004,8 @@ static int sunzilog_get_poll_char(struct uart_port *port) { unsigned char ch, r1; - struct uart_sunzilog_port *up = (struct uart_sunzilog_port *) port; + struct uart_sunzilog_port *up = + container_of(port, struct uart_sunzilog_port, port); struct zilog_channel __iomem *channel = ZILOG_CHANNEL_FROM_PORT(&up->port); @@ -1030,7 +1039,8 @@ static void sunzilog_put_poll_char(struct uart_port *port, unsigned char ch) { - struct uart_sunzilog_port *up = (struct uart_sunzilog_port *)port; + struct uart_sunzilog_port *up = + container_of(port, struct uart_sunzilog_port, port); sunzilog_putchar(&up->port, ch); } @@ -1195,20 +1205,16 @@ unsigned long flags; int locked = 1; - local_irq_save(flags); - if (up->port.sysrq) { - locked = 0; - } else if (oops_in_progress) { - locked = spin_trylock(&up->port.lock); - } else - spin_lock(&up->port.lock); + if (up->port.sysrq || oops_in_progress) + locked = spin_trylock_irqsave(&up->port.lock, flags); + else + spin_lock_irqsave(&up->port.lock, flags); uart_console_write(&up->port, s, count, sunzilog_putchar); udelay(2); if (locked) - spin_unlock(&up->port.lock); - local_irq_restore(flags); + spin_unlock_irqrestore(&up->port.lock, flags); } static int __init sunzilog_console_setup(struct console *con, char *options) @@ -1239,7 +1245,7 @@ default: case B9600: baud = 9600; break; case B19200: baud = 19200; break; case B38400: baud = 38400; break; - }; + } brg = BPS_TO_BRG(baud, ZS_CLOCK / ZS_CLOCK_DIVISOR); @@ -1495,7 +1501,7 @@ kbm_inst++; } - dev_set_drvdata(&op->dev, &up[0]); + platform_set_drvdata(op, &up[0]); return 0; } @@ -1512,7 +1518,7 @@ static int zs_remove(struct platform_device *op) { - struct uart_sunzilog_port *up = dev_get_drvdata(&op->dev); + struct uart_sunzilog_port *up = platform_get_drvdata(op); struct zilog_layout __iomem *regs; zs_remove_one(&up[0]); @@ -1521,8 +1527,6 @@ regs = sunzilog_chip_regs[up[0].port.line / 2]; of_iounmap(&op->resource[0], regs, sizeof(struct zilog_layout)); - dev_set_drvdata(&op->dev, NULL); - return 0; } @@ -1537,7 +1541,6 @@ static struct platform_driver zs_driver = { .driver = { .name = "zs", - .owner = THIS_MODULE, .of_match_table = zs_match, }, .probe = zs_probe,