aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarthikeyan Ramasubramanian <kramasub@codeaurora.org>2018-05-03 16:14:34 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-05-14 07:44:54 -0400
commit6a10635e90e8cb000e6aa8f1292f5aed4c8369e3 (patch)
tree907aee9039d8ff3d31eeaeb41b53f835f26c64fa
parentf02625689e543165d840aa0eb9cf2945636de25d (diff)
tty: serial: qcom_geni_serial: Cleanup redundant code
* Remove redundant casting while using min_t * Remove redundant initialization of port_setup flag * Remove redundant error checking in get_tx_fifo_size * Remove logging redundant error code in debug messages * Remove redundant disable_irq before free_irq Signed-off-by: Karthikeyan Ramasubramanian <kramasub@codeaurora.org> Reviewed-by: Stephen Boyd <swboyd@chromium.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/tty/serial/qcom_geni_serial.c21
1 files changed, 6 insertions, 15 deletions
diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c
index dcd22ca33485..9bf0ca7479c0 100644
--- a/drivers/tty/serial/qcom_geni_serial.c
+++ b/drivers/tty/serial/qcom_geni_serial.c
@@ -309,7 +309,7 @@ __qcom_geni_serial_console_write(struct uart_port *uport, const char *s,
309 if (!qcom_geni_serial_poll_bit(uport, SE_GENI_M_IRQ_STATUS, 309 if (!qcom_geni_serial_poll_bit(uport, SE_GENI_M_IRQ_STATUS,
310 M_TX_FIFO_WATERMARK_EN, true)) 310 M_TX_FIFO_WATERMARK_EN, true))
311 break; 311 break;
312 chars_to_write = min_t(size_t, (size_t)(count - i), avail / 2); 312 chars_to_write = min_t(size_t, count - i, avail / 2);
313 uart_console_write(uport, s + i, chars_to_write, 313 uart_console_write(uport, s + i, chars_to_write,
314 qcom_geni_serial_wr_char); 314 qcom_geni_serial_wr_char);
315 writel_relaxed(M_TX_FIFO_WATERMARK_EN, uport->membase + 315 writel_relaxed(M_TX_FIFO_WATERMARK_EN, uport->membase +
@@ -602,7 +602,7 @@ static void qcom_geni_serial_handle_tx(struct uart_port *uport)
602 unsigned int buf = 0; 602 unsigned int buf = 0;
603 int c; 603 int c;
604 604
605 tx_bytes = min_t(size_t, remaining, (size_t)port->tx_bytes_pw); 605 tx_bytes = min_t(size_t, remaining, port->tx_bytes_pw);
606 for (c = 0; c < tx_bytes ; c++) 606 for (c = 0; c < tx_bytes ; c++)
607 buf |= (xmit->buf[tail + c] << (c * BITS_PER_BYTE)); 607 buf |= (xmit->buf[tail + c] << (c * BITS_PER_BYTE));
608 608
@@ -671,20 +671,16 @@ out_unlock:
671 return IRQ_HANDLED; 671 return IRQ_HANDLED;
672} 672}
673 673
674static int get_tx_fifo_size(struct qcom_geni_serial_port *port) 674static void get_tx_fifo_size(struct qcom_geni_serial_port *port)
675{ 675{
676 struct uart_port *uport; 676 struct uart_port *uport;
677 677
678 if (!port)
679 return -ENODEV;
680
681 uport = &port->uport; 678 uport = &port->uport;
682 port->tx_fifo_depth = geni_se_get_tx_fifo_depth(&port->se); 679 port->tx_fifo_depth = geni_se_get_tx_fifo_depth(&port->se);
683 port->tx_fifo_width = geni_se_get_tx_fifo_width(&port->se); 680 port->tx_fifo_width = geni_se_get_tx_fifo_width(&port->se);
684 port->rx_fifo_depth = geni_se_get_rx_fifo_depth(&port->se); 681 port->rx_fifo_depth = geni_se_get_rx_fifo_depth(&port->se);
685 uport->fifosize = 682 uport->fifosize =
686 (port->tx_fifo_depth * port->tx_fifo_width) / BITS_PER_BYTE; 683 (port->tx_fifo_depth * port->tx_fifo_width) / BITS_PER_BYTE;
687 return 0;
688} 684}
689 685
690static void set_rfr_wm(struct qcom_geni_serial_port *port) 686static void set_rfr_wm(struct qcom_geni_serial_port *port)
@@ -706,7 +702,6 @@ static void qcom_geni_serial_shutdown(struct uart_port *uport)
706 /* Stop the console before stopping the current tx */ 702 /* Stop the console before stopping the current tx */
707 console_stop(uport->cons); 703 console_stop(uport->cons);
708 704
709 disable_irq(uport->irq);
710 free_irq(uport->irq, uport); 705 free_irq(uport->irq, uport);
711 spin_lock_irqsave(&uport->lock, flags); 706 spin_lock_irqsave(&uport->lock, flags);
712 qcom_geni_serial_stop_tx(uport); 707 qcom_geni_serial_stop_tx(uport);
@@ -914,7 +909,7 @@ static int __init qcom_geni_console_setup(struct console *co, char *options)
914 909
915 port = get_port_from_line(co->index); 910 port = get_port_from_line(co->index);
916 if (IS_ERR(port)) { 911 if (IS_ERR(port)) {
917 pr_err("Invalid line %d(%d)\n", co->index, (int)PTR_ERR(port)); 912 pr_err("Invalid line %d\n", co->index);
918 return PTR_ERR(port); 913 return PTR_ERR(port);
919 } 914 }
920 915
@@ -1030,16 +1025,13 @@ static int qcom_geni_serial_probe(struct platform_device *pdev)
1030 1025
1031 if (pdev->dev.of_node) 1026 if (pdev->dev.of_node)
1032 line = of_alias_get_id(pdev->dev.of_node, "serial"); 1027 line = of_alias_get_id(pdev->dev.of_node, "serial");
1033 else
1034 line = pdev->id;
1035 1028
1036 if (line < 0 || line >= GENI_UART_CONS_PORTS) 1029 if (line < 0 || line >= GENI_UART_CONS_PORTS)
1037 return -ENXIO; 1030 return -ENXIO;
1038 port = get_port_from_line(line); 1031 port = get_port_from_line(line);
1039 if (IS_ERR(port)) { 1032 if (IS_ERR(port)) {
1040 ret = PTR_ERR(port); 1033 dev_err(&pdev->dev, "Invalid line %d\n", line);
1041 dev_err(&pdev->dev, "Invalid line %d(%d)\n", line, ret); 1034 return PTR_ERR(port);
1042 return ret;
1043 } 1035 }
1044 1036
1045 uport = &port->uport; 1037 uport = &port->uport;
@@ -1076,7 +1068,6 @@ static int qcom_geni_serial_probe(struct platform_device *pdev)
1076 uport->private_data = &qcom_geni_console_driver; 1068 uport->private_data = &qcom_geni_console_driver;
1077 platform_set_drvdata(pdev, port); 1069 platform_set_drvdata(pdev, port);
1078 port->handle_rx = handle_rx_console; 1070 port->handle_rx = handle_rx_console;
1079 port->setup = false;
1080 return uart_add_one_port(&qcom_geni_console_driver, uport); 1071 return uart_add_one_port(&qcom_geni_console_driver, uport);
1081} 1072}
1082 1073