aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVineet Gupta <Vineet.Gupta1@synopsys.com>2014-06-24 04:25:12 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-07-10 18:45:30 -0400
commit8dbe1d5e09a7faec8d22cadcc1011acab8fa6e2a (patch)
tree350cdd5ae307d6f3d53fa67d9f666153241a754f
parent91f1b62a9b2b8d334b64d3029f4b0dcccf56bc1e (diff)
serial/arc: inline the probe helper
Signed-off-by: Vineet Gupta <vgupta@synopsys.com> Reviewed-by: Rob Herring <robh@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/tty/serial/arc_uart.c90
1 files changed, 40 insertions, 50 deletions
diff --git a/drivers/tty/serial/arc_uart.c b/drivers/tty/serial/arc_uart.c
index 68433adea35b..3b5285373658 100644
--- a/drivers/tty/serial/arc_uart.c
+++ b/drivers/tty/serial/arc_uart.c
@@ -488,50 +488,6 @@ static struct uart_ops arc_serial_pops = {
488#endif 488#endif
489}; 489};
490 490
491static int
492arc_uart_init_one(struct platform_device *pdev, int dev_id)
493{
494 struct device_node *np = pdev->dev.of_node;
495 struct arc_uart_port *uart = &arc_uart_ports[dev_id];
496 struct uart_port *port = &uart->port;
497 u32 val;
498
499 if (of_property_read_u32(np, "clock-frequency", &val)) {
500 dev_err(&pdev->dev, "clock-frequency property NOTset\n");
501 return -EINVAL;
502 }
503 port->uartclk = val;
504
505 if (of_property_read_u32(np, "current-speed", &val)) {
506 dev_err(&pdev->dev, "current-speed property NOT set\n");
507 return -EINVAL;
508 }
509 uart->baud = val;
510
511 port->membase = of_iomap(np, 0);
512 if (!port->membase)
513 /* No point of dev_err since UART itself is hosed here */
514 return -ENXIO;
515
516 port->irq = irq_of_parse_and_map(np, 0);
517
518 port->dev = &pdev->dev;
519 port->iotype = UPIO_MEM;
520 port->flags = UPF_BOOT_AUTOCONF;
521 port->line = dev_id;
522 port->ops = &arc_serial_pops;
523
524 port->fifosize = ARC_UART_TX_FIFO_SIZE;
525
526 /*
527 * uart_insert_char( ) uses it in decideding whether to ignore a
528 * char or not. Explicitly setting it here, removes the subtelty
529 */
530 port->ignore_status_mask = 0;
531
532 return 0;
533}
534
535#ifdef CONFIG_SERIAL_ARC_CONSOLE 491#ifdef CONFIG_SERIAL_ARC_CONSOLE
536 492
537static int arc_serial_console_setup(struct console *co, char *options) 493static int arc_serial_console_setup(struct console *co, char *options)
@@ -620,8 +576,11 @@ EARLYCON_DECLARE(arc_uart, arc_early_console_setup);
620 576
621static int arc_serial_probe(struct platform_device *pdev) 577static int arc_serial_probe(struct platform_device *pdev)
622{ 578{
623 int rc, dev_id;
624 struct device_node *np = pdev->dev.of_node; 579 struct device_node *np = pdev->dev.of_node;
580 struct arc_uart_port *uart;
581 struct uart_port *port;
582 int dev_id;
583 u32 val;
625 584
626 /* no device tree device */ 585 /* no device tree device */
627 if (!np) 586 if (!np)
@@ -631,12 +590,43 @@ static int arc_serial_probe(struct platform_device *pdev)
631 if (dev_id < 0) 590 if (dev_id < 0)
632 dev_id = 0; 591 dev_id = 0;
633 592
634 rc = arc_uart_init_one(pdev, dev_id); 593 uart = &arc_uart_ports[dev_id];
635 if (rc) 594 port = &uart->port;
636 return rc; 595
596 if (of_property_read_u32(np, "clock-frequency", &val)) {
597 dev_err(&pdev->dev, "clock-frequency property NOTset\n");
598 return -EINVAL;
599 }
600 port->uartclk = val;
601
602 if (of_property_read_u32(np, "current-speed", &val)) {
603 dev_err(&pdev->dev, "current-speed property NOT set\n");
604 return -EINVAL;
605 }
606 uart->baud = val;
607
608 port->membase = of_iomap(np, 0);
609 if (!port->membase)
610 /* No point of dev_err since UART itself is hosed here */
611 return -ENXIO;
612
613 port->irq = irq_of_parse_and_map(np, 0);
614
615 port->dev = &pdev->dev;
616 port->iotype = UPIO_MEM;
617 port->flags = UPF_BOOT_AUTOCONF;
618 port->line = dev_id;
619 port->ops = &arc_serial_pops;
620
621 port->fifosize = ARC_UART_TX_FIFO_SIZE;
622
623 /*
624 * uart_insert_char( ) uses it in decideding whether to ignore a
625 * char or not. Explicitly setting it here, removes the subtelty
626 */
627 port->ignore_status_mask = 0;
637 628
638 rc = uart_add_one_port(&arc_uart_driver, &arc_uart_ports[dev_id].port); 629 return uart_add_one_port(&arc_uart_driver, &arc_uart_ports[dev_id].port);
639 return rc;
640} 630}
641 631
642static int arc_serial_remove(struct platform_device *pdev) 632static int arc_serial_remove(struct platform_device *pdev)